Hi all. I've been trying to get a nice setup of the best practices presented at google i/o. I have something working, but a few questions.
The first one is how fine-grained do you go for the events you define? Say i have events for updates in entities A and B in my model: UpdatedAEvent, UpdatedBEvent. To prevent creating new event classes for every entity i might add, i liked the idea of using generics after looking at the source code of GWT. Classes like: public class ModelUpdatedEvent<V> extends GwtEvent<ModelUpdatedHandler<V>> { ... private static Type<ModelUpdatedHandler<?>> TYPE; ... public static Type<ModelUpdatedHandler<?>> getType() { if (TYPE == null) { TYPE = new Type<ModelUpdatedHandler<?>>(); } return TYPE; } ... But then i guess i can't use them with an event bus (the HandlerManager)? I lack complete understand of generics and wildcards, but assuming the class doesn't know the type, this won't work right? eventBus.addHandler(ModelUpdatedEvent.getType(), ...) I'll gladly take pointers to examples or explanations of how i could use generics here. The second point is regarding dependency injection. I got it working for things implementing interfaces, to which i bind implementations. But how do you go for the HandlerManager for example? I've tried making it a singleton as in: protected void configure() { ... bind(HandlerManager.class).asEagerSingleton(); ... but i get "No @Inject or default constructor found for class com.google.gwt.event.shared.HandlerManager". Same if i use .in(Singleton.class). I've seen that GWT should fallback to GWT.create when there's no injection available, but if i don't mention the HandlerManager in my injector it also fails. Thanks in advance. I'm having fun with GWT :-) Cheers, Ricardo --~--~---------~--~----~------------~-------~--~----~ 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-Toolkit@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 -~----------~----~----~----~------~----~------~--~---