Sunday, August 29, 2010

using the Widget.handlerManager with Composites

Hi,

I am using Composites and would like to be able reference the
HandlerManager methods. These seem to not be visible to me so I end
up duplicating the code that already exists on Widget for my
composites - is there any reason why these methods are friendly scoped
instead of protected scoped? Or, am I just thinking about this
incorrectly? Here is what I end up re-writing for my composites:


HandlerManager ensureHandlers() {
return handlerManager == null ? handlerManager =
createHandlerManager()
: handlerManager;
}

HandlerManager getHandlerManager() {
return handlerManager;
}

public final <H extends EventHandler> HandlerRegistration
addHandler(
final H handler, GwtEvent.Type<H> type) {
return ensureHandlers().addHandler(type, handler);
}

public void fireEvent(GwtEvent<?> event) {
if (handlerManager != null) {
handlerManager.fireEvent(event);
}
}

So, am I missing something here? This just doesn't make sense that I
would have to do this. Thanks.

Joe

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment