How to dispatch events in vaadin?

I want to communicate between a “login custom component” and a “shell container” component and when the login is successful the login component should send/dispatch an “LOGIN_SUCCESSFUL” event. Any exterior component should be able to listen and take different actions depending on it.

I can’t find any sample code or tutorials for this issue and I would appreciate any feedback.

This is more of a general Java question instead of a Vaadin question. You can implement an event bus (pattern) or use a CDI framework that provides the obeserver pattern.

Yes, I know.

But it would be nice to see a sample or a concrete implementation for this. I think is a very common issue and some “best practices” would be very helpful to Vaadin new newcomers.


Blackboard
is an add-on that implements one type of EventBus. It is in the Vaadin Directory, even if it doesn’t depend on anything Vaadin related and could be used in other java apps as well.