Calendar EventChangeListener broken

It looks to me like the Calendar EventChangeListener for ContainerEventProvider is broken:

I’m using Vaadin 7.1.10

The method addEventChangeListener in ContainerEventProvider

  public void addEventChangeListener(EventChangeListener listener) {
        if (eventChangeListeners.contains(listener)) {
            eventChangeListeners.add(listener);
        }
    }

If you look at the if statement you will notice that it only addes the listener if it is already in the list of listeners.
I think the code should be:

  public void addEventChangeListener(EventChangeListener listener) {
// Note the extra ! at the start of the if statement.
        if (!eventChangeListeners.contains(listener)) {
            eventChangeListeners.add(listener);
        }
    }

But I actually think the problem goes deeper as there is no code in the class ContainerEventProvider to actually fire the events.

Now I do wonder if I’m going down the wrong path or the code in this area just isn’t excercised enough because the listeners aren’t actually being attached to the calender.

Background: I have an event ScoutCalEvent and a provider ScoutContainer which extends ContainerEventProvider.

I’m trying to implement EventChangeNotifier for ScoutCalEvent so that I can do editing directly from the calendar. e.g. click and event pop open a dialog, make changes to the event and save it.
Of course when I do this the calendar doesn’t get updated as its not aware of the changes hence the interest in EventChangeNotifier.

If I look at the calendar code for setContainerDataSource it actually makes sense:

public void setContainerDataSource(Container.Indexed container) {
        ContainerEventProvider provider = new ContainerEventProvider(container);
        provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() {
            @Override
            public void eventSetChange(EventSetChangeEvent changeEvent) {
                // Repaint if events change
                markAsDirty();
            }
        });
        provider.addEventChangeListener(new EventChangeListener() {
            @Override
            public void eventChange(EventChangeEvent changeEvent) {
                // Repaint if event changes
                markAsDirty();
            }
        });
        setEventProvider(provider);
    }

You can see here that a listener is setup and the calendar is markedAsDirty when an event changes.

The question is why isn’t the same done for setEventProvider?

Am I trying to use the code incorrectly?

Essentially I’ve worked around the problem by having my provider directly mark the calendar as dirty when an event changes but I don’t think that is how the library is actually designed.