Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Overwriting the ComboBox/VFilterSelect onClick Method
Hi there,
i create a new Component - VSuggestComboBox on the Clientside by extending VFilterSelect.
public class VSuggestComboBox extends VFilterSelect {
protected List<KeyCodeListener> listeners = new LinkedList<KeyCodeListener>();
@Override
public void onKeyDown(KeyDownEvent event){
if(!enabled || readonly){
return;
}
int kc = event.getNativeKeyCode();
if(kc == KeyCodes.KEY_ENTER){
if (event.getSource() instanceof TextBox && !"".equals(((TextBox) event.getSource()).getText())) {
fireEnterEvent();
return;
}
}
super.onKeyDown(event);
}
@Override
public void onClick(ClickEvent event){
fireSearchEvent();
}
private void fireSearchEvent() {
for (KeyCodeListener l : listeners) {
l.search();
}
}
private void fireEnterEvent() {
for (KeyCodeListener l : listeners) {
l.onEnter();
}
}
public void addListener(KeyCodeListener l) {
listeners.add(l);
}
public void removeListener(KeyCodeListener l) {
listeners.remove(l);
}
public interface KeyCodeListener {
public void onEnter();
public void search();
}
Catching the event when the user presses Enter works perfectly, but i exchanged the "drop-down-buttons" icon with a search icon and want to catch the onClick event. As you can see in the class i overwrite the onClick(ClickEvent event) method from VFilterSelect, but the event is never fired.
The intention is to use this button as the search button and have the combobox suggest hits, everything works fine but the onClick-Method seems to never be called.
Am i overlooking something or doing something wrong? Im aware of the fact that in VFilterSelect the event is analyzed for the source of the click, and by just overwriting the method without calling super.onClick i should get every click-event on the box, but i get nothing...
Any help is highly appreciated!