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.fao.fenix.web.modules.sldeditor.client.control.SLDEditorController.java

License:Open Source License

public static SelectionListener<ButtonEvent> createSLDRaster(final SLDEditorWindow w) {
    return new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            List<SLDEditorRuleVO> rules = collectRulesRaster(w);
            String sldName = w.getSldEditorPanel().getSldEditorName().getStyleNameField().getValue();
            String sldDescription = w.getSldEditorPanel().getSldEditorName().getDescriptionArea().getValue();
            if (isValid(w)) {
                final LoadingWindow l = new LoadingWindow("SLD Editor", "Creating the SLD File",
                        "Please wait...");
                try {
                    SLDEditorServiceEntry.getInstance().createSLDRaster(sldName, sldDescription, rules,
                            new AsyncCallback<String[]>() {
                                public void onSuccess(String[] sldInfo) {
                                    l.destroyLoadingBox();
                                    Window.open("../exportObject/" + sldInfo[0], "", "");
                                    SldEditorUtils.setSldNameFile(sldInfo[0]);
                                    SldEditorUtils.setSldPathFile(sldInfo[1]);
                                    l.destroyLoadingBox();
                                }//from   w ww  . jav  a2s.  c  o  m

                                public void onFailure(Throwable e) {
                                    l.destroyLoadingBox();
                                    FenixAlert.error("ERROR", e.getMessage());
                                    l.destroyLoadingBox();
                                }
                            });
                } catch (FenixGWTException e) {
                    FenixAlert.error("ERROR", e.getMessage());
                }
            } else {
                FenixAlert.info("INFO", "Please check your parameters.");
            }
        }
    };
}

From source file:org.fornax.cartridges.sculptor.smartclient.client.Main.java

License:Apache License

private Canvas getMainPanel() {
    HeaderItem header = new HeaderItem();
    header.setDefaultValue("Detail");

    RecordClickHandler recordClickHandler = new GridClickHandler(this);

    emptyDS.addField(new DataSourceTextField("empty", "Empty"));
    emptyDS.setClientOnly(true);/*from  w  w w. j  a v a 2 s . c om*/

    treeGrid.setWidth100();
    treeGrid.setHeight100();
    treeGrid.setShowAllRecords(false);
    // treeGrid.setAutoFetchData(true);
    treeGrid.setLoadDataOnDemand(true);
    treeGrid.setShowOpenIcons(false);
    treeGrid.setShowDropIcons(false);
    treeGrid.setClosedIconSuffix("");
    treeGrid.setFolderIcon("16/house.png");
    treeGrid.setNodeIcon("16/person.png");
    treeGrid.setDataPageSize(30);
    treeGrid.setAlternateRecordStyles(true);
    treeGrid.setID("mainListGridTree");
    treeGrid.addRecordClickHandler(recordClickHandler);
    treeGrid.setCanAddFormulaFields(true);
    treeGrid.setCanAddSummaryFields(true);
    treeGrid.setShowFilterEditor(true);
    treeGrid.setSelectionType(SelectionStyle.SIMPLE);
    treeGrid.setDataSource(emptyDS);
    treeGrid.hide();

    listGrid.setWidth100();
    listGrid.setHeight100();
    listGrid.setShowAllRecords(false);
    // listGrid.setAutoFetchData(true);
    listGrid.setDataPageSize(30);
    listGrid.setAlternateRecordStyles(true);
    listGrid.setID("mainListGrid");
    listGrid.addRecordClickHandler(recordClickHandler);
    listGrid.setShowDetailFields(false);
    listGrid.setShowFilterEditor(true);
    listGrid.setCanAddFormulaFields(true);
    listGrid.setCanAddSummaryFields(true);
    listGrid.setSelectionType(SelectionStyle.SIMPLE);
    listGrid.setDataSource(emptyDS);
    actualGrid = listGrid;

    MenuItem saveStatus = new MenuItem("Save status");
    saveStatus.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            try {
                String viewState = actualGrid.getFieldState();

                HashMap<String, String> params = new HashMap<String, String>();
                params.put("_dataSource", "listSettingsService");
                params.put("_operationType", "add");
                params.put("listID", actualGrid.getDataSource().getID());
                params.put("settings", viewState);
                params.put("userName", userInfo.getUsername());

                DSRequest reqProperties = new DSRequest();
                reqProperties.setShowPrompt(true);
                reqProperties.setPrompt("Saving status");
                reqProperties.setActionURL(serviceUrl);
                reqProperties.setParams(params);
                GuiUtil.RPCManagerSend(null, new DSCallback() {
                    public void execute(DSResponse response, Object rawData, DSRequest request) {
                        // SC.say("RESPONSE "+response.getStatus());
                    }
                }, reqProperties);
            } catch (Exception ex) {
                GWT.log("error!!!", ex);
            }
        }
    });
    MenuItem refetchData = new MenuItem("Refetch data");
    refetchData.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            try {
                actualGrid.invalidateCache();
            } catch (Exception ex) {
                GWT.log("error!!!", ex);
            }
        }
    });

    MenuItem exportData = new MenuItem("Export");
    exportData.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            try {
                Window.open(serviceUrl + "?_dataSource=" + actualGrid.getDataSource().getID()
                        + "&_operationType=export", "upload", "");
            } catch (Exception ex) {
                GWT.log("error!!!", ex);
            }
        }
    });

    MenuItem importData = new MenuItem("Import");
    importData.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
        public void onClick(MenuItemClickEvent event) {
            try {
            } catch (Exception ex) {
                GWT.log("error!!!", ex);
            }
        }
    });

    MenuItemSeparator menuSeparator = new MenuItemSeparator();
    contextMenu.setData(saveStatus, refetchData, menuSeparator, exportData, importData);
    listGrid.setContextMenu(contextMenu);
    treeGrid.setContextMenu(contextMenu);

    /*
    Canvas topList=new Canvas();
    topList.setShowResizeBar(true);
    topList.addChild(listGrid); //.addChild(treeGrid);
    topList.setWidth100();
    topList.setHeight100();
    */
    Canvas gridContainer = new Canvas();
    gridContainer.setWidth100();
    gridContainer.setHeight100();
    gridContainer.addChild(listGrid);
    gridContainer.addChild(treeGrid);
    listPart.setWidth100();
    listPart.setHeight100();
    listPart.addMember(gridContainer);
    listPart.setShowResizeBar(true);

    detail.addMember(listPart);
    detail.addMember(mainForm);

    return detail;
}

