How can I prevent a value change listener to be fired when I call the setVa

How can I prevent a value change listener to be fired when I call the setValue(Object object) method programmatically? I use Vaadin7.

I have the following situation: Dynamic form where every change to a TextField, PopupDateField, etc. executed by the User is immediatly pushed to the controller which analysis the input. If I load the form with existing data, I use the setValue() method of the component to set the data. But in this case I do not want that the value change listener is fired because this irritates the business logic.

Currentley the only method I found which worked, was to remove the value change listener from the component, than to set the value and then to re add the value change listener. Is thos really the only possibility.

A code example:

private InlineDateField dateSelection;
private ValueChangeListener dateChange;
public Example() extends FormLayout {
        dateChange = listener -> uicontroller.setStartDate(dateSelection.getValue());
        
        dateSelection = new InlineDateField();
        dateSelection.setResolution(Resolution.DAY);
        dateSelection.setImmediate(true);
        dateSelection.setInvalidAllowed(false);
        this.addComponent(dateSelection);
        dateSelection.addValueChangeListener(dateChange);
}

public void reload() { // This method can be called by the business logic
        dateSelection.removeValueChangeListener(dateChange);
        dateSelection.setValue(uicontroller.getStartDate());
        dateSelection.addValueChangeListener(dateChange);
}
}

This is working but this is some kind of Mexico method in my opinion.
Hope someone can give me a hint,
Florian

PS: Your new forum is a little bit buggy, it does not work with Firefox in my case, the interface does not react on inputs and throw an error that no title and body exists, even there is one. I wrote this post using Safari.