On Jan 25, 5:34 pm, Ice13ill <andrei.fifi...@gmail.com> wrote: > Hello, i'm trying to develop a custom application event system using > my own events and a base event (inherited by the other event types) > > Here is the code of the base event class: > > public class EBaseEvent<H extends EventHandler> extends GwtEvent<H>{ > > public static GwtEvent.Type<H> TYPE = new GwtEvent.Type<H>(); > > @Override > public GwtEvent.Type<H> getAssociatedType() { > return TYPE; > } > > } > > The first pb is a compilation problem: i get the message: > > "Cannot make a static reference to a non-static type H" > I don't understand, why is H a static type ? and how can i resolve the > pb ? (i'm not very good working with parametrized types) > > The second pb is that i'm not sure if this is a good/correct approach. > Any ideas ?
The problem is that the Type<> should be unique for each event (otherwise, you couldn't listen only to a specific subclass of your event; instead all your handlers would be called whichever the specific type of EBaseEvent). In GWT, DomEvent extends GwtEvent but does not create a Type<>, instead all DomEvent's subclasses have their own Type<?> (don't go read the DomEvent code, it'll probably distract and confuse you, because DomEvent is so special in also having to attach handlers to the DOM). -- 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.