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.datacleaner.monitor.scheduling.command.ViewJobDefinitionCommand.java

License:Open Source License

@Override
public void execute() {
    String url = Urls.createRepositoryUrl(_tenant, "jobs/" + _job.getName() + ".analysis.xml");
    Window.open(url, "datacleaner_job_details", null);
    _popup.hide();/* w w w.  ja va2s  .com*/
}

From source file:org.datacleaner.monitor.wizard.DatastoreWizardController.java

License:Open Source License

@Override
protected void wizardFinished(final String datastoreName) {
    final String encodedDatastoreName = URL.encodeQueryString(datastoreName);

    final Button button = DCButtons.primaryButton(null, "Close");
    button.addClickHandler(new ClickHandler() {
        @Override/* w w w  .j a v a2  s. c  o m*/
        public void onClick(ClickEvent event) {
            // full page refresh.
            closeWizardAfterFinishing(datastoreName, "datastores");
        }
    });

    final Anchor jobWizardAnchor = new Anchor("Build a job for this datastore");
    jobWizardAnchor.addStyleName("BuildJob");
    jobWizardAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final String htmlDivId = getWizardPanel().getCustomHtmlDivId();
            closeWizardAfterFinishing(datastoreName, null);

            JavaScriptCallbacks.startJobWizard(datastoreName, null, htmlDivId);
        }
    });

    final Anchor queryAnchor = new Anchor("Explore / query this datastore");
    queryAnchor.addStyleName("QueryDatastore");
    queryAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final String url = Urls.createRelativeUrl("query?ds=" + encodedDatastoreName);
            Window.open(url, "_blank", "location=no,width=770,height=400,toolbar=no,menubar=no");
        }
    });

    final FlowPanel contentPanel = new FlowPanel();
    contentPanel.addStyleName("WizardFinishedPanel");
    contentPanel.add(new Label("Datastore '" + datastoreName + "' created! Wizard finished."));

    contentPanel.add(new Label(
            "Click 'Close' to return, or click one of the links below to start using the datastore."));
    contentPanel.add(jobWizardAnchor);
    contentPanel.add(queryAnchor);

    setContent(contentPanel);
    getWizardPanel().getButtonPanel().clear();
    getWizardPanel().getButtonPanel().addButton(button);
    getWizardPanel().refreshUI();
}

From source file:org.dataconservancy.dcs.access.client.model.JsCreator.java

License:Apache License

public static Widget display(JsArray<JsCreator> array) {
    FlexTable table = Util.createTable();

    for (int i = 0; i < array.length(); i++) {
        final JsCreator creator = array.get(i);

        Label creatorLbl = Util.label(creator.getCreatorName(), "Hyperlink");
        table.setWidget(0, i + 1, creatorLbl);
        creatorLbl.addClickHandler(new ClickHandler() {

            @Override//from ww w . j av  a 2  s  .c om
            public void onClick(ClickEvent event) {
                Window.open(creator.getCreatorId(), "_blank", "");
            }
        });
    }

    return table;
}

From source file:org.dataconservancy.dcs.access.client.model.JsDeliverableUnit.java

License:Apache License

