Example usage for com.google.gwt.user.client Window open

List of usage examples for com.google.gwt.user.client Window open

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window open.

Prototype

public static void open(String url, String name, String features) 

Source Link

Usage

From source file:org.ow2.proactive_grid_cloud_portal.scheduler.client.SchedulerPage.java

License:Open Source License

/**
 * Builds and returns the toolbar/*ww  w . j a v a2  s  .  c om*/
 *
 * <pre>
 * +- ToolStrip --------------------------------------------------------------+
 * |+- Portal v -++- Admin v -++- Help v -+|+ Submit ++ Logout +   +- Img ---+|
 * || Submit     || Start     || Logs     ||+--------++--------+   | PA logo ||
 * || Settings   || Stop      || About    |                        +---------+|
 * +| Credentials|| Freeze    |+----------+-----------------------------------+
 *  | Logout     || Pause     |
 *  +------------+| Resume    |
 *                | Kill      |
 *                +-----------+
 * </pre>
 */
private ToolStrip buildTools() {
    ToolStrip tools = new ToolStrip();
    tools.setHeight(50);
    tools.setWidth100();
    tools.setBackgroundImage("");
    tools.setBackgroundColor("#fafafa");
    tools.setBorder("0px");

    MenuItem submitMenuItem = new MenuItem("Submit job",
            SchedulerImages.instance.job_submit_16().getSafeUri().asString());
    submitMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SubmitWindow w = new SubmitWindow(SchedulerPage.this.controller);
            w.show();
        }
    });
    MenuItem flatSubmitMenuItem = new MenuItem("Submit command file",
            SchedulerImages.instance.script_16().getSafeUri().asString());
    flatSubmitMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            FlatSubmitWindow w = new FlatSubmitWindow(SchedulerPage.this.controller);
            w.show();
        }
    });

    MenuItem settingsMenuItem = new MenuItem("Settings", Images.instance.settings_16().getSafeUri().asString());
    settingsMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.settingsWindow.show();
        }
    });

    MenuItem credMenuItem = new MenuItem("Create credentials",
            Images.instance.key_16().getSafeUri().asString());
    credMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            CredentialsWindow credentialsWindow = new CredentialsWindow();
            credentialsWindow.show();
        }
    });

    MenuItem thirdPartyCredentialsMenuItem = new MenuItem("Manage third-party credentials",
            Images.instance.key_16().getSafeUri().asString());
    thirdPartyCredentialsMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            ThirdPartyCredentialsWindow credentialsWindow = new ThirdPartyCredentialsWindow(
                    SchedulerPage.this.controller);
            credentialsWindow.show();
        }
    });

    MenuItem serversMenuItem = new MenuItem("Data servers",
            Images.instance.server_16().getSafeUri().asString());
    serversMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            String url = GWT.getModuleBaseURL() + "servers?codebase=" + GWT.getHostPageBaseURL();
            Window.open(url, "_blank", "");
        }
    });

    MenuItem logoutMenuItem = new MenuItem("Logout", Images.instance.exit_18().getSafeUri().asString());
    logoutMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SC.confirm("Logout", "Are you sure you want to exit?", new BooleanCallback() {
                public void execute(Boolean value) {
                    if (value) {
                        SchedulerPage.this.controller.logout();
                    }
                }
            });
        }
    });

    ToolStripMenuButton portalMenuButton = new ToolStripMenuButton("Portal");
    Menu portalMenu = new Menu();
    portalMenu.setItems(submitMenuItem, flatSubmitMenuItem, new MenuItemSeparator(), credMenuItem,
            thirdPartyCredentialsMenuItem, serversMenuItem, settingsMenuItem, new MenuItemSeparator(),
            logoutMenuItem);
    portalMenuButton.setMenu(portalMenu);

    MenuItem logMenuItem = new MenuItem("Display logs", Images.instance.log_16().getSafeUri().asString());
    logMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.logWindow.show();
            errorButton.hide();
        }
    });

    MenuItem documentationMenuItem = new MenuItem("Documentation",
            Images.instance.icon_manual().getSafeUri().asString());
    documentationMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            String docVersion = Config.get().getVersion().contains("SNAPSHOT") ? "latest"
                    : Config.get().getVersion();
            Window.open("http://doc.activeeon.com/" + docVersion, "", "");
        }
    });

    MenuItem aboutMenuItem = new MenuItem("About", Images.instance.about_16().getSafeUri().asString());
    aboutMenuItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.aboutWindow.show();
        }
    });
    ToolStripMenuButton helpMenuButton = new ToolStripMenuButton("Help");
    Menu helpMenu = new Menu();
    helpMenu.setItems(logMenuItem, documentationMenuItem, aboutMenuItem);
    helpMenuButton.setMenu(helpMenu);

    ToolStripButton submitButton = new ToolStripButton("Submit job");
    submitButton.setIcon(SchedulerImages.instance.job_submit_16().getSafeUri().asString());
    submitButton.setTooltip("Submit a new job");
    submitButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            SubmitWindow w = new SubmitWindow(SchedulerPage.this.controller);
            w.show();
        }
    });

    schedStartButton = new MenuItem("Start");
    schedStartButton.setIcon(SchedulerImages.instance.scheduler_start_16().getSafeUri().asString());
    schedStartButton.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.controller.startScheduler();
        }
    });

    schedStopButton = new MenuItem("Stop");
    schedStopButton.setIcon(SchedulerImages.instance.scheduler_stop_16().getSafeUri().asString());
    schedStopButton.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.controller.stopScheduler();
        }
    });

    schedFreezeButton = new MenuItem("Freeze");
    schedFreezeButton.setIcon(SchedulerImages.instance.scheduler_freeze_16().getSafeUri().asString());
    schedFreezeButton.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.controller.freezeScheduler();
        }
    });

    schedResumeButton = new MenuItem("Resume");
    schedResumeButton.setIcon(SchedulerImages.instance.scheduler_resume_16().getSafeUri().asString());
    schedResumeButton.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.controller.resumeScheduler();
        }
    });

    schedPauseButton = new MenuItem("Pause");
    schedPauseButton.setIcon(SchedulerImages.instance.scheduler_pause_16().getSafeUri().asString());
    schedPauseButton.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SchedulerPage.this.controller.pauseScheduler();

        }
    });

    schedKillButton = new MenuItem("Kill");
    schedKillButton.setIcon(SchedulerImages.instance.scheduler_kill_16().getSafeUri().asString());
    schedKillButton.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            SC.confirm("Do you really want to <strong>kill</strong> the Scheduler?", new BooleanCallback() {
                public void execute(Boolean value) {
                    if (value)
                        SchedulerPage.this.controller.killScheduler();
                }
            });
        }
    });

    ToolStripMenuButton adminMenuButton = new ToolStripMenuButton("Admin");
    this.adminMenu = new Menu();
    this.adminMenu.setItems(schedStartButton, schedStopButton, schedFreezeButton, schedResumeButton,
            schedPauseButton, schedKillButton);
    adminMenuButton.setMenu(adminMenu);

    String login = LoginModel.getInstance().getLogin();
    if (login != null)
        login = " <b>" + login + "</b>";
    else
        login = "";

    ToolStripButton logoutButton = new ToolStripButton("Logout" + login);
    logoutButton.setIcon(Images.instance.logout_30().getSafeUri().asString());
    logoutButton.setIconSize(25);
    logoutButton.setTooltip("Logout");
    logoutButton.setBorder(GREY_BUTTON_BORDER);
    logoutButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            SC.confirm("Logout", "Are you sure you want to exit?", new BooleanCallback() {
                public void execute(Boolean value) {
                    if (value) {
                        SchedulerPage.this.controller.logout();
                    }
                }
            });
        }
    });

    errorButton = new ToolStripButton("<strong>Network error</strong>",
            Images.instance.net_error_16().getSafeUri().asString());
    errorButton.setBackgroundColor("#ffbbbb");
    errorButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            SchedulerPage.this.logWindow.show();
            errorButton.hide();
        }
    });
    errorButton.hide();

    ToolStripButton resourceManagerLinkButton = getResourceManagerLinkButton();
    resourceManagerLinkButton.setIcon(Images.instance.rm_30().getSafeUri().asString());
    resourceManagerLinkButton.setIconSize(25);
    resourceManagerLinkButton.setBorder(GREY_BUTTON_BORDER);

    ToolStripButton studioLinkButton = getStudioLinkButton();
    studioLinkButton.setIcon(Images.instance.studio_30().getSafeUri().asString());
    studioLinkButton.setIconSize(25);
    studioLinkButton.setBorder(GREY_BUTTON_BORDER);

    tools.addMenuButton(portalMenuButton);
    tools.addMenuButton(adminMenuButton);
    tools.addMenuButton(helpMenuButton);
    tools.addSeparator();
    tools.addButton(submitButton);
    tools.addButton(errorButton);
    tools.addFill();
    tools.addButton(studioLinkButton);
    tools.addSpacer(12);
    tools.addButton(resourceManagerLinkButton);
    tools.addSpacer(2);
    tools.addSeparator();
    tools.addSpacer(2);
    tools.addButton(logoutButton);
    tools.addSpacer(10);

    // disable all controls at first, next event will sort it out
    this.statusChanged(SchedulerStatus.KILLED);

    return tools;
}

