Tuesday, August 27, 2013

Re: Correct way to sink events on UiBinder Element



On Tuesday, August 27, 2013 5:01:07 PM UTC+2, Shaun Tarves wrote:
Thomas,

Thanks for the heads up about the leak. How would I use "uibinder for
cells" if I am just creating a standard Composite-based widget?

Either you compose widgets, or you go low-level and then you can use "uibinder for cells" to work at the element-level.

What would an event delegation path look like at the composite level?
Do I just sink the events on this.getElement() and then check if the
event target is my UiField Element?

Basically, yes (you'd use addDomHandler or override onBrowserEvent though rather than "sink the events on this.getElement()")

With "uibinder for cells" (aka UiRenderer), you'd either build a Cell to use in CellWidget (have a look at TextButton for an example of such widget, even though it doesn't use UiRenderer) or extend Widget. In the latter case, you can render() your element into some root element (say, a <div>) using setInnerHTML, and delegate the widget's onBrowserEvent to the UiRenderer's onBrowserEvent, so it will do the dispatch to the appropriate @UiHandler method. And you can possibly get the inner elements to manipulate them directly.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment