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:edu.ucdenver.bios.glimmpseweb.client.connector.PowerSvcConnector.java

License:Open Source License

/**
 * Create a new connector to the power service
 *//* w ww.ja va 2  s  .  c o m*/
public PowerSvcConnector() {
    VerticalPanel panel = new VerticalPanel();

    // set up the form for saving study designs
    VerticalPanel matrixFormContainer = new VerticalPanel();
    matrixFormContainer.add(studyDesignHidden);
    matrixDisplayForm.setAction(GlimmpseWeb.constants.powerSvcHostMatricesAsHTML());
    matrixDisplayForm.setMethod(FormPanel.METHOD_POST);
    matrixDisplayForm.addSubmitHandler(new SubmitHandler() {
        @Override
        public void onSubmit(SubmitEvent event) {
            Window.open("", MATRIX_DISPLAY_WINDOW,
                    "width=600,height=500,location=no,toolbars=no,menubar=no,status=yes,resizable=yes,scrollbars=yes");
        }
    });
    matrixDisplayForm.add(matrixFormContainer);
    panel.add(matrixDisplayForm);

    initWidget(panel);
}

From source file:edu.ucdenver.bios.glimmpseweb.client.wizard.WizardActionPanel.java

License:Open Source License

/**
 * Open the help manual in a new tab/window
 */// w ww  .  ja  v  a  2  s  . c o m
private void openHelpManual() {
    // open manual
    Window.open(GlimmpseWeb.constants.helpManualURI(), "_blank", null);
    for (WizardActionListener listener : listeners)
        listener.onHelp();
}

From source file:edu.ucla.loni.client.ServerLibraryManager.java

License:Open Source License

/**
 * Makes the HTTP request to download/*from  ww  w  .j  a va  2s.com*/
 */
