/** * 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(); }
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); } } }
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); } } }
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); } } }
private static URL getURL(int nodeId) { final URI currentLocation = Page.getCurrent().getLocation(); final String contextRoot = VaadinServlet.getCurrent().getServletContext().getContextPath(); final String redirectFragment = contextRoot + "/element/node.jsp?node=" + nodeId; try { return new URL(currentLocation.toURL(), redirectFragment); } catch (MalformedURLException e) { throw Throwables.propagate(e); } }
public static boolean headless() { Page current = Page.getCurrent(); if (current == null) { return true; } return current.getUI().getSession() == null; } }
public static void replaceState(String navigationState) { checkNotEmptyString(navigationState, "Unable to replace by empty navigation state"); if (headless()) { log.debug("Unable to replace navigation state in headless mode"); return; } Page.getCurrent().replaceState("#" + navigationState); }
@PostConstruct void init() { buildLayout(); restoreState(); checkNoDataAvaialble(); Page.getCurrent().addBrowserWindowResizeListener(this); showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth()); }
@Override public void actionPerform(Component component) { super.actionPerform(component); JavaScript js = Page.getCurrent().getJavaScript(); js.execute("window.close();"); }
public static void showNotification(String title, String message, Type type, int delayMsec) { Notification notification = new Notification(title, message, type, true); notification.setDelayMsec(delayMsec); notification.show(Page.getCurrent()); }
@PostConstruct void init() { buildLayout(); restoreState(); checkNoDataAvaialble(); eventBus.subscribe(this); Page.getCurrent().addBrowserWindowResizeListener(this); showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth()); }
public static void showNotification(String title, String message, Type type, int delayMsec) { Notification notification = new Notification(title, message, type, true); notification.setDelayMsec(delayMsec); notification.show(Page.getCurrent()); }
@Override public void logout() { VaadinSession.getCurrent().close(); Page.getCurrent().reload(); }
@Override public void logout(String logoutUrl) { VaadinSession.getCurrent().close(); Page.getCurrent().setLocation(logoutUrl); }
@Override public void logout(String logoutUrl) { VaadinSession.getCurrent().close(); Page.getCurrent().setLocation(logoutUrl); }
@Override public void doRevert() { super.doRevert(); JavaScript js = Page.getCurrent().getJavaScript(); js.execute("window.close();"); }
@PostConstruct void init() { buildLayout(); restoreState(); checkNoDataAvaialble(); Page.getCurrent().addBrowserWindowResizeListener(this); showOrHideFilterButtons(Page.getCurrent().getBrowserWindowWidth()); getEventBus().publish(this, ManagementUIEvent.SHOW_COUNT_MESSAGE); }
protected boolean useWrapper() { Page current = Page.getCurrent(); if (current != null) { WebBrowser browser = current.getWebBrowser(); return browser != null && (browser.isIE() && browser.getBrowserMajorVersion() <= 10 || browser.isSafari()); } else { return false; } }
private void styleTableOnDistSelection() { Page.getCurrent().getJavaScript().execute(HawkbitCommonUtil.getScriptSMHighlightReset()); setCellStyleGenerator(new Table.CellStyleGenerator() { private static final long serialVersionUID = 1L; @Override public String getStyle(final Table source, final Object itemId, final Object propertyId) { return createTableStyle(itemId, propertyId); } }); }
public void windowClose(CloseEvent e) { if((IkasanAuthentication)VaadinService.getCurrentRequest().getWrappedSession() .getAttribute(DashboardSessionValueConstants.USER) == null) { Notification.show("You cannot access this page!", Type.ERROR_MESSAGE); //Redirect the user to the login/default Page Page.getCurrent().setLocation("/ikasan-dashboard"); } } });