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.eurekastreams.web.client.ui.pages.master.ConnectEntryPoint.java

License:Apache License

/**
 * Module load./*from w w w  . j  ava 2s.  co  m*/
 */
public void onModuleLoad() {
    // The entry point will be invoked on full-app startup, so do nothing if the appropriate widget element is not
    // found
    rootPanel = RootPanel.get(WIDGET_ELEMENT_ID);
    if (rootPanel == null) {
        return;
    }
    rootPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectWidgetRoot());

    StaticResourceBundle.INSTANCE.coreCss().ensureInjected();
    StaticResourceBundle.INSTANCE.yuiCss().ensureInjected();

    ActionRPCServiceAsync service = (ActionRPCServiceAsync) GWT.create(ActionRPCService.class);
    ((ServiceDefTarget) service).setServiceEntryPoint("/gwt_rpc");
    processor = new ActionProcessorImpl(service, new AsyncCallback<String>() {
        public void onSuccess(final String inResult) {
        }

        public void onFailure(final Throwable caught) {
            onSessionInitFailure(caught);
        }
    });

    session.setActionProcessor(processor);
    session.setEventBus(EventBus.getInstance());

    processor.makeRequest("getPersonModelViewForStartup", null, new AsyncCallback<PersonModelView>() {
        public void onFailure(final Throwable caught) {
            onPersonFetchFailure(caught);
        }

        public void onSuccess(final PersonModelView person) {
            session.setCurrentPerson(person);
            session.setCurrentPersonRoles(person.getRoles());
            session.setHistoryHandler(new HistoryHandler());

            determineLaunchPage();

            // catch attempts to go to profile pages and pop them up in a new window
            final EventBus eventBus = Session.getInstance().getEventBus();
            eventBus.addObserver(SwitchedHistoryViewEvent.class, new Observer<SwitchedHistoryViewEvent>() {
                public void update(final SwitchedHistoryViewEvent ev) {
                    switch (ev.getPage()) {
                    case ACTIVITY:
                    case PEOPLE:
                    case PEOPLE_LEGACY:
                    case GROUPS:
                    case GROUPS_LEGACY:
                    case DISCOVER:
                        String url = mainAppLaunchUrl + Window.Location.getHash();
                        Window.open(url, "_blank", "");
                        History.back();
                        break;
                    default:
                        break;
                    }
                }
            });

            recordStreamViewMetrics();

            Session.getInstance().getEventBus().bufferObservers();

            buildPage();
        }
    });
}

From source file:org.fao.fenix.web.modules.latex.client.control.LatexController.java

License:Open Source License

public static SelectionListener<IconButtonEvent> exportPDF(final LatexWindow w) {
    return new SelectionListener<IconButtonEvent>() {
        public void componentSelected(IconButtonEvent ce) {
            String latexAreaContent = w.getLatexArea().getHTML();
            System.out.println("\n" + latexAreaContent + "\n");
            final LoadingWindow loading = new LoadingWindow("LaTeX Report",
                    "TeX Server is processing your report.", "Please Wait...");
            try {
                LatexServiceEntry.getInstance().exportPDF(latexAreaContent, new AsyncCallback<String>() {
                    public void onSuccess(String report) {
                        loading.destroyLoadingBox();
                        System.out.println("REPORT @ " + report);
                        int separatorIDX = 1 + report.lastIndexOf("/");
                        report = report.substring(separatorIDX);
                        Window.open("../exportObject/" + report, "_blank", "status=no");
                        loading.destroyLoadingBox();
                    }//from   ww  w  .  j a va2  s.  c om

                    public void onFailure(Throwable e) {
                        loading.destroyLoadingBox();
                        FenixAlert.error("ERROR", e.getMessage());
                        loading.destroyLoadingBox();
                    }
                });
            } catch (FenixGWTException e) {
                loading.destroyLoadingBox();
                FenixAlert.error("ERROR", e.getMessage());
                loading.destroyLoadingBox();
            }
        }
    };
}

From source file:org.fao.fenix.web.modules.map.client.control.LayerMenuController.java

License:Open Source License

public static SelectionListener<MenuEvent> exportKML(final ListView list) {
    return new SelectionListener<MenuEvent>() {
        public void componentSelected(MenuEvent me) {
            LayerItem li = (LayerItem) list.getSelectionModel().getSelectedItem();

            String url = li.getWMSUrl();
            url = url.substring(0, url.indexOf("/wms"));
            url = url + "/wms/kml_reflect?layers=" + li.getLayerName();

            Window.open(url, "_blank", "");
        }/* w  ww  . j  a  v  a  2s .c  om*/
    };
}