private void downloadFiles(Pipefile[] selected) {
    int length = selected.length;

    String url = "serverlibrarymanager/download?n=" + length;
    for (int i = 0; i < length; i++) {
        String filename = selected[i].absolutePath;
        url += "&filename_" + i + "=" + URL.encode(filename);
    }

    Window.open(url, "downloadWindow", "");
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void actuallyDisplayCredentialsTab(VerticalPanel parent) {
    History.newItem("credentials");

    VerticalPanel credspanel = new VerticalPanel();
    credspanel.setSpacing(5);//from ww  w  .  java2  s  . c om
    parent.add(credspanel);
    credspanel.getElement().setClassName("euca-tab-with-text");

    VerticalPanel ppanel = new VerticalPanel();
    ppanel.add(new HTML("<h3>User account Information</h3>"));

    Grid userGrid = new Grid(3, 2);
    userGrid.setText(0, 0, "Login:");
    userGrid.setHTML(0, 1, "<b>" + loggedInUser.getUserName() + "</b>");
    userGrid.setText(1, 0, "Name:");
    userGrid.setHTML(1, 1, "<b>" + loggedInUser.getRealName() + "</b>");
    userGrid.setText(2, 0, "Email:");
    userGrid.setHTML(2, 1, "<b>" + loggedInUser.getEmail() + "</b>");
    ppanel.add(userGrid);
    ppanel.add(new HTML("<p>" + user_account_text + "</p>"));
    ppanel.setStyleName("euca-text");
    ppanel.addStyleName("content");

    Button passwordButton = new Button("Change Password", new ClickListener() {
        public void onClick(Widget sender) {
            displayPasswordChangePage(false);
        }
    });
    Button editButton = new Button("Edit Account Information", new ClickListener() {
        public void onClick(Widget sender) {
            displayUserRecordPage(RootPanel.get(), loggedInUser);
        }
    });
    ppanel.setSpacing(0);
    ppanel.add(editButton);
    ppanel.add(passwordButton);

    VerticalPanel cpanel = new VerticalPanel();
    cpanel.add(new HTML(certificate_download_text));
    cpanel.setStyleName("euca-text");
    cpanel.addStyleName("content");
    Button certButton = new Button("Download Credentials", new ClickListener() {
        public void onClick(Widget sender) {
            Window.open(GWT.getModuleBaseURL() + "getX509?user=" + loggedInUser.getUserName() + "&keyValue="
                    + loggedInUser.getUserName() + "&code=" + loggedInUser.getToken(), "_self", "");
        }
    });

    VerticalPanel rpanel = new VerticalPanel();
    rpanel.setSpacing(0);
    HTML credentials_html = new HTML(rest_credentials_text);
    credentials_html.setStyleName("content");
    rpanel.add(credentials_html);
    Grid g0 = new Grid(2, 2);
    g0.setWidget(0, 0, new HTML("<b><font size=\"2\">Query ID:</font></b>"));
    final HTML queryId = new HTML("<font color=#666666 size=\"2\">" + loggedInUser.getQueryId() + "</font>");
    queryId.setVisible(false);
    g0.setWidget(0, 1, queryId);
    g0.setWidget(1, 0, new HTML("<b><font size=\"2\">Secret Key:</font></b>"));
    final HTML secretKey = new HTML(
            "<font color=#666666 size=\"2\">" + loggedInUser.getSecretKey() + "</font>");
    secretKey.setVisible(false);
    g0.setWidget(1, 1, secretKey);
    rpanel.add(g0);
    rpanel.setStyleName("euca-text");
    final Button secretButton = new Button("Show keys");
    secretButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (secretKey.isVisible()) {
                secretKey.setVisible(false);
                queryId.setVisible(false);
                secretButton.setText("Show keys");
            } else {
                secretKey.setVisible(true);
                queryId.setVisible(true);
                secretButton.setText("Hide keys");
            }
        }
    });

    int gridRows = 3;
    if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator() && show_cloud_registration) {
        gridRows++;
    }
    credspanel.add(ppanel);

    credspanel.add(cpanel);
    credspanel.add(certButton);
    credspanel.add(rpanel);
    credspanel.add(secretButton);

    //        final Grid g = new Grid( gridRows, 2 );
    //        g.getColumnFormatter().setWidth(0, "400");
    //        g.getColumnFormatter().setWidth(1, "200");
    //        g.setCellSpacing( 30 );
    //
    //        g.setWidget( 0, 0, ppanel ); g.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    //       // g.setWidget( 0, 1, ppanel2); g.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);
    //
    //        g.setWidget( 1, 0, cpanel ); g.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
    //        g.setWidget( 1, 1, certButton ); g.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP);
    //
    //        g.setWidget( 2, 0, rpanel ); g.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
    //      g.setWidget( 2, 1, secretButton ); g.getCellFormatter().setVerticalAlignment(2, 1, HasVerticalAlignment.ALIGN_TOP);

    if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator() && show_cloud_registration) {
        VerticalPanel cloud_panel = new VerticalPanel();
        cloud_panel.setSpacing(0);
        cloud_panel.add(new HTML(cloud_registration_text));
        Grid g1 = new Grid(2, 2);
        g1.setWidget(0, 0, new HTML("<b><font size=\"2\">Cloud URL:</font></b>"));
        final HTML cloudUrl = new HTML("<font color=#666666 size=\"2\">https://"
                + cloudInfo.getInternalHostPort() + cloudInfo.getServicePath() + "</font>");
        g1.setWidget(0, 1, cloudUrl);
        g1.setWidget(1, 0, new HTML("<b><font size=\"2\">Cloud ID:</font></b>"));
        final HTML cloudId = new HTML("<font color=#666666 size=\"2\">" + cloudInfo.getCloudId() + "</font>");
        g1.setWidget(1, 1, cloudId);
        cloud_panel.add(g1);
        cloud_panel.setStyleName("euca-text");
        final Button cloudButton = new Button("Register");
        cloudButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                new RightscaleDialog().center();
            }
        });
        //         g.setWidget (3, 0, cloud_panel );
        //         g.getCellFormatter().setVerticalAlignment(3, 0, HasVerticalAlignment.ALIGN_TOP);
        credspanel.add(cloud_panel);
        VerticalPanel vp = new VerticalPanel();
        vp.setSpacing(0);
        HorizontalPanel hp = new HorizontalPanel();
        hp.setSpacing(0);
        hp.add(cloudButton);
        hp.add(new HTML("with"));
        Image logo = new Image("themes/share/rightscale-logo-blue.gif");
        logo.setStyleName("euca-inline-image");
        hp.add(logo);
        vp.add(hp);
        //         g.setWidget( 3, 1, vp );
        //         g.getCellFormatter().setVerticalAlignment(3, 1, HasVerticalAlignment.ALIGN_TOP);
        credspanel.add(vp);
    }

    //credspanel.add(g);
}

From source file:eml.studio.client.controller.DBController.java

License:Open Source License

/**
 * Data Visualization//from  w  ww .  j  a  v  a 2 s.c  o  m
 * 
 * @param path  file path
 * @param fileId  fileId
 */
