List of usage examples for com.google.gwt.user.client Window open
public static void open(String url, String name, String features)
From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel.java
License:Open Source License
public void executeActionSequence(final FileCommand.COMMAND mode) { if (filesListPanel.getSelectedFileItems() == null || filesListPanel.getSelectedFileItems().size() != 1) { return;//from w w w.j av a 2s . c om } // open in content panel AbstractCommand authCmd = new AbstractCommand() { protected void performOperation() { performOperation(false); } protected void performOperation(boolean feedback) { final FileItem selectedFileItem = filesListPanel.getSelectedFileItems().get(0); String url = null; url = "api/repo/files/" //$NON-NLS-1$ + SolutionBrowserPanel.pathToId( filesListPanel.getSelectedFileItems().get(0).getRepositoryFile().getPath()) + "/generatedContent"; //$NON-NLS-1$ url = getPath() + url; if (mode == FileCommand.COMMAND.BACKGROUND) { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$ Messages.getString("backgroundExecutionWarning"), //$NON-NLS-1$ true, false, true); dialogBox.center(); url += "&background=true"; //$NON-NLS-1$ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT"); builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$ Messages.getString("couldNotBackgroundExecute"), false, false, true); //$NON-NLS-1$ dialogBox.center(); } public void onResponseReceived(Request request, Response response) { } }); } catch (RequestException e) { // ignored } } else if (mode == FileCommand.COMMAND.NEWWINDOW) { // popup blockers might attack this Window.open(url, "_blank", "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ //$NON-NLS-2$ } else if (mode == FileCommand.COMMAND.SUBSCRIBE) { final String myurl = url + "&subscribepage=yes"; //$NON-NLS-1$ contentTabPanel.showNewURLTab(selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), myurl, true); } else { contentTabPanel.showNewURLTab(selectedFileItem.getLocalizedName(), selectedFileItem.getLocalizedName(), url, true); } } }; authCmd.execute(); }
From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPerspective.java
License:Open Source License
@SuppressWarnings("unchecked") public void openFile(String path, String name, String localizedFileName, FileCommand.COMMAND mode) { ArrayList<String> pathSegments = solutionTree.getPathSegments(path); final boolean fileExists = solutionTree.doesFileExist(pathSegments, name); if (!fileExists) { final MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("open"), //$NON-NLS-1$ Messages.getString("fileDoesNotExist", name), false, false, true); //$NON-NLS-1$ dialogBox.center();// w ww . j av a 2s . com return; } String repoPath = ""; //$NON-NLS-1$ for (int i = 1; i < pathSegments.size(); i++) { repoPath += "/" + pathSegments.get(i); //$NON-NLS-1$ } FileItem selectedFileItem = new FileItem(name, localizedFileName, localizedFileName, pathSegments.get(0), repoPath, "", null, null, null, false, null); //$NON-NLS-1$ filesListPanel.setSelectedFileItem(selectedFileItem); solutionTree.setSelectedItem(null); FileTreeItem fileTreeItem = solutionTree.getTreeItem(pathSegments); solutionTree.setSelectedItem(fileTreeItem, true); TreeItem tmpTreeItem = fileTreeItem; while (tmpTreeItem != null) { tmpTreeItem.setState(true); tmpTreeItem = tmpTreeItem.getParentItem(); } fileTreeItem.setSelected(true); ArrayList<com.google.gwt.xml.client.Element> files = (ArrayList<com.google.gwt.xml.client.Element>) fileTreeItem .getUserObject(); if (files != null) { for (com.google.gwt.xml.client.Element fileElement : files) { if (name.equals(fileElement.getAttribute("name")) //$NON-NLS-1$ || name.equals(fileElement.getAttribute("localized-name"))) { //$NON-NLS-1$ selectedFileItem.setURL(fileElement.getAttribute("url")); //$NON-NLS-1$ } } } if (mode == FileCommand.COMMAND.EDIT) { editFile(); } else if (mode == FileCommand.COMMAND.SCHEDULE_NEW) { ScheduleHelper.createSchedule(filesListPanel.getSelectedFileItem()); } else if (mode == FileCommand.COMMAND.SHARE) { (new ShareFileCommand()).execute(); } else { if (name.endsWith(".xaction")) { //$NON-NLS-1$ executeActionSequence(mode); // contentTabPanel.setFileInfoInFrame(filesListPanel.getSelectedFileItem()); } else if (name.endsWith(".url")) { //$NON-NLS-1$ if (mode == FileCommand.COMMAND.NEWWINDOW) { Window.open(filesListPanel.getSelectedFileItem().getURL(), "_blank", //$NON-NLS-1$ "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ } else { contentTabPanel.showNewURLTab(filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getURL(), true); } } else { // see if this file is a plugin ContentTypePlugin plugin = PluginOptionsHelper .getContentTypePlugin(filesListPanel.getSelectedFileItem().getName()); if (plugin != null && plugin.hasCommand(mode)) { // load the editor for this plugin String url = plugin.getCommandUrl(filesListPanel.getSelectedFileItem(), mode); if (StringUtils.isEmpty(url)) { url = filesListPanel.getSelectedFileItem().getURL(); } if (GWT.isScript()) { if (url != null && !"".equals(url)) { //$NON-NLS-1$ // we have a URL so open it if (mode == FileCommand.COMMAND.NEWWINDOW) { Window.open(url, "_blank", //$NON-NLS-1$ "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ } else if (mode == FileCommand.COMMAND.BACKGROUND) { RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("error"), //$NON-NLS-1$ Messages.getString("couldNotBackgroundExecute"), false, false, //$NON-NLS-1$ true); dialogBox.center(); } public void onResponseReceived(Request request, Response response) { MessageDialogBox dialogBox = new MessageDialogBox( Messages.getString("info"), //$NON-NLS-1$ Messages.getString("backgroundExecutionWarning"), //$NON-NLS-1$ true, false, true); dialogBox.setCallback(new IDialogCallback() { public void cancelPressed() { } public void okPressed() { if (isWorkspaceShowing()) { workspacePanel.refreshWorkspace(); } } }); dialogBox.center(); } }); } catch (RequestException e) { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$ e.getMessage(), //$NON-NLS-1$ true, false, true); dialogBox.center(); } } else { UrlCommand cmd = new UrlCommand(url, filesListPanel.getSelectedFileItem().getLocalizedName()); cmd.execute(new CommandCallback() { public void afterExecute() { contentTabPanel.setFileInfoInFrame(filesListPanel.getSelectedFileItem()); } }); } } } else { if (url != null && !"".equals(url)) { //$NON-NLS-1$ // we have a URL so open it in a new tab String updateUrl = "/MantleService?passthru=" + url; //$NON-NLS-1$ if (mode == FileCommand.COMMAND.NEWWINDOW) { Window.open(updateUrl, "_blank", //$NON-NLS-1$ "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ } else { contentTabPanel.showNewURLTab( filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getLocalizedName(), updateUrl, true); } } } } else { // see if this file has a URL String url = filesListPanel.getSelectedFileItem().getURL(); if (url != null && !"".equals(url)) { //$NON-NLS-1$ // we have a URL so open it in a new tab if (mode == FileCommand.COMMAND.NEWWINDOW) { Window.open(filesListPanel.getSelectedFileItem().getURL(), "_blank", //$NON-NLS-1$ "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ } else { contentTabPanel.showNewURLTab(filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getURL(), true); } } } } } }
From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPerspective.java
License:Open Source License
public void executeActionSequence(final FileCommand.COMMAND mode) { // open in content panel AbstractCommand authCmd = new AbstractCommand() { protected void performOperation() { performOperation(false);/* w w w. jav a 2 s .com*/ } protected void performOperation(boolean feedback) { String url = null; String path = filesListPanel.getSelectedFileItem().getPath(); if (path.startsWith("/")) { //$NON-NLS-1$ path = path.substring(1); } if (GWT.isScript()) { url = "ViewAction?solution=" + //$NON-NLS-1$ URL.encodeComponent(filesListPanel.getSelectedFileItem().getSolution()) + "&path=" + //$NON-NLS-1$ URL.encodeComponent(path) + "&action=" + //$NON-NLS-1$ URL.encodeComponent(filesListPanel.getSelectedFileItem().getName()); String mypath = Window.Location.getPath(); if (!mypath.endsWith("/")) { //$NON-NLS-1$ mypath = mypath.substring(0, mypath.lastIndexOf("/") + 1); //$NON-NLS-1$ } mypath = mypath.replaceAll("/mantle/", "/"); //$NON-NLS-1$ //$NON-NLS-2$ if (!mypath.endsWith("/")) { //$NON-NLS-1$ mypath = "/" + mypath; //$NON-NLS-1$ } url = mypath + url; } else { url = "/MantleService?passthru=ViewAction&solution=" //$NON-NLS-1$ + filesListPanel.getSelectedFileItem().getSolution() + "&path=" + path + "&action=" //$NON-NLS-1$//$NON-NLS-2$ + filesListPanel.getSelectedFileItem().getName() + "&userid=joe&password=password"; //$NON-NLS-1$ } if (mode == FileCommand.COMMAND.BACKGROUND) { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$ Messages.getString("backgroundExecutionWarning"), //$NON-NLS-1$ true, false, true); dialogBox.center(); url += "&background=true"; //$NON-NLS-1$ RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$ Messages.getString("couldNotBackgroundExecute"), false, false, true); //$NON-NLS-1$ dialogBox.center(); } public void onResponseReceived(Request request, Response response) { } }); } catch (RequestException e) { } } else if (mode == FileCommand.COMMAND.NEWWINDOW) { // popup blockers might attack this Window.open(url, "_blank", "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ //$NON-NLS-2$ } else if (mode == FileCommand.COMMAND.SUBSCRIBE) { final String myurl = url + "&subscribepage=yes"; //$NON-NLS-1$ AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() { public void onFailure(Throwable caught) { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$ Messages.getString("couldNotGetFileProperties"), false, false, true); //$NON-NLS-1$ dialogBox.center(); } public void onSuccess(Boolean subscribable) { if (subscribable) { contentTabPanel.showNewURLTab( filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getLocalizedName(), myurl, true); } else { MessageDialogBox dialogBox = new MessageDialogBox(Messages.getString("info"), //$NON-NLS-1$ Messages.getString("noSchedulePermission"), false, false, true); //$NON-NLS-1$ dialogBox.center(); } } }; MantleServiceCache.getService().hasAccess(filesListPanel.getSelectedFileItem().getSolution(), filesListPanel.getSelectedFileItem().getPath(), filesListPanel.getSelectedFileItem().getName(), 3, callback); } else { contentTabPanel.showNewURLTab(filesListPanel.getSelectedFileItem().getLocalizedName(), filesListPanel.getSelectedFileItem().getLocalizedName(), url, true); } } }; authCmd.execute(); }
From source file:org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel.java
License:Open Source License
public void openTabInNewWindow() { Window.open(getCurrentUrl(), "_blank", ""); //$NON-NLS-1$ //$NON-NLS-2$ }
From source file:org.pentaho.mantle.login.client.MantleLoginEntryPoint.java
License:Open Source License
public void bundleLoaded(String bundleName) { AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() { public void onFailure(Throwable err) { MessageDialogBox dialog = new MessageDialogBox(Messages.getString("error"), //$NON-NLS-1$ Messages.getString("loginError"), false, true, true); //$NON-NLS-1$ dialog.setCallback(new IDialogCallback() { public void cancelPressed() { }/*from ww w . j a v a 2s . c om*/ public void okPressed() { loginDialog.show(); } }); dialog.center(); } public void onSuccess(Boolean newWindow) { if (newWindow) { String URL = (!StringUtils.isEmpty(returnLocation)) ? returnLocation.replace("Login", "Home") //$NON-NLS-1$//$NON-NLS-2$ : Window.Location.getPath().replace("Login", "Home"); //$NON-NLS-1$ Window.open(URL, "puc", "menubar=no,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ //$NON-NLS-2$ // Schedule checking of new Window (Popup checker). popupWarningTimer.schedule(5000); } else if (!StringUtils.isEmpty(returnLocation)) { //$NON-NLS-1$ Window.Location.assign(returnLocation.replace("Login", "Home")); } else { Window.Location.replace(Window.Location.getPath().replace("Login", "Home")); //$NON-NLS-1$ //$NON-NLS-2$ } } }; loginDialog = new MantleLoginDialog(callback, true); setupNativeHooks(loginDialog, this); }
From source file:org.pentaho.pac.client.AdminConsoleToolbar.java
License:Open Source License
public AdminConsoleToolbar(final IRefreshableAdminConsole console, final String helpUrlOverride) { super();//from w w w. j a v a 2s . c o m setStyleName("adminconsole-toolbar"); //$NON-NLS-1$ //Left end-cap SimplePanel leftCap = new SimplePanel(); leftCap.setStyleName("adminconsole-toolbar_left"); //$NON-NLS-1$ add(leftCap); this.setCellWidth(leftCap, "5px"); //$NON-NLS-1$ //the body of the toolbar HorizontalPanel centerPanel = new HorizontalPanel(); centerPanel.setStyleName("adminconsole-toolbar_center"); //$NON-NLS-1$ add(centerPanel); //Right end-cap SimplePanel rightCap = new SimplePanel(); rightCap.setStyleName("adminconsole-toolbar_right"); //$NON-NLS-1$ add(rightCap); this.setCellWidth(rightCap, "6px"); //$NON-NLS-1$ SimplePanel indicatorsPanel = new SimplePanel(); indicatorsPanel.setStyleName("toolBarIndicators"); //$NON-NLS-1$ centerPanel.add(indicatorsPanel); SimplePanel indicatorsLeft = new SimplePanel(); indicatorsLeft.setStyleName("indicators_left"); //$NON-NLS-1$ indicatorsPanel.add(indicatorsLeft); indicatorsRight.setStyleName("indicators_right"); //$NON-NLS-1$ indicatorsLeft.add(indicatorsRight); contructToolbarIndicator(); setIndicators(toolbarIndicator); Image refreshConsoleImage = PacImageBundle.getBundle().refreshIcon().createImage(); refreshConsoleImage.setTitle(Messages.getString("resetServer")); //$NON-NLS-1$ refreshConsoleImage.addClickListener(new ClickListener() { public void onClick(Widget sender) { console.refresh(); } }); addImageButton(refreshConsoleImage); Image helpImage = PacImageBundle.getBundle().helpIcon().createImage(); helpImage.setTitle(Messages.getString("help")); //$NON-NLS-1$ helpImage.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (helpUrlOverride != null && helpUrlOverride.length() > 0) { Window.open(helpUrlOverride, Messages.getString("userGuide"), ""); //$NON-NLS-1$ //$NON-NLS-2$ } else { PacServiceFactory.getPacService().getHelpUrl(new AsyncCallback<String>() { public void onFailure(Throwable arg0) { //TODO show error message } public void onSuccess(String helpUrl) { Window.open(helpUrl, Messages.getString("userGuide"), ""); //$NON-NLS-1$ //$NON-NLS-2$ } }); } } }); addImageButton(helpImage); centerPanel.add(buttonsPanel); centerPanel.setCellHorizontalAlignment(buttonsPanel, HorizontalPanel.ALIGN_RIGHT); centerPanel.setCellVerticalAlignment(buttonsPanel, HorizontalPanel.ALIGN_MIDDLE); statusTimer = new Timer() { public void run() { PacServiceFactory.getPacService().isBiServerAlive(new AsyncCallback<Object>() { public void onSuccess(Object isAlive) { toolbarIndicator.displayServerAlive(); } public void onFailure(Throwable caught) { toolbarIndicator.displayServerDead(); } }); } }; PacServiceFactory.getPacService().getBiServerStatusCheckPeriod(new AsyncCallback<Integer>() { public void onSuccess(Integer checkPeriod) { if (checkPeriod > 0) { statusTimer.scheduleRepeating(checkPeriod); } } public void onFailure(Throwable caught) { // otherwise we don't know what the status check period is, so don't schedule anything } }); }
From source file:org.pentaho.pat.client.Pat.java
License:Open Source License
public static void openDonation() { Window.open( "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paul%2estoellberger%40gmail%2ecom&lc=GB&item_name=PAT%20Project¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted", "_blank", ""); }
From source file:org.pentaho.ui.database.gwt.GwtLaunch.java
License:Open Source License
public Status openUrl(String url, IMessages messages) { Window.open(url, "_blank", ""); //$NON-NLS-1$ //$NON-NLS-2$ return Status.Success; }
From source file:org.pepstock.jem.gwt.client.about.AboutPanel.java
License:Open Source License
/** * Builds panel with all fields/*from w ww . j a v a 2 s . c om*/ * * @param about * */ public AboutPanel(About about) { super(false); // link to PEPSTOCK site Anchor site = new Anchor("www.pepstock.org"); site.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.open("http://www.pepstock.org/", "_blank", ""); } }); VerticalPanel tableContainer = new VerticalPanel(); tableContainer.setSize(Sizes.HUNDRED_PERCENT, Sizes.HUNDRED_PERCENT); tableContainer.setSpacing(10); Label aboutLabel = new Label("About JEM"); aboutLabel.setWidth(Sizes.HUNDRED_PERCENT); aboutLabel.setStyleName(Styles.INSTANCE.inspector().title()); aboutLabel.addStyleName(Styles.INSTANCE.common().bold()); FlexTable aboutTable = new FlexTable(); aboutTable.setCellPadding(10); aboutTable.setSize(Sizes.HUNDRED_PERCENT, Sizes.HUNDRED_PERCENT); aboutTable.addStyleName(Styles.INSTANCE.common().noWrap()); aboutTable.getColumnFormatter().setWidth(1, "80%"); aboutTable.setHTML(0, 0, "Site"); aboutTable.setWidget(0, 1, site); aboutTable.setHTML(1, 0, "Version"); aboutTable.setHTML(1, 1, about.getVersion()); aboutTable.setHTML(2, 0, "Build time"); aboutTable.setHTML(2, 1, about.getCreationTime()); Label licensesLabel = new Label("Installed Licences"); licensesLabel.setWidth(Sizes.HUNDRED_PERCENT); licensesLabel.setStyleName(Styles.INSTANCE.inspector().title()); licensesLabel.addStyleName(Styles.INSTANCE.common().bold()); FlexTable licensesTable = new FlexTable(); licensesTable.setCellPadding(10); licensesTable.setSize(Sizes.HUNDRED_PERCENT, Sizes.HUNDRED_PERCENT); if (!about.getLicenses().isEmpty()) { int row = 0; for (NodeLicense license : about.getLicenses()) { StringBuilder builder = new StringBuilder(); builder.append("Module: <b>" + license.getModule() + "</b>, "); builder.append("File name: <b>" + license.getFileName() + "</b><br/>"); builder.append("Subject: <b>" + license.getSubject() + "</b>, "); builder.append("Email: <b>" + license.getEmail() + "</b>, "); builder.append("Issue date: <b>" + license.getIssuedate() + "</b>, "); builder.append("Expire date: <b>" + license.getExpiredate() + "</b>, "); builder.append("Max nodes: <b>" + license.getMaxnodes() + "</b>"); licensesTable.setHTML(row, 0, builder.toString()); row++; } } else { licensesTable.setHTML(0, 0, "(none)"); } // styles UITools.setFlexTableRowStyles(aboutTable, Styles.INSTANCE.inspector().rowDark(), Styles.INSTANCE.inspector().rowLight()); UITools.setFlexTableRowStyles(licensesTable, Styles.INSTANCE.inspector().rowDark(), Styles.INSTANCE.inspector().rowLight()); // populate main panel tableContainer.add(aboutLabel); tableContainer.add(aboutTable); tableContainer.add(licensesLabel); tableContainer.add(licensesTable); // add main to scroller main.add(tableContainer); }