Thursday, December 30, 2010

Events not firing or caught, though handlers created successfully

Hi,

I am implementing a small GWT application containing a couple of
buttons. I take most of my inspiration from the contact tutorial.

I fire the button events with something like this:

display.getCreditsButton().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event) {
Window.confirm("Firing CREDITS");
Singletons.EVENT_BUS.fireEvent(new
DisplayCreditsEvent());
display.getLabel().setText("Firing CREDITS");
}
});

I have added extra debugging code (Window & Label).

I sink the button events with code like this:

Singletons.EVENT_BUS.addHandler(DisplayCreditsEvent.TYPE,
new DisplayCreditsEventHandler() {
@Override
public void onDisplayCreditsEvent(DisplayCreditsEvent
event) {
Window.confirm("Sinking CREDIT");
History.newItem("Credits");
display.displayCredits();
}
});

I am 100% sure this code is executed, because I have set debugging
Window.confirm(...) statements all over the place and they pop-up
successfully.

Unfortunately, the onClick(...) and onDisplayCreditsEvent(...) methods
are never called when I click on button. The application compiles
successfully and runs on Tomcat.

What could I be doing wrong? What could I be missing? I am using GWT
2.1.0 and Firefox 3.6.13.

--
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