I get the following compilation error: “reference to addListener is ambiguous, both method addListener(com.vaadin.ui.Button.ClickListener) in com.vaadin.ui.Button and method addListener(com.vaadin.event.FieldEvents.BlurListener) in com.vaadin.ui.Button match”.
In fact, the class I’m referring to actually implements both the FieldEvents.BlurListener and the Button.ClickListener interfaces. So a call to Button’s addListener() is ambiguos.
Is there any chance to do what I’m trying to do? i.e.:
public class X implements FieldEvents.BlurListener, Button.ClickListener {
…
public void blur(FieldEvents.BlurEvent event) {
…
}
public void buttonClick(Button.ClickEvent event) {
…
}
}
and have this class added with addListener() to a button?
Or you could create separate listener classes that don’t implement more than one interface (I just don’t like casts (though I apparently do like parentheses)). If you do this as inner classes, you’ll use less memory by declaring them static:
public class MyMainClass {
// etc
static class MyListener implements etc {
}
}