I just started using Vaadin, and I use Vaadin 7.0.0.alpha1.
I’m trying to preserve the Root state for browser refresh & browser tabs.
I refered
Migration Guide and tried Application.setRootPreserved(true), but it is not working!
Also, the
WindowRefactoring mentions that ’
Developer can enable Root state preservation by overriding Application.getRoot and keeping track of window.name ', I tried doing this but got NPE on browser refresh -
java.lang.NullPointerException
at com.vaadin.Application.getRootId(Application.java:2322)
I also noticed that on every refresh the http session id keeps changing.
Is there any solution for this issue? appreciate if there is any sample/demo web application with this implementation.
Got this working!! Found what I was doing wrong earlier… (not sure whether this is the correct way, but here is how it worked)
Create a window in the Application’s init method (this will be our main window) and add our root as its content
Window window = new Window();
home = new SimpleRoot();
//home.getApplication().setRootPreserved(true); [this won't work, so have to do this as in root's init]
//setRootPreserved(true);[this won't work either]
window.setContent(home);
In the root’s init method set
getApplication().setRootPreserved(true);
Hope this helps people like me who doesn’t read full document!