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:fr.insalyon.creatis.vip.datamanager.client.view.operation.OperationBoxLayout.java

License:Open Source License

/**
 * Downloads a file (for download operations).
 *//* w  ww  . j  a v  a 2  s  .co m*/
private void download() {

    Window.open(GWT.getModuleBaseURL() + "/filedownloadservice?operationid=" + operation.getId(), "", "");
}

From source file:fr.insalyon.creatis.vip.query.client.view.monitor.QueryHistoryTab.java

License:Open Source License

private void configureGrid() {

    grid = new ListGrid() {
        @Override//from w  w  w.j  av a 2  s .c o  m
        protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {

            String fieldName = this.getFieldName(colNum);
            ImgButton button = null;

            if (fieldName.equals("buttonField")) {
                button = new ImgButton();
                button.setShowDown(false);
                button.setShowRollOver(false);
                button.setAlign(Alignment.CENTER);
                button.setHeight(16);
                button.setWidth(16);

                if (record.getAttribute("status") == Status.completed.toString()) {

                    button.setSrc(QueryConstants.ICON_LINK);
                    button.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {

                            Window.open(GWT.getModuleBaseURL() + "/filedownload?queryid="
                                    + record.getAttribute("queryExecutionID").toString() + "&path="
                                    + record.getAttribute("pathFileResult") + "&name="
                                    + record.getAttribute("name").toString(), "", "");
                        }
                    });
                } else if (record.getAttribute("status") == Status.failed.toString()) {
                    button.setSrc(QueryConstants.ICON_ERROR);

                    button.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            String error = record.getAttribute("pathFileResult");
                            if (error.length() < 70) {
                                SC.say("Error", error);
                            } else {
                                String[] words = error.toString().split(" ");
                                int length = words.length;
                                int max = 70;
                                String msg = new String();
                                for (String s : words) {
                                    int l = msg.length() + s.length() + 1;
                                    if (l > max) {
                                        msg += "<br>";
                                        max += 70;
                                        msg += s + " ";
                                    } else {
                                        msg += s + " ";
                                    }

                                }

                                /*
                                int i = 0;
                                String message = new String();
                                while (i < n.length()) {
                                if ((i + 65) > n.length()) {
                                    int k = n.length() - i;
                                    message += n.substring(i, k);
                                } else {
                                    message += n.substring(i, i + 65) + "<br>";
                                }
                                i += 65;
                                        
                                }
                                * */

                                SC.say("Error", msg);

                            }
                        }
                    });
                }
            }
            if (record.getAttribute("status") == Status.completed.toString()
                    || record.getAttribute("status") == Status.failed.toString()) {
                return button;
            } else {
                return null;
            }
        }

        ;

        //canvas de type detailViewer 
        @Override
        protected Canvas getCellHoverComponent(Record record, Integer rowNum, Integer colNum) {

            rollOverRecord = this.getRecord(rowNum);
            detailViewer = new DetailViewer();
            detailViewer.setWidth(200);
            DetailViewerField name = new DetailViewerField("name", "name");
            DetailViewerField type = new DetailViewerField("value", "value");
            detailViewer.setFields(name, type);

            dataList = new ArrayList<ParameterValue>();
            Long executionID = record.getAttributeAsLong("queryExecutionID");
            //appel rpc
            final AsyncCallback<List<String[]>> callback = new AsyncCallback<List<String[]>>() {
                @Override
                public void onFailure(Throwable caught) {
                    Layout.getInstance()
                            .setWarningMessage("Unable to save Query Execution " + caught.getMessage());
                }

                @Override
                public void onSuccess(List<String[]> result) {
                    for (String[] s : result) {
                        dataList.add(new ParameterValue(s[0], s[1]));
                    }
                    if (dataList.isEmpty()) {
                        detailViewer.setVisible(false);
                    } else {
                        detailViewer.setData(dataList.toArray(new ParameterValue[] {}));
                        detailViewer.setBackgroundColor("white");
                        detailViewer.setBorder("1px solid gray");
                        detailViewer.setAutoFetchData(true);
                    }

                }
            };
            QueryService.Util.getInstance().getParameterValue(executionID, callback);
            return detailViewer;
        };
    };

    grid.addRowContextClickHandler(new RowContextClickHandler() {
        public void onRowContextClick(RowContextClickEvent event) {
            ListGridRecord record = event.getRecord();
            if (record.getAttribute("status") == Status.failed.toString()) {
                Menu menu = new Menu();
                final String queryExecutionID = record.getAttribute("queryExecutionID");

                MenuItem relaunch = new MenuItem("Relauch", QueryConstants.ICON_EXECUTE);

                relaunch.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
                    public void onClick(MenuItemClickEvent event) {

                        final AsyncCallback<Void> callback = new AsyncCallback<Void>() {
                            @Override
                            public void onFailure(Throwable caught) {

                                Layout.getInstance().setWarningMessage(
                                        "Unable to relaunch this query" + caught.getMessage());
                            }

                            @Override
                            public void onSuccess(Void result) {
                            }
                        };
                        QueryService.Util.getInstance().updateQueryExecutionStatusWaiting(
                                Status.waiting.toString(), Long.parseLong(queryExecutionID), callback);

                    }
                });
                menu.addItem(relaunch);

                grid.setContextMenu(menu);
            } else if (record.getAttribute("status") == Status.waiting.toString()
                    || record.getAttribute("status") == Status.running.toString()) {

                Menu menu = new Menu();
                final String queryExecutionID = record.getAttribute("queryExecutionID");
                MenuItem kill = new MenuItem("kill", QueryConstants.ICON_KILL);

                kill.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
                    public void onClick(MenuItemClickEvent event) {

                        final AsyncCallback<Void> callback = new AsyncCallback<Void>() {
                            @Override
                            public void onFailure(Throwable caught) {

                                Layout.getInstance().setWarningMessage(
                                        "Unable to relaunch this query" + caught.getMessage());
                            }

                            @Override
                            public void onSuccess(Void result) {
                            }
                        };
                        QueryService.Util.getInstance().updateQueryExecutionStatusFailed(
                                Status.failed.toString(), Long.parseLong(queryExecutionID), callback);

                    }
                });
                menu.addItem(kill);
                grid.setContextMenu(menu);
            } else {
                Menu menu = new Menu();
                menu = null;
                grid.setContextMenu(menu);
            }
        }
    });

    ds = new Data();
    grid.setCanHover(true);
    grid.setShowHover(true);
    grid.setShowHoverComponents(true);
    grid.setWidth100();
    grid.setHeight100();
    grid.setShowRecordComponents(true);
    grid.setShowRecordComponentsByCell(true);
    grid.setFilterOnKeypress(true);
    grid.setDataSource(ds);
    grid.setAutoFetchData(Boolean.TRUE);
    grid.setShowAllRecords(false);
    grid.setShowRowNumbers(true);
    grid.setShowEmptyMessage(true);
    grid.setSelectionType(SelectionStyle.SIMPLE);
    grid.setSelectionAppearance(SelectionAppearance.CHECKBOX);
    grid.setEmptyMessage("<br>No data available");

    ListGridField executionID = new ListGridField("queryExecutionID", "queryExecutionID");
    ListGridField pathFileResult = new ListGridField("pathFileResult", "pathFileResult");
    ListGridField version = new ListGridField("version", "Version");
    version.setWidth(60);
    ListGridField statuss = new ListGridField("status", "Status");
    statuss.setWidth(60);

    ListGridField statusFormatter = new ListGridField("statusFormatter", "Status");
    statusFormatter.setWidth(60);

    ListGridField date = new ListGridField("dateExecution", "Execution Start Time");
    date.setWidth(150);

    ListGridField dateEndExecution = new ListGridField("dateEndExecution", "Execution End Time");
    dateEndExecution.setWidth(150);

    ListGridField buttonField = new ListGridField("buttonField", "Result");
    buttonField.setAlign(Alignment.CENTER);
    buttonField.setWidth(60);
    grid.setFields(FieldUtil.getIconGridField("statusIcon"), executionID,
            new ListGridField("name", "Query Execution Name"), statusFormatter,
            new ListGridField("query", "Query"), date, version, new ListGridField("executer", "User"),
            dateEndExecution, statuss, buttonField, pathFileResult);
    executionID.setHidden(true);
    pathFileResult.setHidden(true);
    statuss.setHidden(true);
}