From source file:org.ow2.proactive_grid_cloud_portal.scheduler.client.SchedulerPage.java

License:Open Source License

private ToolStripButton getResourceManagerLinkButton() {
    ToolStripButton resourceManagerButton = new ToolStripButton("Resource Manager");

    resourceManagerButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            Window.open("/rm", "", "");
        }//from  w  ww.  ja  v  a2s. co  m
    });

    return resourceManagerButton;
}

From source file:org.ow2.proactive_grid_cloud_portal.scheduler.client.UsageView.java

License:Open Source License

private ClickHandler downloadUsageData() {
    return new ClickHandler() {
        @Override// www.  j a v  a 2s.co m
        public void onClick(ClickEvent event) {
            String from = DATE_FORMAT.format(readDateFromFormItem(datesForm.getItem("From")));
            String to = DATE_FORMAT.format(readDateFromFormItem(datesForm.getItem("To")));

            String url = GWT.getModuleBaseURL() + "usageexporter";
            url += "?sessionId=" + LoginModel.getInstance().getSessionId();
            url += "&user=" + userSelect.getValue().toString();
            url += "&startDate=" + URL.encodeQueryString(from);
            url += "&endDate=" + URL.encodeQueryString(to);
            Window.open(url, "_blank", "");
        }
    };
}

