From last few months I am working on gwt-ext.In that I am using a doLayout() method of Container class.Here is description of it.
Force this container's layout to be recalculated. A call to this function is required after adding a new component to an already rendered container. If you are not dynamically adding and removing components after render, this function will generally not need to be called.
Do this method is basically used to render container.
Now I am using core gwt 2.3. Is there any method to render the container in gwt.or any other way to achieve this ???
Thanks in advance
AFAIK, GWT does not require this. Just call .add() on any Panel to add children. They should be immediately visible.
Related
Using plain old javascript version of ag-grid.
I would like to destroy the ag-grid that is in a div from a button click event.
How do i destroy the grid?
There is a method named destroy().
As per documentation:
destroy()
Gets the grid to destroy and release resources. If you are using Angular (version 1 or 2) you do not need to call this, as the grid links in with the AngularJS 1.x lifecycle. However if you are using Web Components or native Javascript, you do need to call this, to avoid a memory leak in your application.
Have a look at the Plunk - Destroy grid I created.
gridOptions.api.destroy();
As you can see, by calling this function, the grid gets destroyed.
As described in the documentation, it not only clears the DOM, but also takes care of memory leaks.
I want execute some logic after the moment when widget is attached and all images inside this widget are loaded. This widget show a block of html prepared in CMS (so the number of images is dynamic).
What have I tried:
override Widget.onAttach() or Widget.onLoad(). Unfortunately both of them are executed before the moment when all images are loaded.
I found gwt-image-loader library which can add a callback per image. I wan't use it due to dynamic nature of the content.
In JavaScript there is this option which works great:
$('selector').waitForImages(function() {
// do some logic
});
Maybe I missed some GWT way to do the same thing?
You can try GWT's Image.addLoadHandler()
onLoad and onAttach methods are there to inform you that the <img> tag is attached to your document and that is it. This helps in setting image attributes such as height, width, position and so on. What you are asking is, after the image is attached to document you want an handler after the image is rendered. This is not possible with the current version of GWT as per my experience. Further rendering of image depends on the network you are in, the server you are connected and so on. So instead of wanting for a render callback, try to do the work in onLoad or onAttach methods or add a loadHandler for the same
I have a Containerwith so many Labels added inside it. When I try to capture the pointerReleased event in this Container, I have found some problems. The event only is captured when I released in the free area of the Container, no when I made the release over the Labels. Is there any way to encapsulate this event? I mean when I will do the realase over the main Container(instead I'm on a Label), the event must be launched.
Here you can take a look at my Container
You should look at the lead component feature added in LWUIT 1.5, it allows you to define a component that manages the entire hierarchy of container/component and all events for every component in the hierarchy are sent to it.
This adds another benefit of handling the style synchronization between all the different elements (e.g. if you use a button all components will become pressed together).
I dont' find any cool solution, so finally I propagate the pointerReleased from the Labelsto the Container.
Hi everyobodyI was trying hands on Gxt/Sencha and bumped on this issue of adding widgets into HorizontalPanel etc to change widgets dynamically but not got it to worked as I assumed it is gwt in base may be applicable to it too. I tried repaint() and adding widgets at runtime also but had not luck there too. Kindly suggest some solution/approach or link for this problem. Thanks in advance.regardsla_89ondevg
The question is terribly hard to understand but here goes :
Have you tried calling the layout() method on the container after adding the widgets?
Ensure that the container does in fact have an applicable layout.
Also try the overload by passing true as a parameter to the layout() call.
I have added a container named btnBar with boxlayout(x-axis) on a form. the container has 4 buttons of custom class MyButton that extends from Button itself. When i add actionlistener to one of the buttons in the container it gets invoked for each n every button. Even the actionevent.getsource.gettext method returns the same value irrespective of the focus. I have added the buttons through an array and m trying to use is something like this:
btns[0].addActionListener(......)
Where am I going wrong?
got is solved buddies...actually was using setfocus() to traverse within the btnBar on buttons...but needed to use setFocused() method of form too....after setFocus()....dnt hammer ur brains now....
You must never use setFocus, you should use setFocusable to toggle focusability and requestFocus to get the focus to a specific component.
You should also migrate to Codename One, since LWUIT is pretty much unmaintained.