Search code examples
javagwtgxt

@UiHandler : Required to delegate handlers?


I have a class which extends the GXT ComboBox :

public class RemoteCombo<Row> extends ComboBox<Row> {
    ...
}

Later, I use it in some code :

@UiField(provided = true)
RemoteCombo<Town> town;

@UiHandler("town")
public void onTownValueChanged(ValueChangeEvent<Town> event) {
  ...
}

I get the following error :

[ERROR] Field 'town' does not have an 'addValueChangeHandler' method associated.

This is false because town is a RemoteCombo, RemoteCombo extends ComboBox, ComboBox has this method.

If I delegate this method in RemoteCombo.java, it works :

public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Row> handler){
  return super.addValueChangeHandler(handler);
}

Nevertheless, I find weird that I have to delegate every method that I need to use with @UiHandler. Do I do something wrong or is it a bug?


Solution

  • I think, you are doing right.

    Take a look at what Colin Alworth wrote (at the end of the thread).

    http://www.sencha.com/forum/showthread.php?240102-How-do-I-add-a-selection-listener-to-a-SimpleComboBox&langid=4

    and here:

    http://code.google.com/p/google-web-toolkit/issues/detail?id=6091