From source file:org.freemedsoftware.gwt.client.screen.patient.PatientReportingScreen.java

License:Open Source License

protected void runReport(ReportType reportType) {
    // Get report type
    String type = null;/*ww w .j  av  a 2 s.  c  o m*/
    switch (reportType) {
    case PDF:
        type = "pdf";
        break;
    case HTML:
        type = "html";
        break;
    case XLS:
        type = "xls";
        break;
    case XML:
        type = "xml";
        break;
    case TEXT:
    default:
        type = "text";
        break;
    }

    // Open window for request
    Window.open(Util.getJsonRequest("org.freemedsoftware.module.PatientReporting.GenerateReport",
            new String[] { thisReportUUID, type, JsonUtil.jsonify(getParameters()) }), "Report", "");
}

From source file:org.freemedsoftware.gwt.client.screen.ReportingScreen.java

License:Open Source License

protected void runReport(ReportType reportType) {
    // Get report type
    String type = null;/*from  ww w .  j a v  a2  s  . c  o m*/
    switch (reportType) {
    case PDF:
        type = "pdf";
        break;
    case HTML:
        type = "html";
        break;
    case XLS:
        type = "xls";
        break;
    case XML:
        type = "xml";
        break;
    case TEXT:
    default:
        type = "text";
        break;
    }

    // Open window for request
    Window.open(Util.getJsonRequest("org.freemedsoftware.module.Reporting.GenerateReport",
            new String[] { thisReportUUID, type, JsonUtil.jsonify(getParameters()) }), "Report", "");
}

From source file:org.freemedsoftware.gwt.client.Util.java

License:Open Source License

/**
 * Generates Report To Browser//from   w  w  w.ja  va  2  s  . c  o  m
 * 
 * @param reportName
 *            - Report name (stored in reporting table)
 * 
 * @param format
 *            - format (pdf,html etc)
 * 
 * @param reportParams
 *            - list of parameters of any type or multi-type
 * 
 */

