Refine search
@Override public WebBrowser get() { Page page = Page.getCurrent(); return (page == null) ? null : page.getWebBrowser(); }
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(); int newWidth = page.getBrowserWindowWidth(); int newHeight = page.getBrowserWindowHeight(); page.updateLocation(oldLocation.toString(), false, false); page.updateBrowserWindowSize(oldWidth, oldHeight, false); page.updateLocation(newLocation.toString(), true, false); page.updateBrowserWindowSize(newWidth, newHeight, true);
@Override public void setCaption(String caption) { // Override to provide backwards compatibility getState().caption = caption; getPage().setTitle(caption); }
/** * Get the JavaScript object for the current Page, or null if there is no * current page. * * @see Page#getCurrent() * * @return the JavaScript object corresponding to the current Page, or * <code>null</code> if there is no current page. */ public static JavaScript getCurrent() { Page page = Page.getCurrent(); if (page == null) { return null; } return page.getJavaScript(); }
@Override public void setState(String state) { StringBuilder sb = new StringBuilder(ui.getUiRootPath()); if (!ui.getUiRootPath().endsWith("/")) { // make sure there is a '/' between the root path and the // navigation state. sb.append('/'); } sb.append(state); URI location = ui.getPage().getLocation(); if (location != null) { ui.getPage().pushState(location.resolve(sb.toString())); } else { throw new IllegalStateException( "The Page of the UI does not have a location."); } } }
@Override public void attach() { super.attach(); int posX = (int)(getUI().getPage().getBrowserWindowWidth() - getWidth())/2; int posY = (int)(getUI().getPage().getBrowserWindowHeight() - getHeight())/2; setPositionX(posX); setPositionY(posY); }
@Override public void sendRedirect(String url) { final String redirectUrl = calculateRedirectUrl(servletContext.getContextPath(), url); LOGGER.debug("Redirecting to [" + redirectUrl + "]"); UI.getCurrent().getPage().setLocation(redirectUrl); }
protected String getFullUrl(final String urlFragment) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); try { return new URL(currentLocation.toURL(), contextRoot + "/" + urlFragment).toString(); } catch (final MalformedURLException e) { throw new RuntimeException("Failed to create full URL from current location: " + currentLocation + ", context root: " + contextRoot + ", url: " + urlFragment); } } }
@PostConstruct void init() { buildLayout(); restoreState(); checkNoDataAvaialble(); Page.getCurrent().addBrowserWindowResizeListener(this); showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth()); }
/** * Injects CSS styles on current page for this dashlet */ private void injectWallboardStyles() { ui.getPage().getStyles().add(".alert-details.cleared { background: #AAAAAA; border-left: 14px solid #858585; }"); ui.getPage().getStyles().add(".alert-details.normal { background: #AAAAAA; border-left: 14px solid #336600; }"); ui.getPage().getStyles().add(".alert-details.indeterminate { background: #AAAAAA; border-left: 14px solid #999; }"); ui.getPage().getStyles().add(".alert-details.warning { background: #AAAAAA; border-left: 14px solid #FFCC00; }"); ui.getPage().getStyles().add(".alert-details.minor { background: #AAAAAA; border-left: 14px solid #FF9900; }"); ui.getPage().getStyles().add(".alert-details.major { background: #AAAAAA; border-left: 14px solid #FF3300; }"); ui.getPage().getStyles().add(".alert-details.critical { background: #AAAAAA; border-left: 14px solid #CC0000; }"); ui.getPage().getStyles().add(".alert-details-font {color: #000000; font-size: 17px; line-height: normal; }"); ui.getPage().getStyles().add(".alert-details-noalarms-font { font-size: 17px; line-height: normal; }"); ui.getPage().getStyles().add(".alert-details { padding: 5px 5px; margin: 1px; }"); }
/** * Injects CSS styles in the current page */ private void injectWallboardStyles() { Page.getCurrent().getStyles().add(".summary.cleared { background: #000000; border-left: 15px solid #858585; }"); Page.getCurrent().getStyles().add(".summary.normal { background: #000000; border-left: 15px solid #336600; }"); Page.getCurrent().getStyles().add(".summary.indeterminate { background: #000000; border-left: 15px solid #999; }"); Page.getCurrent().getStyles().add(".summary.warning { background: #000000; border-left: 15px solid #FFCC00; }"); Page.getCurrent().getStyles().add(".summary.minor { background: #000000; border-left: 15px solid #FF9900; }"); Page.getCurrent().getStyles().add(".summary.major { background: #000000; border-left: 15px solid #FF3300; }"); Page.getCurrent().getStyles().add(".summary.critical { background: #000000; border-left: 15px solid #CC0000; }"); Page.getCurrent().getStyles().add(".summary.global { background: #000000; border-left: 15px solid #000000; }"); Page.getCurrent().getStyles().add(".summary { padding: 5px 5px; margin: 1px; }"); Page.getCurrent().getStyles().add(".summary-font { font-size: 24px; line-height: normal; text-align: right; color: #3ba300; }"); Page.getCurrent().getStyles().add(".summary-font-legend { font-size: 16px; line-height: normal; text-align: right; color: #3ba300; }"); }
public HelpContext getHelpContext(String name) { GuiSpaceService space = spaceList.get(name); if (space == null) return null; HelpContext instance = helpInstanceList.get(name); if (instance == null) { Locale locale = UI.getCurrent().getPage().getWebBrowser().getLocale(); instance = space.createHelpContext(locale); if (instance == null) return null; if (instance instanceof GuiLifecycle) ((GuiLifecycle)instance).doInitialize(); helpInstanceList.put(name, instance); } return instance; }
+ uiId + "). "; if (getSession() != null && !getSession().equals(VaadinSession.getCurrent())) { message += "Furthermore, it is already attached to another VaadinSession. "; setTheme(request.getParameter("theme")); getPage().init(request); if (getSession() != null && getSession().getConfiguration() != null && getSession().getConfiguration().isSendUrlsAsParameters() && getPage().getLocation() != null) { String uiRootPath = getPage().getLocation().getPath();
@Override public void logout(String logoutUrl) { VaadinSession.getCurrent().close(); Page.getCurrent().setLocation(logoutUrl); }
@Override public int getViewPortWidth() { return (Page.getCurrent() != null) ? Page.getCurrent().getBrowserWindowWidth() : -1; }
@Override public int getViewPortHeight() { return (Page.getCurrent() != null) ? Page.getCurrent().getBrowserWindowHeight() : -1; }
/** * 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(); }
sharedParameterActionNameMap.put(actionKey, name); sharedParameterActionValueMap.put(actionKey, value); uI.getPage().setLocation(actionUrl.toString()); } else {
@Override public String getState() { // Get the current URL URI location = ui.getPage().getLocation(); String path = location.getPath(); if (ui.getUiPathInfo() != null && path.contains(ui.getUiPathInfo())) { // Split the path from after the UI PathInfo path = path.substring(path.indexOf(ui.getUiPathInfo()) + ui.getUiPathInfo().length()); } else if (path.startsWith(ui.getUiRootPath())) { // Use the whole path after UI RootPath String uiRootPath = ui.getUiRootPath(); path = path.substring(uiRootPath.length()); } else { throw new IllegalStateException(getClass().getSimpleName() + " is unable to determine the view path from the URL."); } if (path.startsWith("/")) { // Strip leading '/' path = path.substring(1); } return path; }