From source file:org.penpusher.client.controller.ApplicationController.java

License:Open Source License

public void exportDocument(final String filename, final Folder folder) {
    // Download the document
    final StringBuffer url = new StringBuffer(GWT.getModuleBaseURL());
    url.append("documentDownloader");
    url.append("?path=");
    url.append(folder.getPath());//from w w w  .  j a  v a  2  s  .  co  m
    url.append("&filename=");
    url.append(filename);
    Window.open(url.toString(), "_self", "");
}

From source file:org.pentaho.gwt.widgets.login.client.LoginEntryPoint.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   www.  j a va 2  s .c o m*/

                public void okPressed() {
                    loginDialog.show();
                }
            });
            dialog.center();
        }

        public void onSuccess(Boolean newWindow) {
            if (newWindow) {
                String URL = (!returnLocation.equals("")) ? returnLocation //$NON-NLS-1$
                        : Window.Location.getPath().replace("Login", "Home"); //$NON-NLS-1$ //$NON-NLS-2$

                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 (!returnLocation.equals("")) { //$NON-NLS-1$
                Window.Location.assign(returnLocation);
            } else {
                Window.Location.replace(Window.Location.getPath().replace("Login", "Home")); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }

    };

    loginDialog = new LoginDialog(callback, true);

    setupNativeHooks(loginDialog, this);
}

From source file:org.pentaho.mantle.client.commands.ExportFileCommand.java

License:Open Source License

protected void performOperation(boolean feedback) {
    String path = repositoryFile.getPath();
    String moduleBaseURL = GWT.getModuleBaseURL();
    String moduleName = GWT.getModuleName();
    String contextURL = moduleBaseURL.substring(0, moduleBaseURL.lastIndexOf(moduleName));
    String exportURL = contextURL + "api/repo/files/" + SolutionBrowserPanel.pathToId(path)
            + "/download?withManifest=true";
    Window.open(exportURL, "_new", "");

    final SolutionFileActionEvent event = new SolutionFileActionEvent();
    event.setAction(this.getClass().getName());
    event.setMessage("Success");
    EventBusUtil.EVENT_BUS.fireEvent(event);
}

From source file:org.pentaho.mantle.client.commands.OpenDocCommand.java

License:Open Source License

protected void performOperation(boolean feedback) {
    MantleSettingsManager.getInstance().getMantleSettings(new AsyncCallback<HashMap<String, String>>() {

        public void onSuccess(HashMap<String, String> result) {
            documentationURL = result.get("documentation-url");

            boolean isExternalDocumentation = documentationURL.startsWith("http:")
                    || documentationURL.startsWith("https:");

            if (!documentationURL.startsWith("/") && !isExternalDocumentation) {
                // we're working with a relative URL, this is relative to the web-app not the GWT module
                documentationURL = GWT.getHostPageBaseURL() + documentationURL;
            }//from w  w  w.  j a v  a2 s  .com
            Window.open(documentationURL, "_blank", ""); //$NON-NLS-1$ //$NON-NLS-2$
        }

        public void onFailure(Throwable caught) {
        }
    }, false);
}

From source file:org.pentaho.mantle.client.commands.PentahoHomeCommand.java

License:Open Source License

