As the tests shows this is pluggable in Wicket. There is a default impl that uses casting of the payload and there is a way to setup your own impl that does it your way. See Jeremy's message in this thread for a solution that works as Google's one.
On Tue, Jun 19, 2012 at 11:36 PM, Douglas Ferguson <the...@gmail.com> wrote: > Yeah... i just don't like the idea of unpacking the payload and doing > instanceOf, if/else do decide if I care about that message. > > The GoogleEvent buss approach seems better. I.E. Implement the specific > methods for the specific event types. > > Douglas > > On Jun 19, 2012, at 3:20 PM, Martin Grigorov wrote: > >> Wicket always sends ComponentEvent. >> The dynamic part is the event's payload. >> The test shows how to receive the payload in a type-safe way. >> >> On Tue, Jun 19, 2012 at 11:16 PM, Douglas Ferguson <the...@gmail.com> wrote: >>> Ok.. So I took a look at it and it is ignoring the IEvent. >>> >>> I'm actually interested in how to cleanly handle multiple type of IEvents >>> without having to >>> do if/else or instanceOf. Was curious if anybody had a nice pattern to >>> follow. >>> >>> @Override >>> 115 public void onEvent(Component component, IEvent<?> event) >>> 116 { >>> 117 invocationTimes++; >>> 118 } >>> 119 >>> >>> >>> >>> On Jun 19, 2012, at 2:20 PM, Martin Grigorov wrote: >>> >>>> See org.apache.wicket.EventDispatcherTest in wicket-core's tests >>>> >>>> On Tue, Jun 19, 2012 at 9:58 PM, Douglas Ferguson <the...@gmail.com> wrote: >>>>> Anybody have a good pattern for using Events without having lots of >>>>> instanceOf, if/else, or switch statements? >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>>> >>>> >>>> >>>> >>>> -- >>>> Martin Grigorov >>>> jWeekend >>>> Training, Consulting, Development >>>> http://jWeekend.com >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >> >> >> >> -- >> Martin Grigorov >> jWeekend >> Training, Consulting, Development >> http://jWeekend.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org