Thanks Jeff! I wonder if it would better to implement a HandlerManager that understands event type hierarchy or add a "type" parameter to the event and do the if/switch in the event handler.
On May 26, 11:46 am, Jeff Chimene <jchim...@gmail.com> wrote: > Hi Julio: > > Events are rarely hierarchical, which is not to say that they don't have > parameters. For example: > getEventBus.fireEvent(new GameEvent(EVENT.QUIT)) > > From the perspectives of reliability, maintenance, performance, I would not > add the same listener for all event types. I'm assuming that by > "HandlerEvent" you really mean the corresponding event handler. If that's > what you mean, the answer is no. Event handlers are flat; absent event > parameters, they cannot manage an event hierarchy you describe. > > I'm wondering if what you're really wanting is AOP. GWT isn't AOP friendly > (yet). > > On Wed, May 26, 2010 at 7:18 AM, Julio Faerman <jfaer...@gmail.com> wrote: > > Hi, > > > In my game UI i have several events, from generic to specific > > ( GameEvent > PlayerMessageEvent > PlayerVoteEvent ... ). Some widgets > > are interested in all events, logging all GameEvents for instance, and > > other are only interested specific events, showing all player votes > > for example. > > Given that event listeners must listen to a single GwtEvent.Type using > > the HandlerManager, what is the best way to implement such system? > > Should i add the same listener for all types or the HandlerEvent can > > handle inheritance? > > > Thanks, > > Julio > > > -- > > 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-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-web-toolkit?hl=en. > > -- 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-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.