public Widget display(CellTree tree, boolean allowDownload) {
    FlowPanel panel = new FlowPanel();

    panel.setStylePrimaryName("Entity");
    Button b = new Button("Download (Email download link)");
    //        if(!getCoreMd().getRights().equalsIgnoreCase("restricted"))
    if (allowDownload)
        panel.add(b);/*  www .ja  v a  2s. c o  m*/

    b.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            //pop window
            //send email
            // Window.open(Application.datastreamURLnoEncoding(getId()), "_blank", "");
            SeadApp.userService.checkSession(null, new AsyncCallback<UserSession>() {

                @Override
                public void onSuccess(UserSession session) {
                    String emailAddress = null;
                    if (session.isSession())
                        emailAddress = session.getEmail();
                    EmailPopupPanel emailPopup = new EmailPopupPanel(getId(), emailAddress);
                    emailPopup.show();
                }

                @Override
                public void onFailure(Throwable caught) {
                    new ErrorPopupPanel("Error:" + caught.getMessage());
                }
            });

        }
    });

    panel.add(Util.label("Core metadata", "SubSectionHeader"));

    panel.add(getCoreMd().display(getId(), tree));

    final FlexTable table = Util.createTable("Publication Date:", "Abstract:", "Site:",
            //"Identifier:",
            "Entity type:", "Creators:", "Parents:",
            //    "Collections:",
            //    "Former refs",
            //     "Metadata refs:",
            //      "Provenance:",
            //     "Surrogate:",
            "Alternate Ids:", "Location:", "ACR Location:", "Lineage:");
    panel.add(table);
    table.setWidth("90%");

    if (getPubdate() != null) {
        table.setWidget(0, 1, new Label(getPubdate()));
    }

    if (getAbstract() != null) {
        FlowPanel abstractPanel = new FlowPanel();
        abstractPanel.add(new Label(getAbstract()));
        table.setWidget(1, 1, abstractPanel);
    }

    if (getSite() != null) {
        table.setWidget(2, 1, new Label(getSite()));
    }

    //table.setWidget(3, 1, Util.entityLink(getId()));

    table.setText(3, 1, "Collection");
    table.setWidget(4, 1, JsCreator.display(getCreators()));
    if (getParents() != null) {
        table.setWidget(5, 1, Util.entityLinks(getParents()));
    }

    /*    if (getCollections() != null) {
    table.setWidget(6, 1, Util.entityLinks(getCollections()));
    }
            
    table.setText(7, 1, toString(getFormerExternalRefs()));
    table.setWidget(8, 1, Util.metadataLinks(getMetadataRefs()));
    table.setText(10, 1, isDigitalSurrogate() == null ? "Unknown" : ""
        + isDigitalSurrogate());
    */
    Panel locationPanel = new FlowPanel();
    if (getPrimaryDataLocation() != null)
        locationPanel.add(getPrimaryDataLocation().display());

    if (getAlternateIds() != null) {
        JsArray<JsAlternateId> altIds = getAlternateIds();
        FlowPanel altIdPanel = new FlowPanel();
        FlowPanel altLocPanel = new FlowPanel();

        int doiFlag1 = 0;
        for (int i = 0; i < altIds.length(); i++) {
            String altIdStr;
            altIdStr = altIds.get(i).getIdValue();

            final String finalLink;
            if (!altIds.get(i).getTypeId().equalsIgnoreCase("storage_format")) {
                if (altIds.get(i).getTypeId().equals("medici")) {
                    finalLink = "http://nced.ncsa.illinois.edu/acr/#collection?uri="
                            + altIds.get(i).getIdValue();
                    altIdStr = getCoreMd().getTitle();
                } else
                    finalLink = altIdStr;

                Label altIdLabel = Util.label(altIdStr, "Hyperlink");
                altIdLabel.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        Window.open(finalLink, "_blank", "");
                    }
                });

                if (altIds.get(i).getTypeId().equals("medici")) {

                    altLocPanel.add(altIdLabel);
                } else
                    altIdPanel.add(altIdLabel);
            }

        }
        table.setWidget(6, 1, altIdPanel);
        table.setWidget(8, 1, altLocPanel);

    }

    if (getDataLocations() != null) {
        JsArray<JsDataLocation> locs = getDataLocations();
        for (int i = 0; i < locs.length(); i++) {

            String location = locs.get(i).getLocation();

            if (locs.get(i).getName().contains("SDA"))
                location = "https://www.sdarchive.iu.edu";
            Image image;

            if (locs.get(i).getType().contains("IU"))
                image = new Image("images/IU_Scholarworks.jpg");
            else if (locs.get(i).getType().contains("Ideals")) {
                image = new Image("images/Ideals.png");
                location = location.replace("xmlui/", "");
            } else
                image = new Image("images/local.jpg");

            Label locationLabel;

            location = location.replace("jspui", "iuswdark");
            final String finalLink = location;
            if (!locs.get(i).getName().contains("SDA")) {
                locationLabel = Util.label(location, "Hyperlink");
                locationLabel.addClickHandler(new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        Window.open(finalLink, "_blank", "");

                    }
                });
            } else {
                locationLabel = new Label();
                locationLabel.setText(location);
            }

            FlexTable smallTable = Util.createTable();
            smallTable.setWidget(0, 0, locationLabel);

            smallTable.setWidget(0, 1, image);
            locationPanel.add(smallTable);
        }
    }
    table.setWidget(7, 1, locationPanel);

    //        if (getMetadata() != null && getMetadata().length() > 0) {
    //            panel.add(Util.label("Additional metadata", "SubSectionHeader"));
    //            JsMetadata.display(panel, getMetadata());
    //        }

    if (getRelations() != null && getRelations().length() > 0) {
        panel.add(Util.label("Relations", "SubSectionHeader"));
        JsRelation.display(panel, getRelations());
    }

    /*        TreeDemo demo = new TreeDemo();
            demo.setId(getId());
            demo.start();
            table.setWidget(9, 1, demo);
    */
    return panel;
}

