One v.s N EventBus

26 views
Skip to first unread message

Dean S. Jones

unread,
Jul 31, 2010, 12:03:48 AM7/31/10
to Google Web Toolkit
Looking at finishing up an idea, and I have come across a thought in
MVP: Global v.s a multiple/hierarchy of view/presenter EventBus's, and
wondered if anyone
had explored this avenue. The basics are there is the global EventBus,
as is typical now, and a local EventBus for actions in the current
View/Presenter, there
may be even more levels, say per sub-panel/component, and the choice
to propagate the events between levels. My current... idiom for using
this is the dispatch
of... "DataModelChange" events, when I don't really know exactly WHO
in the current hierarchy is "listening" ( the UI is composed
dynamically, so I don't have total
foreknowledge of the components interests ). Using GIN/Guice for
injection, obviously, I have to subclass the view/presenter EventBus
to keep it distinct from
the global EventBus type. So, just wondering if anyone has jumped into
this, and what ideas/patterns have fallen out of it for you.

Sebastian Hoß

unread,
Jul 31, 2010, 10:52:49 AM7/31/10
to google-we...@googlegroups.com
I've been using multiple EventBus instances together with Gin/Guice
and named annotations. So for example each view that needs to
communicate in some way with my REST server is attached to the @Server
HandlerManager. That way each component can have multiple
communication channels open and it is possible to re-use some events
across several buses. For example: I defined a simple FilterEvent
which takes a single String as an argument. Depending on the event bus
you are going to use you either filter on types or descriptions here
(so I don't need a FilterTypeEvent and FilterDescriptionEvent).

That said, I've moved away from multiple event buses since this can
get really confusing sometimes ...

> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> 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.
>
>

Gal Dolber

unread,
Jul 31, 2010, 6:45:30 PM7/31/10
to google-we...@googlegroups.com
I am using one event bus across the whole app.
The definition of eventbus implies that, but who knows, I've never though about having multiple eventbuses.
Maybe you can find some benefit from doing that

2010/7/31 Sebastian Hoß <ma...@shoss.de>

ww

unread,
Aug 2, 2010, 12:08:52 AM8/2/10
to Google Web Toolkit
I have the same problem. I am now using the mvp framework of GWT 2.1.0
m2. My application has several modules, and in each module, it may
have different layout. Hence I have multiple level of Activity and in
each module, I have an ActivityManager and ActivityMapper to create an
appropriate Activity according to the Place or return null if not
interested. All the ActivityManagers are attached to a global Event
bus.

For this reason, I have to create all the modules (hence all the
ActivityManager) at the application startup such that it can attach to
the event bus and listen to the Place change events. Thats fine for a
small app and works quite well, but what if the app gets larger and
more levels ? I am now thinking of multiple event bus. When a
module is created, it will forward the Place to the next level
ActivityManager.

Any ideas ?

Reply all
Reply to author
Forward
0 new messages