[TextField]: disabling event on setValue ?

Dear Vaadin users,

here is a short question regarding vaadin events in general.
Is there a way to temporarily disable the triggering of an event in vaadin.

Let’s say for instance that a TextField has a ValueChangeEvent hooked on it.
For some obscure reason at some stage in my application I want to change the
value of this TextField

WITHOUT

triggering the ValueChangeEvent.
(of course if the user change the value through the interface then the ValueChangeEvent
should be triggered).

What would be the magic trick to this ?

thanks in advance for your feedback.

regards,

E.

There is currently no direct support for skipping sending the events. Often, specific listeners should not react to the events instead of the events not being sent.

If you do need to block sending the events, in the 6.5 branch, I think you could override AbstractComponent.fireEvent() in a subclass of TextField and check a flag that your setValueWithoutSendingEvent() sets and clears (with a “finally” block!), blocking any TextChangeEvents during that operation. Similar techniques should work in 6.4, overriding some other methods.

Take a look at the source code of TextField and AbstractComponent, especially setInternalValue() and the fire*() methods.