How to access the vaadin application session outside the scope of the compo

I developed a system of tabs like a browser in my application vaadin. However, I can not provide my TabManager outside the scope of the components. I can not use a singleton because it would be available for all users, which is not ideal. It would be interesting to provide this in a kind of user session but I did not find anything like that.

I am developing my application in scala but I believe this is not relevant.

Has anyone had this problem? How were you able to solve?

Hi!

In what way are you trying to access the Manager? You mention ‘outside the scope of the components’, could you clarify this a bit (i.e. from another class, from another thread, statically…)?

If I understand you correctly, you don’t want to set the TabManager as a singleton since it will be accessible by all users? Then you can still set a per-application instance for the TabManager.

I have a similar case where I have to have exactly one instance of StateManager for each vaadin application. This instance monitors the state of windows and components in my application. This manager should be easily accessible from any windows and components I launch. The way I manage this is by linking the StateManager to the application and let it have a reference to the windows and components it should monitor. The manager acts as an observer to events that occur in its supervised windows/components. It reacts accordingly to the event and handle the necessary UI and non-UI changes for the state transition in the application.