Loading...
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
TUTORIAL

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

Binded CheckBoxGroup SelectionListener not fired on deselection

René Wilby
4 years ago Apr 21, 2017 7:20am
René Wilby
4 years ago Apr 24, 2017 12:01pm

After posting this question on Stack Overflow as well I received an answer, which is the solution for my problem. I have to override the "hashCode" method in the Tag class. The class Tag looks like this now:

package com.vaadin.test;

public class Tag {

    private String name;

    public Tag(String name) {
        super();
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return name;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;

        Tag tag = (Tag) obj;

        return this.name.equals(tag.getName());
    }

    @Override
    public int hashCode() {
        return this.name.hashCode();
    }
}