From source file:org.dataconservancy.dcs.access.client.model.JsFile.java

License:Apache License

public Widget display() {
    FlowPanel panel = new FlowPanel();

    if (!getSource().isEmpty()) {

        Button b = new Button("Download");
        panel.add(b);// ww  w. j  ava2 s .  c om

        b.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String source = SeadApp.datastreamURLnoEncoding(getId().replace(":", "%3A"));

                String strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
                Window.open(source, "_blank", strWindowFeatures);
            }
        });

        //panel.add(new Anchor("Download", false, getSource(), "_blank"));
    }

    final FlexTable table = Util.createTable(//"Id",
            "Entity type", "Name", "Appears in Collections", "Size", "Valid", "Extant", "Metadata refs",
            "Alternate Ids", "Primary Location", "ACR Location");

    Util.addColumn(table,
            // null,
            "File", getName(), null, "" + getSizeBytes() + " bytes",
            getValid() == null ? "Unknown" : "" + getValid(), "" + isExtant());

    // table.setWidget(0, 1, Util.entityLink(getId()));

    JsonpRequestBuilder rb = new JsonpRequestBuilder();
    String parentdu = SeadApp.accessurl + SeadApp.queryPath + "?q=" + "id:(\"" + getParent() + "\")"
            + "&offset=0&max=200";
    rb.requestObject(parentdu, new AsyncCallback<JsSearchResult>() {

        public void onFailure(Throwable caught) {
            Window.alert("Failed");
        }

        public void onSuccess(JsSearchResult dus) {

            FlowPanel desc = new FlowPanel();

            for (int i = 0; i < dus.matches().length(); i++) {
                JsMatch m = dus.matches().get(i);

                JsDeliverableUnit entity = (JsDeliverableUnit) m.getEntity();

                //System.out.println("Title="+entity.getCoreMd().getTitle());
                desc.add(new Hyperlink(" " + entity.getCoreMd().getTitle(), true,
                        SeadState.ENTITY.toToken(entity.getId())));
            }
            table.setWidget(2, 1, desc);
        }
    });

    if (getMetadataRefs() != null) {
        table.setWidget(6, 1, Util.entityLinks(getMetadataRefs()));
    }

    FlowPanel primaryLocPanel = new FlowPanel();

    if (getPrimaryDataLocation() != null)
        primaryLocPanel.add(getPrimaryDataLocation().display());

    if (getAlternateIds() != null) {
        final JsArray<JsAlternateId> altIds = getAlternateIds();
        FlowPanel altIdPanel = new FlowPanel();
        final FlowPanel altLocPanel = new FlowPanel();

        for (int i = 0; i < altIds.length(); i++) {

            final String type = altIds.get(i).getTypeId();
            final String value = altIds.get(i).getIdValue();
            AsyncCallback<List<MediciInstance>> callback = new AsyncCallback<List<MediciInstance>>() {

                @Override
                public void onSuccess(List<MediciInstance> result) {
                    for (MediciInstance instance : result) {
                        if (instance.getType().equalsIgnoreCase(type)) {
                            final String finalLink = instance.getUrl() + "/#dataset?id=" + value;
                            String altIdStr = getName();

                            Label altIdLabel = Util.label(altIdStr, "Hyperlink");
                            altIdLabel.addClickHandler(new ClickHandler() {
                                @Override
                                public void onClick(ClickEvent event) {
                                    Window.open(finalLink, "_blank", "");

                                }
                            });
                            altLocPanel.add(altIdLabel);
                            break;
                        }

                    }

                }

                @Override
                public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                }
            };
            MediciIngestPresenter.mediciService.getAcrInstances(callback);

        }
        table.setWidget(7, 1, altIdPanel);
        table.setWidget(8, 1, primaryLocPanel);
        table.setWidget(9, 1, altLocPanel);
    }

    //belongs to dataset
    panel.add(table);

    if (getFormats() != null && getFormats().length() > 0) {
        panel.add(Util.label("Formats", "SubSectionHeader"));
        JsFormat.display(panel, getFormats());
    }

    if (getMetadata() != null && getMetadata().length() > 0) {
        panel.add(Util.label("Additional metadata", "SubSectionHeader"));
        JsMetadata.display(panel, getMetadata());
    }

    if (getFixity() != null && getFixity().length() > 0) {
        panel.add(Util.label("Fixity", "SubSectionHeader"));
        JsFixity.display(panel, getFixity());
    }

    return panel;
}

