/** * Adds an initialized UI to this session. * * @param ui * the initialized UI to add. */ public void addUI(UI ui) { assert hasLock(); if (ui.getUIId() == -1) { throw new IllegalArgumentException( "Can not add an UI that has not been initialized."); } if (ui.getSession() != this) { throw new IllegalArgumentException( "The UI belongs to a different session"); } Integer uiId = Integer.valueOf(ui.getUIId()); uIs.put(uiId, ui); String embedId = ui.getEmbedId(); if (embedId != null) { Integer previousUiId = embedIdMap.put(embedId, uiId); if (previousUiId != null) { UI previousUi = uIs.get(previousUiId); assert previousUi != null && embedId.equals(previousUi .getEmbedId()) : "UI id map and embed id map not in sync"; // Will fire cleanup events at the end of the request handling. previousUi.close(); } } }
/** * Closes those UIs in the given session for which {@link #isUIActive} * yields false. * * @since 7.0.0 */ private void closeInactiveUIs(VaadinSession session) { final String sessionId = session.getSession().getId(); for (final UI ui : session.getUIs()) { if (!isUIActive(ui) && !ui.isClosing()) { ui.accessSynchronously(() -> { getLogger().log(Level.FINE, "Closing inactive UI #{0} in session {1}", new Object[] { ui.getUIId(), sessionId }); ui.close(); }); } } }
@Override public void close() { super.close(); }
@Override public void execute() { getLogger().log(Level.FINE, "Closing inactive UI #{0} in session {1}", new Object[] { ui.getUIId(), sessionId }); ui.close(); } });
@Override public void close() { if (pluginManager != null) { pluginManager.shutdown(); } super.close(); }
UI popUp, mainUI; popUp = UI.getCurrent(); JavaScript.eval("close()"); popUp.close(); VaadinSession session = getSession(); mainUI = session.getUIById(mainUIId); UI.setCurrent(mainUI);
public void logout(UI ui) { close(); VaadinService.getCurrentRequest().getWrappedSession().invalidate(); ui.close(); String contextPath = VaadinService.getCurrentRequest().getContextPath(); ui.getPage().setLocation(contextPath); }
UI.getCurrent().close();
UI.getCurrent().close();
@Override public void menuSelected(MenuItem selectedItem) { try { getApi().getAccessControl().signOut(); } catch (Throwable t) { log.d(t); } try { UI.getCurrent().close(); } catch (Throwable t) { log.d(t); } UI.getCurrent().getPage().reload(); } });