EventBus and HandlerManager Classes. Difference?

758 views
Skip to first unread message

Ashton Thomas

unread,
Sep 17, 2010, 3:05:05 PM9/17/10
to Google Web Toolkit
I am confused as to when use the abstract class EventBus class that
implements HasHandlers:
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/event/shared/EventBus.java

and the class HandlerManager that also implements HasHandlers:
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/event/shared/HandlerManager.java

I know we have th SimpleEventBus that extends EventBus but I am still
a bit confused. Can anyone do a brain dumb or drop some info?

Thomas Broyer

unread,
Sep 17, 2010, 4:12:30 PM9/17/10
to Google Web Toolkit

On Sep 17, 9:05 pm, Ashton Thomas <ash...@acrinta.com> wrote:
> I am confused as to when use the abstract class EventBus class that
> implements HasHandlers:http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/...
>
> and the class HandlerManager that also implements HasHandlers:http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/...
>
> I know we have th SimpleEventBus that extends EventBus but I am still
> a bit confused. Can anyone do a brain dumb or drop some info?

Basically, HandlerManager is only to be used within widgets (and it is
an internal part of Widget, backing the addHandler and addDomHandler
methods; so you shouldn't have to use it directly, probably the reason
it's marked @Deprecated).

If you need an event bus to make you apps components communicate with
each others, then you should use EventBus, which SimpleEventBus is an
implementation.

Ashton Thomas

unread,
Sep 18, 2010, 9:26:20 AM9/18/10
to Google Web Toolkit, t.br...@gmail.com
Thanks very much, Thomas. This make a little more sense. I keep
looking at the base roo application and it is showing ( I think as of
M3 with the ScaffoldFactory) the use of the HandlerManager.

So it is good to hear that for certain that we are moving away from
HandlerManager and to implementations of the EventBus.

Thanks very much!

Thomas Broyer

unread,
Sep 18, 2010, 7:21:18 PM9/18/10
to Google Web Toolkit


On Sep 18, 3:26 pm, Ashton Thomas <ash...@acrinta.com> wrote:
> Thanks very much, Thomas. This make a little more sense. I keep
> looking at the base roo application and it is showing ( I think as of
> M3 with the ScaffoldFactory) the use of the HandlerManager.

SimpleEventBus didn't yet existed in 2.1M3 and HandlerManager was the
only (provided) implementation of EventBus.

> So it is good to hear that for certain that we are moving away from
> HandlerManager and to implementations of the EventBus.

http://code.google.com/p/google-web-toolkit/source/detail?r=8756
"""Refactors HandlerManager.HandlerRegistry into a new public class,
SimpleEventBus. MultiFire, default source stamping, and event
recycling are left as features of HandlerManager. HandlerManager no
longer implements EventBus interface, in the interest of less
confusing API for EventBus users."""

Ashton Thomas

unread,
Sep 18, 2010, 8:35:22 PM9/18/10
to Google Web Toolkit
Thanks, I was looking for this info before posting. But I have been
away from the gwt world for a bit and got out of sync.

Thanks!
Reply all
Reply to author
Forward
0 new messages