From source file:fr.putnami.pwt.doc.client.application.NewsPopup.java

License:Open Source License

@UiHandler("seeMoreBtn")
void onSeeMoreClick(ButtonEvent event) {
    RssItem item = event.getValue();// w w w  .jav  a  2  s  .  co m
    getGA().trackEvent("read", "news" + item.getGuid());
    String link = item.getLink();
    if (link.startsWith("#!")) {
        History.newItem(link.substring(1));
    } else {
        Window.open(link, "_blank", "");
    }
}

From source file:fr.putnami.pwt.doc.client.social.base.AbstractSocialButton.java

License:Open Source License

protected void socialize() {
    String url = this.buildSocialUrl();
    Window.open(url, "", this.buildPopupFeature());
}

From source file:geogebra.web.gui.dialog.ToolManagerDialogW.java

License:Open Source License

private void openTools() {
    App.debug("before" + app.hashCode());
    app.setWaitCursor();/* www. j av a2  s  .co m*/
    // for (Macro macro : toolList.getSelectedMacros()) {
    app.storeMacro(toolList.getSelectedMacro(), false);
    Window.open(Window.Location.getHref(), "", "");

    app.setDefaultCursor();
    hide();
}

From source file:geogebra.web.gui.menubar.HelpMenuW.java

public HelpMenuW(final App app) {

    super(true);// ww  w.  j a  v a  2 s.  com
    this.app = app;
    addStyleName("GeoGebraMenuBar");

    // TODO: This item has no localization entry yet.
    //addItem("Version", new Command() {
    //   public void execute() {
    //        Window.alert("GeoGebra " + GeoGebraConstants.VERSION_STRING + "\n"
    //              + GeoGebraConstants.BUILD_DATE);       
    //    }
    //});
    // Tutorials
    tutorials = addItem(MainMenu.getMenuBarHtml(AppResources.INSTANCE.empty().getSafeUri().asString(),
            app.getMenu("Tutorials"), true), true, new MenuCommand((AppW) app) {

                @Override
                public void doExecute() {
                    app.getGuiManager().openHelp(App.WIKI_TUTORIAL);
                }
            });

    // Help
    manual = addItem(MainMenu.getMenuBarHtml(GuiResources.INSTANCE.menu_icon_help().getSafeUri().asString(),
            app.getMenu("Manual"), true), true, new MenuCommand((AppW) app) {

                @Override
                public void doExecute() {
                    app.getGuiManager().openHelp(App.WIKI_MANUAL);

                }
            });

    forum = addItem(MainMenu.getMenuBarHtml(AppResources.INSTANCE.empty().getSafeUri().asString(),
            app.getMenu("GeoGebraForum"), true), true, new MenuCommand((AppW) app) {

                @Override
                public void doExecute() {
                    app.getGuiManager().openHelp(GeoGebraConstants.FORUM_URL);

                }
            });

    addSeparator();

    // Report Bug
    bug = addItem(MainMenu.getMenuBarHtml(AppResources.INSTANCE.empty().getSafeUri().asString(),
            app.getMenu("ReportBug"), true), true, new MenuCommand((AppW) app) {

                @Override
                public void doExecute() {
                    Window.open(GeoGebraConstants.GEOGEBRA_REPORT_BUG_WEB + "&lang="
                            + app.getLocalization().getLanguage(), "_blank", "");
                }
            });

    addSeparator();

    about = addItem(
            MainMenu.getMenuBarHtml(GuiResources.INSTANCE.menu_icon_help_about().getSafeUri().asString(),
                    app.getMenu("AboutLicense"), true),
            true, new MenuCommand((AppW) app) {

                @Override
                public void doExecute() {
                    Window.open(GeoGebraConstants.GGW_ABOUT_LICENSE_URL + "&version="
                            + GeoGebraConstants.VERSION_STRING + "&date=" + GeoGebraConstants.BUILD_DATE,
                            "_blank",
                            "width=720,height=600,scrollbars=yes,toolbar=no,location=no,directories=no,menubar=no,status=no,copyhistory=no");
                }
            });
    if (!((AppW) app).getNetworkOperation().isOnline()) {
        render(false);
    }
    ((AppW) app).getNetworkOperation().getView().add(this);
    // TODO: This item has no localization entry yet.
    //addItem("About / Team", new Command() {
    //   public void execute() {
    //       Window.open(GeoGebraConstants.GGW_ABOUT_TEAM_URL, "_blank", "");
    //    }
    //});
}

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.results.ModeController.java

