open(url, windowName, true);
/** * Opens the given resource in a window with the given size, border and * name. For more information on the meaning of {@code windowName}, see * {@link #open(Resource, String)}. * <p> * As of Vaadin 7.0.0, the functionality for opening a Resource in a Page * has been replaced with similar methods based on a String URL. This is * because the usage of Resource is problematic with memory management and * with security features in some browsers. Is is recommended to instead use * {@link Link} for starting downloads. * </p> * * @param resource * the resource. * @param windowName * the name of the window. * @param width * the width of the window in pixels * @param height * the height of the window in pixels * @param border * the border style of the window. * @deprecated As of 7.0, use getPage().open instead */ @Deprecated public void open(Resource resource, String windowName, int width, int height, BorderStyle border) { getPage().open(resource, windowName, width, height, border); }
getPage().open(resource, windowName, tryToOpenAsPopup);
@Override public void buttonClick(ClickEvent event) { getUI().getPage().open(helpUrl, "_blank", false); } });
protected void reloadApp() { String url = ControllerUtils.getLocationWithoutParams() + "?restartApp"; ui.getPage().open(url, "_self"); }
private void makeStream(final Attachment attachment) { final FileResource stream = new FileResource(new File("")) { private static final long serialVersionUID = 1L; @Override public DownloadStream getStream() { ByteArrayInputStream in = new ByteArrayInputStream( attachment.getBody()); DownloadStream ds = new DownloadStream(in, attachment.getMIMEType(), attachment.getFileName()); // Need a file download POPUP ds.setParameter("Content-Disposition", "attachment; filename="+attachment.getFileName()); return ds; } }; stream.setCacheTime(0); Page.getCurrent().open(stream, "_blank", true); // panel.requestRepaint(); }
@Override public void showWebPage(String url, @Nullable Map<String, Object> params) { String target = null; Integer width = null; Integer height = null; String border = "DEFAULT"; Boolean tryToOpenAsPopup = null; if (params != null) { target = (String) params.get("target"); width = (Integer) params.get("width"); height = (Integer) params.get("height"); border = (String) params.get("border"); tryToOpenAsPopup = (Boolean) params.get("tryToOpenAsPopup"); } if (target == null) { target = "_blank"; } if (width != null && height != null && border != null) { ui.getPage().open(url, target, width, height, BorderStyle.valueOf(border)); } else if (tryToOpenAsPopup != null) { ui.getPage().open(url, target, tryToOpenAsPopup); } else { ui.getPage().open(url, target, false); } } }
protected void relogin() { String url = ControllerUtils.getLocationWithoutParams() + "?restartApp"; Page.getCurrent().open(url, "_self"); }
@Test public void testBinaryDownload() throws Exception { // GIVEN action = new DownloadBinaryAction<DownloadBinaryActionDefinition>(definition, item); // WHEN action.execute(); // THEN verify(page).open(any(StreamResource.class), (String) isNull(), eq(false)); }
protected void forceLogout() { AppUI ui = (AppUI) getUI(); App app = ui.getApp(); try { Connection connection = app.getConnection(); if (connection.isConnected()) { connection.logout(); } } catch (Exception e) { log.warn("Exception on forced logout", e); } finally { // always restart UI String url = ControllerUtils.getLocationWithoutParams() + "?restartApp"; ui.getPage().open(url, "_self"); } }
/** * Invoked when authentication is missing or failed using {@link AuthContext} during {@link Authenticate} annotation * processing. * @param authc Authenticate annotation * @param navigationState Navigation state * @throws ViewNavigationException If cannot be performed any redirection using {@link Authenticate#redirectURI()} */ protected void onAuthenticationFailed(final Authenticate authc, final String navigationState) throws ViewNavigationException { // redirect String redirectURI = AnnotationUtils.getStringValue(authc.redirectURI()); if (redirectURI != null) { // check view scheme String viewNavigationState = getViewNavigationState(redirectURI); if (viewNavigationState != null) { try { suspendAuthenticationCheck = true; navigator.navigateTo(viewNavigationState); } finally { suspendAuthenticationCheck = false; } } else { // try to open the URI as an URL Page.getCurrent().open(redirectURI, null); } } else { throw new ViewNavigationException(navigationState, "Authentication required"); } }
/** * Submits the dialog action.<p> */ void submit() { String siteRoot = (String)m_siteComboBox.getValue(); if (!m_context.getCms().getRequestContext().getSiteRoot().equals(siteRoot)) { A_CmsUI.get().changeSite(siteRoot); if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot) || OpenCms.getSiteManager().isSharedFolder(siteRoot)) { // switch to explorer view when selecting shared or root site Page.getCurrent().open(CmsCoreService.getFileExplorerLink(A_CmsUI.getCmsObject(), siteRoot), "_top"); return; } } else { siteRoot = null; } m_context.finish(null, siteRoot); }
ui.getPage().open(url, "_self");
getPage().open(url, "_self"); });