public void execute() {
    Window.open("http://www.pentaho.com", "_blank", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}

From source file:org.pentaho.mantle.client.LogoPanel.java

License:Open Source License

public LogoPanel(String launchURL) {
    this.launchURL = launchURL;
    setStyleName("logoPanel-ContainerToolBar"); //$NON-NLS-1$
    setSpacing(0);//from  w  w w .  ja v a 2  s.c  om
    setHeight("100%"); //$NON-NLS-1$
    setWidth("100%"); //$NON-NLS-1$

    VerticalPanel toolBarBackgroundPanel = new VerticalPanel();
    toolBarBackgroundPanel.setSpacing(0);
    toolBarBackgroundPanel.setStyleName("logoPanel-Container"); //$NON-NLS-1$
    toolBarBackgroundPanel.addStyleName("puc-logo");
    toolBarBackgroundPanel.setWidth("100%"); //$NON-NLS-1$
    toolBarBackgroundPanel.setHeight("100%"); //$NON-NLS-1$

    Image logoImage = new Image();
    if (GWT.isScript()) {
        logoImage.setUrl("mantle/images/spacer.gif"); //$NON-NLS-1$
    } else {
        logoImage.setUrl("images/spacer.gif"); //$NON-NLS-1$
    }
    if (launchURL != null && !"".equals(launchURL)) { //$NON-NLS-1$
        logoImage.setStyleName("launchImage"); //$NON-NLS-1$
        logoImage.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                Window.open(getLaunchURL(), "_blank", ""); //$NON-NLS-1$ //$NON-NLS-2$
            }
        });
    }
    logoImage.setStyleName("puc-logo-spacer");
    toolBarBackgroundPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    toolBarBackgroundPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    toolBarBackgroundPanel.add(logoImage);

    add(toolBarBackgroundPanel);
}

From source file:org.pentaho.mantle.client.solutionbrowser.SolutionBrowserPanel.java

License:Open Source License

public void openFile(final RepositoryFile repositoryFile, final FileCommand.COMMAND mode) {

    String fileNameWithPath = repositoryFile.getPath();
    if (mode == FileCommand.COMMAND.EDIT) {
        PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);
        editFile(repositoryFile);/*from  w  ww  .j a v a  2 s  . c  o  m*/
    } else if (mode == FileCommand.COMMAND.SCHEDULE_NEW) {
        ScheduleHelper.createSchedule(repositoryFile, new ScheduleCallback(repositoryFile));
        return;
    } else if (mode == FileCommand.COMMAND.SHARE) {
        ShareFileCommand sfc = new ShareFileCommand();
        sfc.setSolutionPath(fileNameWithPath);
        sfc.execute();
    } else {
        String url = null;
        String extension = ""; //$NON-NLS-1$
        if (fileNameWithPath.lastIndexOf(FILE_EXTENSION_DELIMETER) > 0) { //$NON-NLS-1$
            extension = fileNameWithPath.substring(fileNameWithPath.lastIndexOf(FILE_EXTENSION_DELIMETER) + 1); //$NON-NLS-1$
        }
        if (!executableFileExtensions.contains(extension)) {
            url = getPath() + "api/repos/" + pathToId(fileNameWithPath) + "/content"; //$NON-NLS-1$ //$NON-NLS-2$ 
        } else {
            ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(fileNameWithPath);
            url = getPath() + "api/repos/" + pathToId(fileNameWithPath) + "/" //$NON-NLS-1$//$NON-NLS-2$
                    + (plugin != null && (plugin.getCommandPerspective(mode) != null)
                            ? plugin.getCommandPerspective(mode)
                            : "generatedContent"); //$NON-NLS-1$
        }
        // force to open pdf files in another window due to issues with pdf readers in IE browsers
        // via class added on themeResources for IE browsers
        boolean pdfReaderEmbeded = RootPanel.getBodyElement().getClassName().contains("pdfReaderEmbeded");
        if (mode == FileCommand.COMMAND.NEWWINDOW || (extension.equals("pdf") && pdfReaderEmbeded)) {
            Window.open(url, "_blank", "menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no"); //$NON-NLS-1$ //$NON-NLS-2$
        } else {
            PerspectiveManager.getInstance().setPerspective(PerspectiveManager.OPENED_PERSPECTIVE);
            contentTabPanel.showNewURLTab(repositoryFile.getTitle(), repositoryFile.getTitle(), url, true);
            addRecent(fileNameWithPath, repositoryFile.getTitle());
        }
    }

    // Store representation of file in the frame for reference later when
    // save is called
    String fileName = repositoryFile.getName();
    if (fileName.contains(FILE_EXTENSION_DELIMETER)) {
        fileName = fileName.substring(0, fileName.lastIndexOf(FILE_EXTENSION_DELIMETER));
    }
    String filePath = repositoryFile.getPath();
    if (filePath.endsWith(repositoryFile.getName())) {
        filePath = filePath.substring(0, filePath.lastIndexOf(repositoryFile.getName()) - 1);
    }
    SolutionFileInfo fileInfo = new SolutionFileInfo();
    fileInfo.setName(fileName);
    fileInfo.setPath(filePath);
    fileInfo.setType(SolutionFileInfo.Type.XACTION);
    if (contentTabPanel != null && contentTabPanel.getCurrentFrame() != null) {
        contentTabPanel.getCurrentFrame().setFileInfo(fileInfo);
    }
}