public void writeExportData() {
    String filename = getExportFileName();

    AsyncCallback<String> exportAsyncCallback = new AsyncCallback<String>() {
        public void onFailure(Throwable caught) {
            filterPanel.showError(caught.getMessage(), true);
            caught.printStackTrace();//w  w w. ja  v a 2  s.  com
        }

        public void onSuccess(String exportFileName) {
            if (exportFileName != null) {
                ModeController.this.exportFileName = exportFileName;
            }
        }
    };
    searchService.exportResultsData(getListBy(), filename, exportAsyncCallback);
    String linkStr = getExportLink(filename);
    Window.open(linkStr, "The_Cancer_Genome_Atlas_Data_Portal",
            "menubar=yes,toolbar=yes,location=yes,status=no,resizable=yes,scrollbars=yes");
}

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.results.ModeController.java

public void writePivotExportData(Results pivotResults) {
    String filename = getExportFileName();

    AsyncCallback<String> exportAsyncCallback = new AsyncCallback<String>() {
        public void onFailure(Throwable caught) {
            filterPanel.showError(caught.getMessage(), true);
            caught.printStackTrace();/*from   ww w . ja v  a  2 s .c om*/
        }

        public void onSuccess(String exportFileName) {
            if (exportFileName != null) {
                ModeController.this.exportFileName = exportFileName;
            }
        }
    };
    searchService.exportPivotResultsData(pivotResults.getListBy(), filename, pivotResults, exportAsyncCallback);
    String linkStr = getExportLink(filename);
    Window.open(linkStr, "The_Cancer_Genome_Atlas_Data_Portal",
            "menubar=yes,toolbar=yes,location=yes,status=no,resizable=yes,scrollbars=yes");
}

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.util.HelpHelper.java

private void openOnlineHelp() {
    if (onlineHelpUrl != null) {
        Window.open(onlineHelpUrl, "Data_Browser_Online_Help",
                "menubar=no,toolbar=no,location=no,directories=no,personalbar=no,status=no,resizable=yes,scrollbars=yes,dependent=yes");
    }//from w  w  w.j a va 2s.c  om
}

From source file:gov.nih.nci.ncicb.tcgaportal.level4.gwt.anomalysearch.client.util.HelpHelper.java

private void openUserGuide() {
    if (userGuideUrl != null) {
        Window.open(userGuideUrl, "Data_Browser_User_Guide",
                "menubar=no,toolbar=no,location=no,directories=no,personalbar=no,status=no,resizable=yes,scrollbars=yes,dependent=yes");
    }// w w  w.  j  a  v a  2  s  .c  o m
}