public static void showDataVisualPopup(final String path, String fileId) {
    //Data module visualization
    if (path.contains("null")) {
        Window.alert("The results have not been produced yet!");
        return;
    }

    datasetSrv.loadFile(path, new AsyncCallback<Dataset>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Loading data failed?");
            logger.info(caught.getMessage());
        }

        @Override
        public void onSuccess(Dataset result) {
            if (result == null)
                return;
            if (result.getContenttype() == null) {
                Window.alert("Data type is not defined, please select the data type first?");
                DataTypeSelectPanel dataSelectPanel = new DataTypeSelectPanel(path, result);
                dataSelectPanel.getDescLabel().setText("Data Type Selection - " + result.getName());
                dataSelectPanel.center();
            } else if (result.getContenttype().equals(DatasetType.GENERAL.getDesc()))
                Window.alert("Visualization only support json?tsv?csv data type! ");
            else {
                List<String> conts = new ArrayList<String>();
                conts.add(path);
                conts.add(result.getContenttype());
                aesSrv.aesEncrypt(conts, new AsyncCallback<List<String>>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub
                        logger.info(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(List<String> result) {
                        // TODO Auto-generated method stub
                        Window.open("visualization.html?" + "path=" + result.get(0) + "&type=" + result.get(1),
                                "BDA Visualization", "");
                    }

                });
            }
        }
    });
}

From source file:eml.studio.client.ui.menu.DatasetDownloadMenu.java

License:Open Source License

public static MenuItem create(final DatasetLeaf node) {
    Command command = new MenuItemCommand(node) {

        @Override/* ww w  .j  a va  2  s .c  om*/
        public void execute() {
            String id = node.getModule().getId();
            final DatasetServiceAsync svc = GWT.create(DatasetService.class);
            svc.download(id, new AsyncCallback<String>() {

                @Override
                public void onFailure(Throwable caught) {
                    Window.alert(caught.getMessage());
                }

                @Override
                public void onSuccess(final String result) {
                    Window.alert("Start calculating the file size");
                    svc.getFileSize(result, new AsyncCallback<Double>() {

                        @Override
                        public void onFailure(Throwable caught) {
                            // TODO Auto-generated method stub
                            logger.info("Failed to get download file size!");
                        }

                        @Override
                        public void onSuccess(Double size) {
                            // TODO Auto-generated method stub
                            if (size < MAX_DOWNLOAD_SIZE) {
                                Window.alert("Start downloading the file");
                                String url = GWT.getModuleBaseURL().split("EML")[0]
                                        + "EMLStudioMonitor/filedownload?filename=" + result;
                                Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");
                            } else
                                Window.alert(
                                        "The download file exceeds the limit size (1g) and can not download the file?");
                        }

                    });

                }

            });
            this.component.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Download", command);
    return item;
}

From source file:eml.studio.client.ui.menu.ProgramDownloadMenu.java

License:Open Source License

public static MenuItem create(final ProgramLeaf node) {
    Command command = new MenuItemCommand(node) {

        @Override/*w w w .j  av  a2  s  . com*/
        public void execute() {
            String id = node.getModule().getId();
            ProgramServiceAsync svc = GWT.create(ProgramService.class);
            svc.download(id, new AsyncCallback<String>() {

                @Override
                public void onFailure(Throwable caught) {
                    Window.alert(caught.getMessage());
                }

                @Override
                public void onSuccess(String result) {
                    String url = GWT.getModuleBaseURL().split("EML")[0]
                            + "EMLStudioMonitor/filedownload?filename=" + result;
                    Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");
                }

            });
            this.component.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Download", command);
    return item;
}

From source file:eml.studio.client.ui.panel.DataTypeSelectPanel.java

License:Open Source License

/**
 * Event initialization//from www.j  a v  a 2s. co m
 */
public void bind() {
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            DataTypeSelectPanel.this.hide();
        }
    });

    okBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub
            DataTypeSelectPanel.this.hide();
            if (dataset.getContenttype() == null)
                Window.alert("Data type is undefined, please select data type first!");
            else if (dataset.getContenttype().equals(DatasetType.GENERAL.getDesc()))
                Window.alert("Visualization only support data for json?tsv or csv!");
            else {
                List<String> conts = new ArrayList<String>();
                conts.add(filePath);
                conts.add(dataset.getContenttype());
                aesSrv.aesEncrypt(conts, new AsyncCallback<List<String>>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub
                        logger.info(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(List<String> result) {
                        // TODO Auto-generated method stub
                        Window.open("visualization.html?" + "path=" + result.get(0) + "&type=" + result.get(1),
                                "BDA Visualization", "");
                    }

                });
            }
        }

    });

    cancelBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub
            DataTypeSelectPanel.this.hide();
        }

    });

    typeListBox.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            int index = typeListBox.getSelectedIndex();
            if (index != 0)
                dataset.setContenttype(typeListBox.getItemText(index));
            else
                dataset.setContenttype(null);
        }
    });
}

