/** * Removes all windows from all UIs. */ public void removeAllWindows() { log.debug("Closing all windows in all UIs"); try { for (AppUI ui : getAppUIs()) { Screens screens = ui.getScreens(); if (screens != null) { Screen rootScreen = screens.getOpenedScreens().getRootScreenOrNull(); if (rootScreen != null) { screens.removeAll(); screens.remove(rootScreen); } } // also remove all native Vaadin windows, that is not under CUBA control Window[] windows = ui.getWindows().toArray(new Window[0]); for (com.vaadin.ui.Window win : windows) { ui.removeWindow(win); } // todo also remove all notifications } } catch (Throwable e) { log.error("Error closing all windows", e); } }