Tree update after the HierarchicalContainer property value change?


I have such a situation:

HierarchicalContainer is created at the ServletContextListener (contextInitialized, data taken from database) because i want to have the same data container for all users (sessions).

When one user will change something at his tree (change tree item name) then I would like to update all trees from all active sessions. Thanks to it, all users will be able to see the changes made by some user immediately.

It almost works. When I will change the tree item name at one web browser window, and manually refresh the second window, I can see the changes.

Is there any way to do it automatically? Without a need to manually refresh the page? Do You have some ideas or examples?

Best regards

You are facing a common problem, you make a server-side change without making a call from the client-side (browser). What you need is a way to send a message from the server to the browser. This can be done with ajax push, however, Vaadin doesn’t support ajax push at the moment. A workaround is to use the Refresher component (search the forums for more info). What the refresher component does, is that it tells the browser to contact the server with an frequency x. Once the Refresher makes its call to the server, you can check for updates and push them back to the client (browser).