From source file:org.fao.fenix.web.modules.metadataeditor.client.control.MEController.java

License:Open Source License

public static SelectionListener<ButtonEvent> getXml(final METabPanel tabPanel) {
    return new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            //            if (tabPanel.getKeysPanel().validate() || tabPanel.getDatasetTypePanel().validate() && tabPanel.getGeneralInfoPanel().validate() && tabPanel.getColumnDefinitionPanel().validate()) {
            try {
                if (tabPanel.getMetadataPanel().validate()
                        || tabPanel.getDatasetTypePanel().validate() && tabPanel.getMetadataPanel().validate()
                                && tabPanel.getColumnDefinitionPanel().validate()) {
                    //               ResourceVO vo = createResourceVO(tabPanel.getGeneralInfoPanel(), tabPanel.getKeysPanel());
                    ResourceVO vo = createResourceVO(tabPanel.getMetadataPanel(), tabPanel.getExtraInfoPanel());
                    DatasetTypeVO dtvo = createDatasetTypeVo(tabPanel);
                    MetadataServiceEntry.getInstance().createMetadataFile(vo, dtvo,
                            new AsyncCallback<String>() {
                                public void onSuccess(String result) {
                                    Window.open("../exportObject/" + result, "_blank", "status=no");
                                }//  w ww .  j  ava 2 s.co m

                                public void onFailure(Throwable caught) {
                                    FenixAlert.error(BabelFish.print().info(), caught.getMessage());
                                }
                            });
                } else {
                    FenixAlert.alert(BabelFish.print().info(), BabelFish.print().fillMandatoryFields());
                }
            } catch (FenixGWTException e) {
                FenixAlert.info(BabelFish.print().info(), e.getMessage());
            }
        }
    };
}

From source file:org.fao.fenix.web.modules.ofcchart.client.control.OfcChartController.java

License:Open Source License

public static SelectionListener<IconButtonEvent> save(final ContentPanel chartPanel) {
    return new SelectionListener<IconButtonEvent>() {
        @SuppressWarnings({ "deprecation", "unchecked" })
        public void componentSelected(IconButtonEvent ce) {
            for (int i = 0; i < chartPanel.getItemCount(); i++) {
                System.out.println("-: " + chartPanel.getWidget(i).toString());
                ChartWidget chart = new ChartWidget();
                ContentPanel v = (ContentPanel) chartPanel.getWidget(i);
                chart = (ChartWidget) v.getWidget(0);
                String image = chart.getImageData();
                OfcChartServiceEntry.getInstance().saveChart(image, new AsyncCallback<String>() {
                    public void onSuccess(String chartFile) {
                        Window.open("../exportObject/" + chartFile, "", "");
                    }/*from  ww w .j a va2s  .c  o m*/

                    public void onFailure(Throwable e) {
                        FenixAlert.error(BabelFish.print().info(), e.getMessage());
                    }
                });
            }

        }
    };
}

From source file:org.fao.fenix.web.modules.olap.client.control.OlapController.java

License:Open Source License

public static SelectionListener<IconButtonEvent> openInProjectManager(final OlapWindow window) {
    return new SelectionListener<IconButtonEvent>() {
        public void componentSelected(IconButtonEvent ce) {
            ListBox dataSource = window.getTabPanel().getSingleDatasetPanel().getDataSource();
            String datasetId = dataSource.getValue(dataSource.getSelectedIndex());
            String hostPageURL = GWT.getHostPageBaseURL();
            int index = hostPageURL.indexOf("fenix-web") + "fenix-web".length();
            String url = hostPageURL.substring(0, index) + "/fenix/Fenix.html?openFSATMISDataset=" + datasetId;
            Window.open(url, "_blank", "status=no");
        };//from  w ww.  j a  v a 2s.  c om
    };
}

From source file:org.fao.fenix.web.modules.olap.client.control.OlapController.java

License:Open Source License

