Refine search
private Locale findLocale() { Locale l = null; if (component != null) { l = component.getLocale(); } if (l == null && UI.getCurrent() != null) { l = UI.getCurrent().getLocale(); } if (l == null) { l = Locale.getDefault(); } return l; }
+ uiId + "). "; if (getSession() != null && !getSession().equals(VaadinSession.getCurrent())) { message += "Furthermore, it is already attached to another VaadinSession. "; setTheme(request.getParameter("theme")); getPage().init(request); setUiPathInfo(uiPathInfo); if (getSession() != null && getSession().getConfiguration() != null && getSession().getConfiguration().isSendUrlsAsParameters() && getPage().getLocation() != null) { String uiRootPath = getPage().getLocation().getPath(); setUiRootPath(uiRootPath); init(request); Navigator navigator = getNavigator(); if (navigator != null) {
/** * Method that handles window closing (from UI). * * <p> * By default, windows are removed from their respective UIs and thus * visually closed on browser-side. * </p> * * <p> * To react to a window being closed (after it is closed), register a * {@link CloseListener}. * </p> */ public void close() { UI uI = getUI(); // Don't do anything if not attached to a UI if (uI != null) { // window is removed from the UI uI.removeWindow(this); } }
/** * Gets the Page to which the current uI belongs. This is automatically * defined when processing requests to the server. In other cases, (e.g. * from background threads), the current uI is not automatically defined. * * @see UI#getCurrent() * * @return the current page instance if available, otherwise * <code>null</code> */ public static Page getCurrent() { UI currentUI = UI.getCurrent(); if (currentUI == null) { return null; } return currentUI.getPage(); }
/** * Called by the framework to remove an UI instance from the session because * it has been closed. * * @param ui * the UI to remove */ public void removeUI(UI ui) { assert hasLock() : "Session is locked"; assert UI.getCurrent() != null : "Current UI cannot be null"; assert ui != null : "Removed UI cannot be null"; assert UI.getCurrent().getUIId() == ui.getUIId() : "UIs don't match"; Integer id = Integer.valueOf(ui.getUIId()); ui.setSession(null); uIs.remove(id); String embedId = ui.getEmbedId(); if (embedId != null && id.equals(embedIdMap.get(embedId))) { embedIdMap.remove(embedId); } }
public void open() { if (UI.getCurrent() != null) { UI.getCurrent().addWindow(this); } } }
/** * Constructor for BaseUIEvent */ public BaseUIEvent() { this.source = UI.getCurrent().getNavigator().getCurrentView().getClass(); }
public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(ServerWindow.this); } });
@EventBusListenerMethod(scope = EventScope.UI) void onEvent(final CustomFilterUIEvent custFUIEvent) { if (custFUIEvent == CustomFilterUIEvent.TARGET_DETAILS_VIEW || custFUIEvent == CustomFilterUIEvent.CREATE_NEW_FILTER_CLICK) { UI.getCurrent().access(this::populateTableData); } else if (custFUIEvent == CustomFilterUIEvent.FILTER_TARGET_BY_QUERY) { UI.getCurrent().access(this::onQuery); } }
@Override public void onClick(PointClickEvent event) { Module module = moduleMap.get(event.getCategory()); VaadinSession.getCurrent().setAttribute("module", module); VaadinSession.getCurrent().setAttribute("tab", TopologyViewPanel.CATEGORISED_ERROR_TAB); UI.getCurrent().getNavigator().navigateTo("topologyView"); } });
private static void addTypeStyle(final Long tagId, final String color) { final JavaScript javaScript = UI.getCurrent().getPage().getJavaScript(); UI.getCurrent() .access(() -> javaScript.execute( HawkbitCommonUtil.getScriptSMHighlightWithColor(".v-table-row-distribution-upload-type-" + tagId + "{background-color:" + color + " !important;background-image:none !important }"))); }
protected Class<?> getAssociatedClass() { if (associatedClass == null) { UI current = UI.getCurrent(); if (current instanceof LegacyWindow) { LegacyWindow legacyWindow = (LegacyWindow) current; return legacyWindow.getApplication().getClass(); } else { return current.getClass(); } } return associatedClass; }
Page page = getPage(); URI oldLocation = page.getLocation(); int oldWidth = page.getBrowserWindowWidth(); int oldHeight = page.getBrowserWindowHeight(); page.init(request); setLastHeartbeatTimestamp(System.currentTimeMillis()); refresh(request); URI newLocation = page.getLocation(); Navigator navigator = getNavigator(); if (navigator != null) { navigator.navigateTo(navigator.getState());
try { session = service.findVaadinSession(vaadinRequest); assert VaadinSession.getCurrent() == session; session.lock(); try { ui = service.findUI(vaadinRequest); assert UI.getCurrent() == ui; if (ui != null && ui.getPushConnection() != null) { .getPushConnection()).getResource(); } finally { try { session.unlock(); } catch (Exception e) { getLogger().log(Level.WARNING,
VaadinRequest request) { if (component == null) { component = UI.getCurrent(); session = VaadinSession.getCurrent(); Locale locale = session.getLocale(); if (locale != null) { return locale;
private void updateVaadinLocale() { Locale locale = getLocale(); UI.getCurrent().setLocale(locale); VaadinSession.getCurrent().setLocale(locale); recursiveSetLocale(); }
/** * Load and initialize the mobile drag-drop-polyfill if needed and not yet * done so. */ private void loadMobileHtml5DndPolyfill() { if (mobileHtml5DndPolyfillLoaded) { return; } if (!getPage().getWebBrowser().isTouchDevice()) { return; } mobileHtml5DndPolyfillLoaded = true; String vaadinLocation = getSession().getService().getStaticFileLocation( VaadinService.getCurrentRequest()) + "/VAADIN/"; getPage().addDependency(new Dependency(Type.JAVASCRIPT, vaadinLocation + ApplicationConstants.MOBILE_DND_POLYFILL_JS)); getRpcProxy(PageClientRpc.class).initializeMobileHtml5DndPolyfill(); }
/** * Shows a notification message. * * @see Notification * @see #showNotification(String) * @see #showNotification(String, int) * @see #showNotification(String, String) * @see #showNotification(String, String, int) * * @param notification * The notification message to show * * @deprecated As of 7.0, use Notification.show instead */ @Deprecated public void showNotification(Notification notification) { getPage().showNotification(notification); }
VaadinSession session = ui.getSession(); VaadinService service = session.getService(); LegacyCommunicationManager manager = session.getCommunicationManager(); ClientCache clientCache = manager.getClientCache(ui); boolean repaintAll = clientCache.isEmpty(); ConnectorTracker uiConnectorTracker = ui.getConnectorTracker(); getLogger().log(Level.FINE, "* Creating response to client"); .getLastProcessedClientToServerId() + 1; writer.write("\"" + ApplicationConstants.CLIENT_TO_SERVER_ID + "\": " + nextClientToServerMessageId + ", "); SystemMessages messages = ui.getSession().getService() .getSystemMessages(ui.getLocale(), null); dependencies.addAll(ui.getPage().getPendingDependencies()); dependencies.addAll(Dependency.findDependencies(newConnectorTypes, manager, new FilterContext(session)));
@Override public void buttonClick(Button.ClickEvent clickEvent) { GraphSelectionWindow graphSelectionWindow = new GraphSelectionWindow(nodeDao, rrdGraphHelper, RrdGraphEntry.this); getUI().addWindow(graphSelectionWindow); } });