@SuppressWarnings({ "rawtypes", "unchecked" })
public static void generateReportToBrowser(final String reportName, final String format,
        final List<String> reportParams) {
    List paramsList = new ArrayList();
    paramsList.add(reportName);
    callModuleMethod("Reporting", "GetReport", paramsList, new CustomRequestCallback() {

        @Override
        public void onError() {

        }

        @Override
        public void jsonifiedData(Object data) {
            if (data != null) {

                Window.open(
                        Util.getJsonRequest("org.freemedsoftware.module.Reporting.GenerateReport",
                                new String[] { data.toString(), format,
                                        JsonUtil.jsonify(reportParams.toArray(new String[0])) }),
                        reportName, "");
            } else {
                showErrorMsg(ReportingScreen.moduleName, _("Report not found."));
            }
        }

    }, "String");

}

From source file:org.freemedsoftware.gwt.client.widget.DjvuViewer.java

License:Open Source License

/**
 * Open up full page view./*from   w w w  . j  av a 2s.c  om*/
 */
public void viewDocument() {
    String[] params = { (String) internalId.toString(), new Integer(currentPage).toString() };
    Window.open(Util.getJsonRequest(resolvePageViewMethod(), params), _("View"), "");
}

From source file:org.freemedsoftware.gwt.client.widget.EmrPrintDialog.java

License:Open Source License

public int printToBrowser() {
    List<String> args = new ArrayList<String>();
    JSONArray a = new JSONArray();
    for (int iter = 0; iter < items.length; iter++) {
        a.set(iter, new JSONNumber(items[iter]));
    }//from   w  w  w  .  jav a2s  . com
    args.add(a.toString());
    String url = Util.getJsonRequest("org.freemedsoftware.api.ModuleInterface.PrintToBrowser",
            args.toArray(new String[0]));
    Window.open(url, "", "");
    closeDialog();
    return 0;
}

From source file:org.freemedsoftware.gwt.client.widget.RemittBillingWidget.java

License:Open Source License

public void getFile(final String name) {
    String[] params = { "output", name, "html" };
    Window.open(URL.encode(Util.getJsonRequest("org.freemedsoftware.api.Remitt.GetFile", params)), name, "");

}

From source file:org.freemedsoftware.gwt.client.widget.RemittReportsWidget.java

License:Open Source License

