/** * Removes those UIs from the given session for which {@link UI#isClosing() * isClosing} yields true. * * @param session */ private void removeClosedUIs(final VaadinSession session) { List<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { if (ui.isClosing()) { ui.accessSynchronously(() -> { getLogger().log(Level.FINER, "Removing closed UI {0}", ui.getUIId()); session.removeUI(ui); }); } } }
/** * 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(); }); } } }
ui = findUiUsingResource(resource, session.getUIs());
getService().runPendingAccessTasks(this); for (UI ui : getUIs()) { if (ui.getPushConfiguration() .getPushMode() == PushMode.AUTOMATIC) {
closeSession(session); List<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { ui.accessSynchronously(() -> {
public List<AppUI> getAppUIs() { List<AppUI> list = new ArrayList<>(); for (UI ui : VaadinSession.getCurrent().getUIs()) { if (ui instanceof AppUI) list.add((AppUI) ui); else log.warn("Invalid UI in the session: {}", ui); } return list; }
private void recursiveSetLocale() { Stack<Component> stack = new Stack<>(); stack.addAll(VaadinSession.getCurrent().getUIs()); while (!stack.isEmpty()) { Component component = stack.pop(); if (component instanceof HasComponents) { for (Iterator<Component> i = ((HasComponents) component) .iterator(); i.hasNext();) { stack.add(i.next()); } } if (component instanceof AbstractComponent) { AbstractComponent abstractComponent = (AbstractComponent) component; abstractComponent.setLocale(UI.getCurrent().getLocale()); } } }
/** * Removes those UIs from the given session for which {@link UI#isClosing() * isClosing} yields true. * * @param session */ private void removeClosedUIs(final VaadinSession session) { ArrayList<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { if (ui.isClosing()) { ui.accessSynchronously(new Command() { @Override public void execute() { getLogger().log(Level.FINER, "Removing closed UI {0}", ui.getUIId()); session.removeUI(ui); } }); } } }
AppContext.setSecurityContext(securityContext); vaadinSession.getUIs().stream() .filter(UI::isConnectorEnabled) .forEach(ui -> {
/** * 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(new Command() { @Override public void execute() { getLogger().log(Level.FINE, "Closing inactive UI #{0} in session {1}", new Object[] { ui.getUIId(), sessionId }); ui.close(); } }); } } }
protected void redirectAfterLogout(String loggedOutUrl) { if (!Strings.isNullOrEmpty(loggedOutUrl)) { AppUI currentUi = AppUI.getCurrent(); // it can be null if we handle request in a custom RequestHandler if (currentUi != null) { currentUi.setContent(null); currentUi.getPage().setLocation(loggedOutUrl); } else { VaadinResponse response = VaadinService.getCurrentResponse(); try { ((VaadinServletResponse) response).getHttpServletResponse(). sendRedirect(loggedOutUrl); } catch (IOException e) { log.error("Error on send redirect to client", e); } } VaadinSession vaadinSession = VaadinSession.getCurrent(); for (UI ui : vaadinSession.getUIs()) { if (ui != currentUi) { ui.access(() -> { ui.setContent(null); ui.getPage().setLocation(loggedOutUrl); }); } } } }
closeSession(session); ArrayList<UI> uis = new ArrayList<>(session.getUIs()); for (final UI ui : uis) { ui.accessSynchronously(new Command() {
ui = findUiUsingResource(resource, session.getUIs());
getService().runPendingAccessTasks(this); for (UI ui : getUIs()) { if (ui.getPushConfiguration() .getPushMode() == PushMode.AUTOMATIC) {