Friday, May 25, 2012

Re: UIB click handlers, GWTQuery, and TD's ;)

If you want to use @UiHandler and thus GWT's event handling I think you just have to call onAttach()/onDetach().

So your code would be:

GQuery td = $("<td colspan='x'/>");
ThingyBarUIB thingyBar = new ThingyBarUIB(); //UiBinder with @UiHandler
thingyBar.loadData(someObject);
thingyBar.attachTo(td); // implemented as: void attachTo(Element e) { e.append(getElement()); onAttach(); }

.... and later on when you dont need thingybar anymore:

thingyBar.detach(); //implemented as: void detach() { getElement().removeFromParent(); onDetach(); }

If you, for some reason, cant say when to detach() you could add your thingyBar to RootPanel.detachOnWindowClose(Widget w); in your attachTo() method. This would be similar to what Button.wrap(Element e) does. Take a look at the source code. But as you add a widget to a td cell you should know when to remove it, so calling a detach() method should be preferred.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Zzt1RztjTRcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate