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.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin 8 remove valuechange listeners

Rien Genie
6 years ago Mar 24, 2017 11:06am


How can I remove a valuechangelistener from an abstract field in vaadin 8?
In vaadin 7 I did.
        if (c instanceof AbstractField){
                    listeners = (Collection<ValueChangeListener>) ((AbstractField) c).getListeners(ValueChangeEvent.class);
                    for (ValueChangeListener liste: listeners){                    
                        ((AbstractField) c).removeValueChangeListener(liste);

Best regards,


Normand Fortier
6 years ago Mar 24, 2017 2:50pm

My understanding is that the HasValue.addValueListener(HasValue.ValueChangeListener) method returns a Registration instance; to remove the listener you call the remove() method on the Registration object.
It would be useful if someone could explain the rationale behind this decision: at first sight it hides a simple, clear method call behing an interface, it breaks symmetry (add/remove) and means you have to keep a reference to yet another object (Registration) when you already have one to the listener and the "listened to".

Rien Genie
6 years ago Mar 28, 2017 9:36am
Ethan Russell
5 years ago Mar 09, 2018 9:06pm

Any update on this?