GregH
GregH

Reputation: 5459

Button action with @UiHandler not being hit

I am currently having issues implementing a button event with the @UiHandler annotation. In my .xml file I have my button defined as ui:field="clearAllButton". In the class (ServerTaskSchedulingViewImpl.java) which I am trying to set up the action I have the following:

interface ServerTaskSchedulingViewImplUiBinder
        extends UiBinder<Widget, ServerTaskSchedulingViewImpl> {}

private static final ServerTaskSchedulingViewImplUiBinder uiBinder =
        GWT.create(ServerTaskSchedulingViewImplUiBinder.class);

....
....
@UiField
Button clearAllButton;
....
....
@UiHandler("clearAllButton")
void clearAllButtonClicked(ClickEvent clickEvent) {
    System.out.println("Button action performed");
}

When I set a break point in the clearAllButtonClicked function, it is never hit.

Does anyone know why this is happening?

Upvotes: 0

Views: 112

Answers (2)

GregH
GregH

Reputation: 5459

Fixed the issue- my .xml file was not named the same as my .java class file although the xml UiField and java variable names did match. Changing the name of the .xml file to JobViewImpl.ui.xml and class name to JobViewImpl.java. This resolved the issue

Upvotes: 0

Mo&#39;in Creemers
Mo&#39;in Creemers

Reputation: 1149

Looks correct but a breakpoint here will never be hit because it's all javascript that's running. Try using SuperDevMode and set a breakpoint in the browser instead.

Upvotes: 1

Related Questions