update a property when any event occurs

Hi everyone,

in Vaadin, is it possibile to update a specific property every time any event (fired by any object) occurs (a button click, a label click, a drag & drop, etc.) and before running the event listener method?
Which is the proper place to “intercept” an event, both session-wide and application-wide?

Thanks for your kind answer,



Interesting question. As far as I know, there isn’t a way to intercept all events globally, but it depends a bit on at what level you want to catch the events.

You can catch server requests in a HttpServletRequestListener, and do some things there, but you can’t in any way know what events will be fired during the handling of the request.

Notice that events can also be fired from user code. For example, if you call setValue() for a field component in your code, it will fire a ValueChangeEvent. Events are usually handled at the level of AbstractComponent, which delegates their handling to an internal EventRouter. However, all that is done locally inside the object handling the events and there isn’t any global extension point (such as an EventRouter factory) that would allow making custom event routers. The only possibility would be to extend every component to intercept the events. In Vaadin 7 it might be possible without extending, by using a decorator.

Events caused by user interaction are usually fired in the changeVariables() method for each component type. For example, ClickEvents are fired in the changeVariables() of the Button component. While the changeVariables() is called by the terminal adapter, the adapter doesn’t know anything about the semantics of the variables, so it doesn’t know what message fires an event and what doesn’t.

Hi Marko, thanks for answering,

I think the quoted one is the level I’m generally interested in: for instance, refreshing a local logFilePath property by reading its value in a .properties file might actually be done by using a HttpServletRequestListener.

Thanks again,