Re: How to simplify your GwtEvent classes and have fun doing it!

2011-03-02 Thread Brian Bonner
Stephen, This is *awesome*. I recently picked GWT back up...but I couldn't *stand* digging these glorified ditches called Events (and all their gorp) and Handlers. I've just started playing with it and look forward to working with @GwtEvent and @GwtDispatch. Thanks! -- You received this

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-30 Thread Nathan Wells
And that could easily be resolved by keeping all your types in the same place: EventTypes.PLACE_CHANGE EventTypes.VALUE_CHANGE Could this pattern also be enhanced with a sense of payload? something like the following: public class GenericEventP extends GwtEventGenericEvent.Handler { public

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-30 Thread Stephen Haberman
It is a bit of a nuisance maintaining two java files for each event. I agree that GWT events involve a lot of boilerplate. My approach was to write an annotation processor (native Eclipse/javac support) where you just write a spec: @GenEvent public class CalendarChangeRequestEventSpec {

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-30 Thread Stephen Haberman
public class GenericEvent extends GwtEventGenericEvent.Handler { This is very tangential, but all the talk about a generic event made me think of a paper a colleague of mine linked me to about potential design patterns for UI listeners in Scala:

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-29 Thread Thomas Broyer
On 28 juin, 17:50, Paul Schwarz paulsschw...@gmail.com wrote: Thanks Phil, though what would this look like in this case? The design of the GwtEvent and TYPE being static is actually very powerful in its elegant simplicity. A call to the constructor of GwtEvent.Type() actually causes an int

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-28 Thread PhilBeaudoin
Another simple trick I use when I need multiple events that have the same payload and handler methods, is to not declare the TYPE as a static member of the event. Instead I declare it elsewhere (anywhere really) and pass it to the event's constructor. Really simple, but can dramatically cut down

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-28 Thread Paul Schwarz
Thanks for the crits Thomas, I've learned something from this: keeping handlers together in a given class. That's quite neat because really what I was driving at is not so much optimising output of the GWT compiler, but more cutting down on the cognitive load on the developer and time it takes

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-28 Thread Paul Schwarz
Thanks Phil, though what would this look like in this case? The design of the GwtEvent and TYPE being static is actually very powerful in its elegant simplicity. A call to the constructor of GwtEvent.Type() actually causes an int to be incremented and this becomes the hashCode ID of this event

How to simplify your GwtEvent classes and have fun doing it!

2010-06-27 Thread Paul Schwarz
When using the EventBus, for each event type in your system you will create a Class (a GwtEvent) and an Interface (the corresponding EventHandler). It is a bit of a nuisance maintaining two java files for each event. So I propose to simplify it by having one abstract event class and then ONLY ONE

Re: How to simplify your GwtEvent classes and have fun doing it!

2010-06-27 Thread Thomas Broyer
A few comments On 27 juin, 13:53, Paul Schwarz paulsschw...@gmail.com wrote: When using the EventBus, for each event type in your system you will create a Class (a GwtEvent) and an Interface (the corresponding EventHandler). It is a bit of a nuisance maintaining two java files for each