开发者

Event propagation in GWT

If I have a widget that fires a custom event, and that widget is contained in a hierarchy of other widgets like:

Parent1 contains Parent2 contains Parent3 contains CustomWidget

Then in order to propagate the initial event to Parent1, do i have to ad开发者_如何学JAVAd event handlers all over the way and make each interior node fire the same event, or there is another way?

Let's say we have the following custom widget1:

<g:FocusPanel>

 <g:Image/>

</g:FocusPanel>

And it is contained in custom widget2 which listens for events fired by widget1:

<g:ScrollPanel>

 <my:CustomWidget1/>

</g:ScrollPanel>

Now, if custom widget2 is itself contained to another widget (and in turn is contained to another...) then in order to catch the first event dispatched from widget1 do i have to add handlers respectively to all parent widgets, or there is another way?


GWT suggest to use an EventBus for handling such events.

See Google I/O 2009 - Best Practices for Architecting GWT App

See Google I/O 2009 - Best Practices for Architecting GWT App (http://www.youtube.com/watch?v=PDuhR18-EdM)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