Event Bubbling

242 views
Skip to first unread message

Oussema Gabtni

unread,
Dec 6, 2011, 8:29:19 AM12/6/11
to Google Web Toolkit
Hello,

Is it possible in GWT to use Event bubbling?
For example i would like to propagate an event from a GWT component to
all it's sub components.
Is there a mechanism that implements this feature?


Thanks a lot for the reply

Ashton Thomas

unread,
Dec 6, 2011, 10:06:20 AM12/6/11
to google-we...@googlegroups.com
You can use a global EventBus: http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/event/shared/SimpleEventBus.html

and just have only the widgets that need to listen for particular events (you can add custom events for any situation) register with the global EventBus 

Sorry if this doesn't answer your question or only presents things you already know. 

I have sometimes used the exact same idea to create custom "local" eventBus that handle event notification within certain areas. 

Ed

unread,
Dec 6, 2011, 12:56:01 PM12/6/11
to Google Web Toolkit
The event bubbling you are looking for has nothing to do with GWT.
It's a java design issue.

Like Ashton suggests: use a local (or global) event bus.
Or a parent child relation.
Example: Archive controller with a Declaration and Wallet Archive
controller that will show them self depending if the user want's to
see the wallet or declarations.
The Archive will forward the events to his child's when needs. You can
put this event orchestration in a base class which classes like
Archive extend.

GWT Event bubbling works great but just the other way around as you
suggest.
Example: A panel contains a Button widget. You attach a click handler
to the panel and will receive the Button click events. Very handy when
the Panel has many buttons for example (event bubbles up). This
doesn't work for focus events btw.

Ed

Axel R

unread,
Feb 13, 2014, 11:25:21 AM2/13/14
to google-we...@googlegroups.com

Hi Ed,

I am looking for a  simple exemple of 'event bubbling'...Just like the one you were talking about...an HTMLPanel that has various buttons and I want to intercept the clickEvent of each of them...Maybe you could post a little of code illustrating how you did it ?

I have tried to find informations but GWT event bubbling is poorly documented I think...

Thanks you,
Axel


Ed

unread,
Feb 13, 2014, 12:40:32 PM2/13/14
to Google Web Toolkit
Hi Axel,

We abandoned this approach in favor of inner html, where the server takes care of status back to the client.

For processes that take a bit of time, the server responds to the request without closing the request so the user has an inkling of progress.

Ed



--
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-tool...@googlegroups.com.
To post to this group, send email to google-we...@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.

Thomas Broyer

unread,
Feb 13, 2014, 2:18:58 PM2/13/14
to google-we...@googlegroups.com
I think there were examples in the slides for architecturing GWT apps for performance at I/O 2010 or 2012.

You'll find a few examples in Cell implementations, and UiRenderer is based it too (easier than rolling your own, but it's useful to know what it all means)

Reply all
Reply to author
Forward
0 new messages