Re: which EventBus

430 views
Skip to first unread message

Michael Allan

unread,
Jul 28, 2012, 2:26:04 PM7/28/12
to google-we...@googlegroups.com
andrewsc said:

> I've seen SimpleEventBus ... being used in 2.4 apps, but I can't
> find any description of it, apart from JavaDoc mentining it is a
> wrap around legacy. Does anyone have more material about
> SimpleEventBus ?

Up another level and there are some docs:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/web/bindery/event/shared/EventBus.html

Note the duplication between these two packages:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/web/bindery/event/shared/package-summary.html
http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/event/shared/package-summary.html

Myself, I use the 'bindery' one:
http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/web/bindery/event/shared/SimpleEventBus.html

--
Michael Allan

Toronto, +1 416-699-9528
http://zelea.com/

andrewsc

unread,
Aug 1, 2012, 12:15:13 AM8/1/12
to google-we...@googlegroups.com
yeah, well, I guess I need to adapt to the brave new world, where a two-line paragraph in the Javadoc passes for documentation. Perhaps this is the price we pay for having access to the source. Still, it's a long and hard road, from reading GWT sources, to building an understanding of concepts.

The good news is that my posting got published in this group, so I can ask here if I get into any trouble -:)
Regards,

Andrew

On Friday, July 27, 2012 1:47:13 PM UTC+10, andrewsc wrote:
I'm going through the MVP Tutorial Part One with the Tutorial-Contacts
The article recommends the use of HandlerManager and points to a 2.0 copy of the JavaDoc
 
However, the more recent 2.4 Javadoc has the following recommendation:
 
application developers are strongly discouraged from using a HandlerManager instance as a global event dispatch mechanism.
 
What is the recommended replacement in 2.4 ? 
 
I've seen SimpleEventBus being used in 2.4 apps, but I can't find any description of it, apart from JavaDoc mentining it is a wrap around legacy.
 
Does anyone have more material about SimpleEventBus ?
 
Andrew
 

Jens

unread,
Aug 1, 2012, 4:21:15 AM8/1/12
to google-we...@googlegroups.com
Always use the web.bindery EventBus in your code and never use the HandlerManager directly. Also I strongly recommend to use Part II of the mentioned article (https://developers.google.com/web-toolkit/articles/mvp-architecture-2) which makes your code a lot cleaner.

-- J.

FrugoFrog

unread,
Aug 2, 2012, 10:33:53 AM8/2/12
to google-we...@googlegroups.com
I was mid way of re-factoring the code when I realised that the
Activity interface needs EventBus from
com.google.gwt.event.shared.EventBus :(
> --
> 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/-/e2cEMuQscaUJ.
>
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

Jens

unread,
Aug 2, 2012, 10:55:14 AM8/2/12
to google-we...@googlegroups.com
I  was mid way of re-factoring the code when I realised that the
Activity interface needs EventBus from
com.google.gwt.event.shared.EventBus :(

Simply don't import the old EventBus package in your activity. If you need to store the EventBus provided in the start() method in your activity then assign it to a variable that represents the new EventBus.

-- J.

Clint Checketts

unread,
Aug 3, 2012, 1:03:48 PM8/3/12
to google-we...@googlegroups.com
That would be a good/quick fix for GWT 2.5 to deprecate the old 'start' method and fix the signature.

On my project we have a base Activity and that is exactly what I did, so we always have the right EventBus imported..

-Clint


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

FrugoFrog

unread,
Aug 3, 2012, 1:47:51 PM8/3/12
to google-we...@googlegroups.com
yes that's what I mean. I inherited the code that uses RF and MVP.
Classes implement Activity interface defined in
com.google.gwt.activity.shared and this needs the Event bus from the
same package. I'm not sure if this will change in future releases of
GWT.
Looks a bit inconsequent to me But hey it's gwt one shouldn't be surprised

Jens

unread,
Aug 3, 2012, 2:14:18 PM8/3/12
to google-we...@googlegroups.com
Changing it would be a breaking change for existing apps, thats why Activity still uses the old EventBus in its start method. 

Maybe this will change in the future but if you think about that the deprecated addXyzListener() methods in GWT are deprecated since GWT 1.6 it will probably take a while...

-- J.

andrewsc

unread,
Aug 6, 2012, 1:37:40 AM8/6/12
to google-we...@googlegroups.com
Jens,

thanks for you reply.

The MVP-2 example (with UIBinder) also uses HandlerManager directly in its code, just as the MVP-1.  I shall try my hand, using SimpleEventBus in these samples.

I wonder how HandlerManager got into these samples in the first place. Was it a mere oversight, in a series of articles which were focusing on MVP, without paying much attention to the choice of EventBus ?  Or, was there some evolution over time, resulting in HandlerManager falling out of grace ? 

I'm learning my way through a huge GWT project which has been going for years. It carries the scars of multiple paradigm-changes, where the preferred design pattern of one year has become the black sheep of the next year.  A herd of sheep would be a more accurate analogy for the different web pages developed over the years: some black, some grey, and some shining white -:)   The romans said "ars longa, vita brevis" so let's enjoy the journey.

Andrew
Reply all
Reply to author
Forward
0 new messages