public static SelectionListener<IconButtonEvent> exportPDF(final OlapWindow window) {
    return new SelectionListener<IconButtonEvent>() {
        public void componentSelected(IconButtonEvent event) {
            final LoadingWindow loading = new LoadingWindow("Exporting to PDF", "Loading", "Please Wait...");
            ListBox reportOrientationList = window.getTabPanel().getSingleDatasetPanel().getReportOrientation();
            String reportOrientation = reportOrientationList.getValue(reportOrientationList.getSelectedIndex());
            OlapServiceEntry.getInstance().createReport(window.getHtml().getHTML(), reportOrientation,
                    new AsyncCallback<String>() {
                        public void onSuccess(String report) {
                            loading.destroyLoadingBox();
                            Window.open("../exportObject/" + report, "_blank", "status=no");
                            loading.destroyLoadingBox();
                        }/*from  w  w w.j av  a2s. c  om*/

                        public void onFailure(Throwable e) {
                            loading.destroyLoadingBox();
                            FenixAlert.alert(BabelFish.print().warning(), BabelFish.print().faq());
                            loading.destroyLoadingBox();
                        }
                    });
        }
    };
}

From source file:org.fao.fenix.web.modules.olap.client.control.OlapController.java

License:Open Source License

public static SelectionListener<IconButtonEvent> exportExcel(final OlapWindow window) {
    return new SelectionListener<IconButtonEvent>() {
        public void componentSelected(IconButtonEvent event) {
            final OLAPParametersVo parameters = retrieveParameters(window);
            final LoadingWindow l = new LoadingWindow("Export to Excel", "Creating Excel...", "Please wait...");
            try {
                OlapServiceEntry.getInstance().createExcel(parameters, new AsyncCallback<String>() {
                    public void onSuccess(String result) {
                        l.destroyLoadingBox();
                        Window.open("../olapExcel/" + result, "_blank", "status=no");
                        l.destroyLoadingBox();
                    }/*from  w  ww. j a va 2s.  c o m*/

                    public void onFailure(Throwable e) {
                        l.destroyLoadingBox();
                        FenixAlert.alert(BabelFish.print().warning(), BabelFish.print().faq());
                        l.destroyLoadingBox();
                    }
                });
            } catch (FenixGWTException e) {
                l.destroyLoadingBox();
                FenixAlert.alert(BabelFish.print().warning(), BabelFish.print().faq());
                l.destroyLoadingBox();
            }
        }
    };
}

From source file:org.fao.fenix.web.modules.re.client.control.latexreport.CatalogueContextMenuLatexReportController.java

License:Open Source License

public static void open(final Long reportID, final String reportName) {
    try {//from  w  ww  . j a v a  2 s  .  c  om
        final LoadingWindow l = new LoadingWindow("LaTeX Report",
                "Workstation is loading user's settings and it is generating the report with LaTeX.",
                "Please wait...");
        LatexServiceEntry.getInstance().exportPDF(reportID, CheckLanguage.getLanguage(),
                new AsyncCallback<String>() {
                    public void onSuccess(String filepath) {
                        l.destroyLoadingBox();
                        Window.open("../exportObject/" + filepath, "_blank",
                                "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
                        l.destroyLoadingBox();
                    };

                    public void onFailure(Throwable e) {
                        l.destroyLoadingBox();
                        FenixAlert.error(BabelFish.print().error(), e.getMessage());
                        l.destroyLoadingBox();
                    }
                });
    } catch (FenixGWTException e) {
        FenixAlert.error(BabelFish.print().error(), e.getMessage());
    }
}

From source file:org.fao.fenix.web.modules.sldeditor.client.control.SLDEditorController.java

License:Open Source License

public static SelectionListener<ButtonEvent> createSLD(final SLDEditorWindow w, final int algorithm) {
    return new SelectionListener<ButtonEvent>() {
        public void componentSelected(ButtonEvent ce) {
            List<SLDEditorRuleVO> rules = collectRules(w, algorithm);
            String sldName = w.getSldEditorPanel().getSldEditorName().getStyleNameField().getValue();
            String sldDescription = w.getSldEditorPanel().getSldEditorName().getDescriptionArea().getValue();
            if (sldName == null) {
                sldName = "";
            }//w ww.ja va2  s .  c o  m
            if (sldDescription == null) {
                sldDescription = "";
            }
            if (isValid(w)) {
                final LoadingWindow l = new LoadingWindow("SLD Editor", "Creating the SLD File",
                        "Please wait...");
                try {
                    SLDEditorServiceEntry.getInstance().createSLD(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();
                                }

                                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.");
            }
        }
    };
}