From source file:org.dataconservancy.dcs.access.client.model.JsPrimaryDataLocation.java

License:Apache License

public Widget display() {

    FlexTable smallTable = Util.createTable();
    Image image;/*w w w . jav a2 s  .co  m*/

    if (getLocation() != null) {
        String location = getLocation().replace("jspui", "iuswdark").replace("sword/deposit",
                "iuswdark/handle");
        if (getType() != null)
            if (getType().contains("dspace") && getName().contains("Ideals"))
                location = location.replace("xmlui/", "");
        final String locationLink = location;
        Label locationLabel;
        if (!getName().contains("SDA")) {
            locationLabel = Util.label(location, "Hyperlink");
            locationLabel.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    Window.open(locationLink, "_blank", "");
                }
            });
        } else {
            locationLabel = new Label();
            locationLabel.setText(location);
        }

        if (!location.contains("communities"))
            smallTable.setWidget(0, 0, locationLabel);
    }

    if (getType() != null) {
        if (getType().contains("dspace") && getName().contains("local")) {
            image = new Image("images/local_dspace.jpg");
            smallTable.setWidget(0, 1, image);
        } else if (getType().contains("dspace") && getName().contains("IU")) {
            image = new Image("images/IU_Scholarworks.jpg");
            smallTable.setWidget(0, 1, image);
        } else if (getName().contains("SDA")) {
            image = new Image("images/hpss.jpg");
            smallTable.setWidget(0, 1, image);
        } else if (getType().contains("dspace") && getName().contains("Ideals")) {
            image = new Image("images/Ideals.png");
            smallTable.setWidget(0, 1, image);
        }
    }

    return smallTable;
}

From source file:org.dataconservancy.dcs.access.client.SeadApp.java

License:Apache License