public void loadMonthsInfo() {
    allReportTable = new FlexTable();
    allReportTable.setWidth("80%");
    reportsPanel.clear();//w  w w . j a va2s .  c om
    reportsPanel.add(allReportTable);
    Util.callModuleMethod("RemittBillingTransport", "getMonthsInfo", (Integer) null,
            new CustomRequestCallback() {
                @Override
                public void onError() {
                }

                @SuppressWarnings("unchecked")
                @Override
                public void jsonifiedData(Object data) {
                    if (data != null) {
                        final HashMap<String, String>[] result = (HashMap[]) data;
                        for (int i = 0; i < result.length; i++) {
                            int row = i / 2;
                            int col = i % 2;
                            VerticalPanel reportPanel = new VerticalPanel();
                            reportPanel.setSpacing(10);
                            reportPanel.setWidth("70%");
                            HorizontalPanel hpanel = new HorizontalPanel();
                            hpanel.setSpacing(5);
                            final Label expandLb = new Label("+");
                            final CustomTable reportsInfoTable = new CustomTable();
                            reportsInfoTable.setAllowSelection(false);
                            reportsInfoTable.setWidth("100%");
                            reportsInfoTable.addColumn(_("Report"), "filename");
                            reportsInfoTable.addColumn(_("Size"), "filesize");
                            reportsInfoTable.addColumn(_("Date Sent"), "inserted");
                            reportsInfoTable.addColumn(_("Action"), "action");
                            reportsInfoTable
                                    .setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() {
                                        @Override
                                        public Widget setColumn(String columnName,
                                                final HashMap<String, String> data) {
                                            if (columnName.compareTo("action") == 0) {

                                                HorizontalPanel actionPanel = new HorizontalPanel();
                                                actionPanel.setSpacing(5);
                                                HTML htmlLedger = new HTML("<a href=\"javascript:undefined;\">"
                                                        + _("View") + "</a>");

                                                htmlLedger.addClickHandler(new ClickHandler() {
                                                    @Override
                                                    public void onClick(ClickEvent arg0) {

                                                        String[] params = { "output", data.get("filename"),
                                                                "html" };
                                                        Window.open(URL.encode(Util.getJsonRequest(
                                                                "org.freemedsoftware.api.Remitt.GetFile",
                                                                params)), data.get("filename"), "");

                                                    }

                                                });
                                                HTML htmlReSend = null;
                                                if (data.get("originalId") != null) {
                                                    htmlReSend = new HTML("<a href=\"javascript:undefined;\">"
                                                            + _("Re-Send") + "</a>");

                                                    htmlReSend.addClickHandler(new ClickHandler() {
                                                        @Override
                                                        public void onClick(ClickEvent arg0) {

                                                            CustomRequestCallback cb = new CustomRequestCallback() {
                                                                @Override
                                                                public void onError() {

                                                                }

                                                                @Override
                                                                public void jsonifiedData(Object data) {
                                                                    rebillPanel.setVisible(false);
                                                                    reportsPanel.setVisible(true);
                                                                    loadMonthsInfo();

                                                                }
                                                            };
                                                            reportsPanel.setVisible(false);
                                                            rebillPanel.clear();

                                                            HashSet<String> hs = new HashSet<String>();
                                                            hs.add(data.get("originalId"));
                                                            RemittBillingWidget billClaimsWidget = new RemittBillingWidget(
                                                                    hs, cb, BillingType.REBILL);
                                                            rebillPanel.add(billClaimsWidget);
                                                            rebillPanel.setVisible(true);

                                                        }

                                                    });
                                                } else {
                                                    htmlReSend = new HTML(
                                                            "<a href=\"javascript:undefined;\"  style=\"cursor:default;color: blue;\">"
                                                                    + _("Re-Send") + "</a>");
                                                }
                                                actionPanel.add(htmlLedger);
                                                actionPanel.add(htmlReSend);
                                                return actionPanel;
                                            } else if (columnName.compareTo("inserted") == 0) {
                                                Label lb = new Label(data.get("inserted").substring(0, 10));
                                                return lb;
                                            } else {
                                                return (Widget) null;
                                            }

                                        }
                                    });
                            reportsInfoTable.setVisible(false);
                            expandLb.getElement().getStyle().setCursor(Cursor.POINTER);
                            final int index = i;
                            expandLb.addClickHandler(new ClickHandler() {

                                @Override
                                public void onClick(ClickEvent arg0) {
                                    if (expandLb.getText().trim().equals("+")) {
                                        expandLb.setText("-");
                                        reportsInfoTable.setVisible(true);
                                        loadReportsDetails(result[index].get("month"), reportsInfoTable);
                                    } else {
                                        expandLb.setText("+");
                                        reportsInfoTable.setVisible(false);
                                    }
                                }

                            });
                            hpanel.setWidth("100%");
                            hpanel.setStyleName(AppConstants.STYLE_TABLE_HEADER);
                            Label infoLb = new Label(result[i].get("month"));
                            hpanel.add(expandLb);
                            hpanel.add(infoLb);
                            hpanel.setCellWidth(expandLb, "5px");

                            reportPanel.add(hpanel);
                            reportPanel.add(reportsInfoTable);
                            allReportTable.setWidget(row, col, reportPanel);
                            allReportTable.getFlexCellFormatter().setVerticalAlignment(row, col,
                                    HasVerticalAlignment.ALIGN_TOP);
                            // panel.add();
                            // panel.add(reportsInfoTable);

                        }
                    }
                }
            }, "HashMap<String,String>[]");
}

From source file:org.geomajas.gwt2.plugin.print.client.event.DefaultPrintRequestHandler.java

License:Open Source License

@Override
public void onPrintRequestFinished(PrintRequestFinishedEvent event) {
    PrintFinishedInfo info = event.getPrintFinishedInfo();
    if (info.getMethod() == HttpMethod.GET) {
        switch (info.getPostPrintAction()) {
        case SAVE:
            createHiddenFrame(info);//  w  ww  .  j  a  va2  s.  c om
            break;
        case OPEN:
        default:
            UrlBuilder builder = new UrlBuilder(info.getUrl());
            for (String name : info.getParams().keySet()) {
                builder.addParameter(name, info.getParams().get(name));
            }
            Window.open(builder.toString(), "_blank", null);
            break;
        }
    } else {
        createHiddenForm(info);
    }
}