I'm developing an application using Vaadin framework. The application has a main menu, when user clicks a menu item, application executes descendant of AbstractMenuCommand class like
public class RunReportCommand extends AbstractMenuAction {
@Override
public void execute() throws MenuException {
Window = .... // create window here
openWindow(window);
}
protected void openWindow(Window window) {
application.getMainWindow().open(new ExternalResource(window.getURL()));
application.setMainWindow(window);
}
}
After this main browser window content is replace with needed window. After spending a lot of time I came to this solution: if you want replace browser window content with Vaadin Window you should always do
application.getMainWindow().open(new ExternalResource(window.getURL()));
application.setMainWindow(window);
Recently I got a new task to add a feature to application: users should have ability open windows in diffirent tabs and so the problem is that I have only one main window in vaadin (and window.open works only for the main window) but user can have a lot of diffirent windows in diffirent browser tabs, so if user clicks a menu item in browser tab that contains not main window, reloading vaading window content won't work.