private Widget createAccessServiceUrlEditor() {
    FlexTable table = new FlexTable();
    table.setText(0, 0, "");
    table.setStyleName("FooterTable");
    Label aboutLabel = Util.label("About", "Hyperlink");
    Util.addColumn(table, aboutLabel);
    aboutLabel.addStyleName("LeftPad");
    aboutLabel.addClickHandler(new ClickHandler() {
        @Override/* w  ww  .ja va2  s .c  om*/
        public void onClick(ClickEvent event) {
            Window.open("http://sead-data.net/", "_blank", "");
        }
    });

    Label faq = Util.label("FAQ", "Hyperlink");
    Util.addColumn(table, faq);
    faq.addStyleName("LeftPad");
    faq.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.open("http://sead-data.net/", "_blank", "");
        }
    });

    Label contactLabel = Util.label("Contact Us", "Hyperlink");
    Util.addColumn(table, contactLabel);
    contactLabel.addStyleName("LeftPad");
    contactLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.open("mailto:seadva-l@indiana.edu", "_blank", "");
        }
    });

    Label privacyLabel = Util.label("Privay Policy", "Hyperlink");
    Util.addColumn(table, privacyLabel);
    privacyLabel.addStyleName("LeftPad");
    privacyLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {

        }
    });

    /*set.addClickHandler(new ClickHandler() {
            
    public void onClick(ClickEvent event) {
        String s = accessurl_tb.getText().trim();
            
        if (!s.isEmpty()) {
            accessurl = s;
            History.fireCurrentHistoryState();
        }
    }
    });*/

    return table;
}

From source file:org.dataconservancy.dcs.access.ui.client.model.JsFile.java

License:Apache License

public Widget display() {
    FlowPanel panel = new FlowPanel();

    if (!getSource().isEmpty()) {

        Button b = new Button("Download");
        panel.add(b);/*from   ww  w  . ja  va  2  s  .  c om*/

        b.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                Window.open(getSource(), "_blank", "");
            }
        });

        //panel.add(new Anchor("Download", false, getSource(), "_blank"));
    }

    FlexTable table = Util.createTable("Id", "Entity type", "Name", "Size", "Valid", "Extant", "Metadata refs");

    Util.addColumn(table, null, "File", getName(), "" + getSizeBytes(),
            getValid() == null ? "Unknown" : "" + getValid(), "" + isExtant());

    table.setWidget(0, 1, Util.entityLink(getId()));

    if (getMetadataRefs() != null) {
        table.setWidget(7, 1, Util.entityLinks(getMetadataRefs()));
    }

    panel.add(table);

    if (getFormats() != null && getFormats().length() > 0) {
        panel.add(Util.label("Formats", "SubSectionHeader"));
        JsFormat.display(panel, getFormats());
    }

    if (getMetadata() != null && getMetadata().length() > 0) {
        panel.add(Util.label("Additional metadata", "SubSectionHeader"));
        JsMetadata.display(panel, getMetadata());
    }

    if (getFixity() != null && getFixity().length() > 0) {
        panel.add(Util.label("Fixity", "SubSectionHeader"));
        JsFixity.display(panel, getFixity());
    }

    return panel;
}

From source file:org.daxplore.presenter.client.ui.ImageButtonPanel.java

License:Open Source License

private void openPrintPage() {
    if (queryDefinition != null) {
        String url = baseUrl + "print?q=" + queryDefinition.getAsString() + "&l="
                + LocaleInfo.getCurrentLocale().getLocaleName();
        String name = "_blank";
        String features = "";
        Window.open(url, name, features);
    }//w w  w . j a v a 2s.  c  o m
}

From source file:org.drools.brms.client.admin.BackupManager.java

License:Apache License

private void exportRepository() {

    LoadingPopup.showMessage("Exporting repository, please wait, as this could take some time...");

    Window.open(GWT.getModuleBaseURL() + "backup?" + HTMLFileManagerFields.FORM_FIELD_REPOSITORY + "=true",
            "downloading", "resizable=no,scrollbars=yes,status=no");

    LoadingPopup.close();// w  w w .jav  a2s.  c  om
}