From source file:eml.studio.client.ui.panel.PreviewPopupPanel.java

License:Open Source License

/**
 * Control event binding//  w ww . j a  v a2  s.c  om
 * 
 * @param path  Result root address path
 */
public void bind(final String path) {
    uploadSubmitButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            Window.alert("Start calculating the file size");
            datasetSrv.getFileSize(path, new AsyncCallback<Double>() {

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub
                    logger.warning("Failed to get download file size!");
                }

                @Override
                public void onSuccess(Double size) {
                    // TODO Auto-generated method stub
                    if (size < MAX_DOWNLOAD_SIZE) {
                        Window.alert("Start downloading the file");
                        String url = GWT.getModuleBaseURL().split("EMLStudio")[0]
                                + "EMLStudioMonitor/filedownload?filename=" + sourceUrl;
                        Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");
                    } else
                        Window.alert("Download file over limit size (1g), can not download the file!");
                }

            });

        }
    });
    savebtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            final SaveDatasetPanel saveDatasetPanel = new SaveDatasetPanel(PreviewPopupPanel.this);
            saveDatasetPanel.setDataset(dataset);
            saveDatasetPanel.init();
            saveDatasetPanel.show();
            PreviewPopupPanel.this.hide();
            saveDatasetPanel.center();
        }
    });

    resultDirTree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        @Override
        public void onSelection(SelectionEvent<TreeItem> event) {
            // TODO Auto-generated method stub
            TreeItem item = event.getSelectedItem();
            if (item instanceof PopupRetDirLeaf) {
                PopupRetDirLeaf leaf = (PopupRetDirLeaf) item;
                fileLabel.setText(leaf.getText());
                PopupRetDirTreeLoad.wrapTreeNode(leaf);
                String filePath = leaf.getPath();
                //Only the root directory for data loading tips
                if (leaf.getName().equals(resultDirTree.getRoot().getName())
                        && leaf.getChildCount() == resultDirTree.getRoot().getChildCount())
                    fileTextArea.setText("The data is loading, please be patient ...");
                datasetSrv.previewFile(filePath, 100, new AsyncCallback<String>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub
                        logger.warning("File preview failed, the directory did not produce results!");
                    }

                    @Override
                    public void onSuccess(String result) {
                        // TODO Auto-generated method stub
                        fileTextArea.setText(result);
                    }
                });

                //The root directory does not file size statistics,
                // because of its slow statistics
                if (!(leaf.getName().equals(resultDirTree.getRoot().getName())
                        && leaf.getChildCount() == resultDirTree.getRoot().getChildCount())) {
                    datasetSrv.getFileSize(filePath, new AsyncCallback<Double>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            // TODO Auto-generated method stub
                            logger.warning("Failed to get file size!");
                        }

                        @Override
                        public void onSuccess(Double result) {
                            // TODO Auto-generated method stub
                            fileSizeLabel.setVisible(true);
                            fileSizeLabel.setText("TotalSize:" + result + "kb");
                        }
                    });
                } else {
                    fileSizeLabel.setVisible(false);
                }
            }
        }
    });

    refreshBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            fileLabel.setText("");
            fileSizeLabel.setText("");
            fileTextArea.setText("");
            resultDirTree.clear();
            PopupRetDirTreeLoad.reBuild(resultDirTree, path);
        }
    });

}

From source file:eml.studio.client.ui.widget.BaseWidgetMenuItemFactory.java

License:Open Source License

/**
 * Create DownloadDataItem/*from  w  w w  . j  a  v  a 2  s  .c  o  m*/
 * @param com
 * @return DownloadDataItem
 */
public static MenuItem createDownloadData(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {

            DatasetWidget widget = (DatasetWidget) this.component;
            widget.getContextMenu().hide();
            OutNodeShape shape = widget.getOutNodeShapes().get(0);
            String filename = shape.getAbsolutePath() + "/" + shape.getFileId();
            String url = GWT.getModuleBaseURL().split("EMLStudio")[0]
                    + "EMLStudioMonitor/filedownload?filename=" + filename;
            Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");

        }

    };

    MenuItem item = new MenuItem("Download", command);
    return item;
}