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.ednovo.gooru.client.mvp.shelf.collection.tab.resource.item.EditResourcePopupVc.java

License:Open Source License

public EditResourcePopupVc(CollectionItemDo collectionItemDo) {
    super();/*from  w  ww  .  j  a  v a2  s. c o m*/
    // this.getElement().getStyle().setWidth(450, Unit.PX);
    // this.getElement().getStyle().setHeight(788, Unit.PX);
    this.collectionItemDo = collectionItemDo;
    setContent(GL0949, uiBinder.createAndBindUi(this));

    addResourceBtn.addClickHandler(new AddClickHandler());
    addResourceBtn.getElement().getStyle().setFloat(Float.LEFT);
    uploadImageLbl.addClickHandler(new OnEditImageClick());

    titleTextBox.addKeyUpHandler(new TitleKeyUpHandler());
    descriptionTxtAera.addKeyUpHandler(new DescriptionKeyUpHandler());
    titleTextBox.getElement().setAttribute("maxlength", "50");
    descriptionTxtAera.getElement().setAttribute("maxlength", "300");
    mandatoryUrlLbl.setVisible(false);
    mandatoryTitleLbl.setVisible(false);
    mandatoryCategoryLbl.setVisible(false);
    descCharcterLimit.setVisible(false);
    leftArrowLbl.setVisible(false);
    rightArrowLbl.setVisible(false);
    setThumbnailImage.setVisible(true);
    resourceTypePanel.setVisible(false);
    loadingTextLbl.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
    generateImageLbl.setVisible(false);
    saveButtonContainer.setVisible(true);
    loadingTextLbl.setVisible(false);
    panelContentRights.setVisible(false);
    mandatoryTitleLblForSwareWords.setVisible(false);
    mandatoryDescLblForSwareWords.setVisible(false);
    rightsChkBox.addClickHandler(new rightsChecked());
    rightsChkBox.getElement().setId("chkRights");
    setModal(true);
    Window.enableScrolling(false);
    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(99, false));
    mandatoryTitleLbl.setText(GL0173);
    descCharcterLimit.getElement().setInnerText(GL0143);
    mandatoryCategoryLbl.setText(GL1515);
    thumbnailLbl.getElement().setInnerText(GL0911);
    titleTextPanel.getElement().setInnerText(GL0318 + GL_SPL_STAR);
    videoPanel.getElement().setInnerHTML(GL0918);
    interactivePanel.getElement().setInnerHTML(GL0919);
    websitePanel.getElement().setInnerHTML(GL1396);
    textsPanel.getElement().setInnerHTML(GL1044);
    audioPanel.getElement().setInnerHTML(GL1045);
    imagePanel.getElement().setInnerHTML(GL1046);
    generateImageLbl.setText(GL0922);
    orLbl.getElement().setInnerText(GL_GRR_Hyphen + GL0209.toLowerCase() + GL_GRR_Hyphen);
    uploadImageLbl.setText(GL0912);
    refreshLblPanel.getElement().setInnerText(GL0923);
    rightsLbl.setText(GL0869);
    agreeText.setText(GL0870);
    commuGuideLinesAnr.setText(GL0871);
    termsAndPolicyAnr.setText(" " + GL0872 + GL_GRR_COMMA);
    privacyAnr.setText(" " + GL0873);
    andText.setText(" " + GL_GRR_AND + " ");
    copyRightAnr.setText(" " + GL0875);
    additionalText.setText(GL0874);
    addResourceBtn.setText(GL0141);
    cancelResourcePopupBtnLbl.setText(GL0142);
    loadingTextLbl.setText(GL0808.toLowerCase());
    //      otherPanel.getElement().setInnerHTML(MessageProperties.GL1047);  
    resourceFormat.getElement().setInnerHTML(GL0906);
    resDescription.getElement().setInnerHTML(GL0904);
    urlTextPanel.getElement().setInnerHTML(GL0915);
    mandatoryUrlLbl.setText(GL0916);

    displayResourceInfo();
    show();
    center();
    AppClientFactory.fireEvent(new GetEditPageHeightEvent(this, false));
    getResourceMetaInfo(collectionItemDo.getResource().getUrl());
    copyRightAnr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.enableScrolling(false);
            copyRightPolicy = new CopyRightPolicyVc() {
                @Override
                public void openParentPopup() {
                    Window.enableScrolling(false);
                    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
                }
            };

            copyRightPolicy.show();
            copyRightPolicy.setSize("902px", "300px");
            copyRightPolicy.center();
            copyRightPolicy.getElement().getStyle().setZIndex(999);

        }
    });

    termsAndPolicyAnr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.enableScrolling(false);
            termsOfUse = new TermsOfUse() {
                @Override
                public void openParentPopup() {
                    Window.enableScrolling(false);
                    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
                }
            };

            termsOfUse.show();
            termsOfUse.setSize("902px", "300px");
            termsOfUse.center();
            termsOfUse.getElement().getStyle().setZIndex(999);
        }

    });
    privacyAnr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.enableScrolling(false);
            termsAndPolicyVc = new TermsAndPolicyVc(false) {
                @Override
                public void openParentPopup() {
                    Window.enableScrolling(false);
                    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
                }
            };

            termsAndPolicyVc.show();
            termsAndPolicyVc.setSize("902px", "300px");
            termsAndPolicyVc.center();
            termsAndPolicyVc.getElement().getStyle().setZIndex(999);
        }

    });
    commuGuideLinesAnr.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Window.open("http://support.goorulearning.org/hc/en-us/articles/200688506", "_blank", "");
        }
    });
    titleTextBox.addBlurHandler(new CheckProfanityInOnBlur(titleTextBox, null, mandatoryTitleLblForSwareWords));
    descriptionTxtAera.addBlurHandler(
            new CheckProfanityInOnBlur(null, descriptionTxtAera, mandatoryDescLblForSwareWords));
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.item.EditUserOwnResourcePopupVc.java

License:Open Source License

public EditUserOwnResourcePopupVc(CollectionItemDo collectionItemDo) {

    super();// w w  w. java 2  s  .  co m
    this.collectionItemDo = collectionItemDo;
    setContent(GL0949, uiBinder.createAndBindUi(this));
    uploadName.getElement().setInnerHTML(" " + GL0948);
    browseResourceBtn.setText(GL0902);
    rollBackToPaperClip.setText(GL0950);
    changeFileBtn.setText(GL0951);
    fileTitleText.getElement().setInnerHTML(GL0952);
    mandatoryTitleLbl.setText(GL0173);
    descriptionText.getElement().setInnerHTML(GL0904);
    categoryLabel.getElement().setInnerHTML(GL0906);
    mandatoryCategoryLbl.setText(GL0917);
    /*videoLabel.getElement().setInnerHTML(GL0918);
    interactiveText.getElement().setInnerHTML(GL0919);
    websiteText.getElement().setInnerHTML(GL0920);*/
    /*slideText.getElement().setInnerHTML(GL0908);
    handoutText.getElement().setInnerHTML(GL0907);
    textbookLabel.getElement().setInnerHTML(GL0909);
    lessonText.getElement().setInnerHTML(GL0910);
    examText.getElement().setInnerHTML(GL0921);*/
    textsText.getElement().setInnerHTML(GL1044);
    //audioText.getElement().setInnerHTML(GL1045);
    imagesText.getElement().setInnerHTML(GL1046);
    //otherText.getElement().setInnerHTML(GL1047);

    /*slideText.getElement().setInnerHTML(GL0908);
    handoutText.getElement().setInnerHTML(GL0907);
    textbookLabel.getElement().setInnerHTML(GL0909);
    lessonText.getElement().setInnerHTML(GL0910);*/
    thumbnailImageText.getElement().setInnerHTML(GL0911);
    uploadImageLbl.setText(GL0912);
    rightsLbl.setText(GL0869);
    agreeText.setText(GL0870);
    commuGuideLinesAnr.setText(GL0871);
    termsAndPolicyAnr.setText(" " + GL0872 + GL_GRR_COMMA);
    privacyAnr.setText(" " + GL0873);
    andText.setText(" " + GL_GRR_AND + " ");
    copyRightAnr.setText(" " + GL0875);
    additionalText.setText(GL0874);
    addResourceBtn.setText(GL0141);
    cancelResourcePopupBtnLbl.setText(GL0142);
    lblAdding.setText(GL0591.toLowerCase());
    clipImage.setUrl("images/paperclip.png");
    addResourceBtn.addClickHandler(new AddClickHandler());
    addResourceBtn.getElement().getStyle().setFloat(Float.LEFT);
    uploadImageLbl.addClickHandler(new OnEditImageClick());

    changeFileBtn.addClickHandler(new ChangeFileBtnClick());

    titleTextBox.addKeyUpHandler(new TitleKeyUpHandler());
    descriptionTxtAera.addKeyUpHandler(new DescriptionKeyUpHandler());
    resourcePathTextBox.addKeyUpHandler(new ResourcePathKeyUpHandler());
    titleTextBox.getElement().setAttribute("maxlength", "50");
    descriptionTxtAera.getElement().setAttribute("maxlength", "300");
    resourceContentChkLbl.setVisible(false);
    mandatoryTitleLbl.setVisible(false);
    mandatoryCategoryLbl.setVisible(false);
    descCharcterLimit.setVisible(false);
    setThumbnailImage.setVisible(true);
    resourceTypePanel.setVisible(false);
    chooseResourceBtn.getElement().setId("uploadFile");
    panelContentRights.setVisible(false);
    rightsChkBox.addClickHandler(new rightsChecked());
    rightsChkBox.getElement().setId("chkRights");

    setModal(true);
    Window.enableScrolling(false);
    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(99, false));

    displayResourceInfo();
    show();
    center();
    AppClientFactory.fireEvent(new GetEditPageHeightEvent(this, false));
    getResourceMetaInfo(collectionItemDo.getResource().getUrl());
    handelFormEvent();

    lblAdding.getElement().getStyle().setDisplay(Display.NONE);
    panelAction.getElement().getStyle().setDisplay(Display.BLOCK);

    defaultFileTxtContainer.getElement().getStyle().setDisplay(Display.BLOCK);
    uploadContainer.getElement().getStyle().setDisplay(Display.NONE);
    uploadName.getElement().getStyle().setDisplay(Display.NONE);
    fileTextLbl.setText(GL0954);
    browseResourceBtn.getElement().getStyle().setMarginRight(9, Unit.PX);
    copyRightAnr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.enableScrolling(false);
            copyRightPolicy = new CopyRightPolicyVc() {
                @Override
                public void openParentPopup() {
                    Window.enableScrolling(false);
                    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
                }
            };

            copyRightPolicy.show();
            copyRightPolicy.setSize("902px", "300px");
            copyRightPolicy.center();
            copyRightPolicy.getElement().getStyle().setZIndex(999);

        }
    });

    termsAndPolicyAnr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.enableScrolling(false);
            termsOfUse = new TermsOfUse() {
                @Override
                public void openParentPopup() {
                    Window.enableScrolling(false);
                    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
                }
            };

            termsOfUse.show();
            termsOfUse.setSize("902px", "300px");
            termsOfUse.center();
            termsOfUse.getElement().getStyle().setZIndex(999);
        }

    });
    privacyAnr.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.enableScrolling(false);
            termsAndPolicyVc = new TermsAndPolicyVc(false) {
                @Override
                public void openParentPopup() {
                    Window.enableScrolling(false);
                    AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false));
                }
            };

            termsAndPolicyVc.show();
            termsAndPolicyVc.setSize("902px", "300px");
            termsAndPolicyVc.center();
            termsAndPolicyVc.getElement().getStyle().setZIndex(999);
        }

    });
    commuGuideLinesAnr.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            Window.open("http://support.goorulearning.org/hc/en-us/articles/200688506", "_blank", "");
        }
    });
}

From source file:org.ednovo.gooru.client.mvp.socialshare.SocialShareView.java

License:Open Source License

public static void postOnFacebook(String titleName, String shareLink, String description, String thumbnailUrl) {
    String faceBookFeedUrl = AppClientFactory.getLoggedInUser().getSettings().getFacebookFeedUrl();
    String appId = AppClientFactory.getLoggedInUser().getSettings().getFacebookAppId();
    faceBookFeedUrl = faceBookFeedUrl + "?app_id=" + appId + "&display=popup&name=" + getEncodedUrl(titleName)
            + "&link=" + shareLink + "&picture=" + getEncodedUrl(thumbnailUrl) + "&description="
            + getEncodedUrl(description) + "&redirect_uri=" + getEncodedUrl("https://www.facebook.com/");
    //+"&actions="+getEncodedUrl(actions);
    Window.open(faceBookFeedUrl, "_blank", "width=626,height=436");
}

From source file:org.eobjects.datacleaner.monitor.dashboard.widgets.DrillToProfilingResultSelectHandler.java

License:Open Source License

public void onSelect() {

    final String metricLabel = _item.getSeries().getLabel();

    final Integer index = _item.getDataIndex();
    GWT.log("Item index: " + index);

    final Date date = _timelineData.getRows().get(index).getDate();
    final String formattedDate = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_SHORT).format(date);
    final String resultFilePath = _timelineData.getRows().get(index).getResultFilePath();

    final String analyzerDescriptorName = getAnalyzerDescriptorName();
    final String bookmark = createResultUrlBookmark(analyzerDescriptorName);

    final String url = Urls.createRelativeUrl("repository" + resultFilePath) + bookmark;
    GWT.log("Drill to result URL: " + url);

    final Button showResultButton = new Button("Show results");
    showResultButton.addClickHandler(new ClickHandler() {
        @Override// w ww  .j  a  v a2 s  . c o m
        public void onClick(ClickEvent event) {
            Frame frame = new Frame(url);
            frame.setPixelSize(800, 500);
            _popup.setWidget(frame);
            _popup.removeButton(showResultButton);
            _popup.center();
        }
    });

    final Button showResultFullPageButton = new Button("Show results (new window)");
    showResultFullPageButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.open(url, "_blank", null);
        }
    });

    final SafeHtml labelHtml = new SafeHtmlBuilder()
            .appendHtmlConstant("Do you wish to inspect the profiling result for ").appendEscaped(metricLabel)
            .appendEscapedLines("\ncollected at ").appendEscaped(formattedDate).appendHtmlConstant("?")
            .toSafeHtml();

    _popup.setWidget(new HTML(labelHtml));
    _popup.removeButtons();
    _popup.addButton(showResultButton);
    _popup.addButton(showResultFullPageButton);
    _popup.addButton(new CancelPopupButton(_popup));
    _popup.center();
    _popup.show();
}

From source file:org.eobjects.datacleaner.monitor.scheduling.widgets.CustomizeJobClickHandler.java

License:Open Source License

@Override
public void onClick(ClickEvent event) {
    final JobIdentifier job = _schedulePanel.getSchedule().getJob();
    final MenuBar menuBar = new MenuBar(true);
    menuBar.addItem("Rename job", new Command() {
        @Override//from  w w  w. j  a v  a2  s  .c  o m
        public void execute() {
            final String newName = Window.prompt("Enter job name", job.getName());
            if (newName == null || newName.trim().length() == 0 || newName.equals(job.getName())) {
                return;
            }

            final DCPopupPanel popup = new DCPopupPanel("Renaming...");
            popup.setWidget(new LoadingIndicator());
            popup.center();
            popup.show();

            final String url = Urls.createRepositoryUrl(_tenant, "jobs/" + job.getName() + ".modify");

            final JSONObject payload = new JSONObject();
            payload.put("name", new JSONString(newName));

            final DCRequestBuilder requestBuilder = new DCRequestBuilder(RequestBuilder.POST, url);
            requestBuilder.setHeader("Content-Type", "application/json");
            requestBuilder.send(payload.toString(), new DCRequestCallback() {
                @Override
                protected void onSuccess(Request request, Response response) {
                    Window.Location.reload();
                }

                @Override
                public void onNonSuccesfullStatusCode(Request request, Response response, int statusCode,
                        String statusText) {
                    popup.hide();
                    ErrorHandler.showErrorDialog(response.getText());
                }
            });
        }
    });
    menuBar.addItem("Copy job", new Command() {
        @Override
        public void execute() {
            final String newJobName = Window.prompt("Enter new job name", job.getName() + " (Copy)");

            if (newJobName == null || newJobName.trim().length() == 0 || newJobName.equals(job.getName())) {
                return;
            }

            final DCPopupPanel popup = new DCPopupPanel("Copying...");
            popup.setWidget(new LoadingIndicator());
            popup.center();
            popup.show();

            final String url = Urls.createRepositoryUrl(_tenant, "jobs/" + job.getName() + ".copy");

            final JSONObject payload = new JSONObject();
            payload.put("name", new JSONString(newJobName));

            final DCRequestBuilder requestBuilder = new DCRequestBuilder(RequestBuilder.POST, url);
            requestBuilder.setHeader("Content-Type", "application/json");
            requestBuilder.send(payload.toString(), new DCRequestCallback() {
                @Override
                protected void onSuccess(Request request, Response response) {
                    Window.Location.reload();
                }
            });
        }
    });

    menuBar.addItem("Delete job", new Command() {
        @Override
        public void execute() {
            boolean delete = Window.confirm("Are you sure you want to delete the job '" + job.getName()
                    + "' and related schedule, results and timelines.");
            if (delete) {
                final String url = Urls.createRepositoryUrl(_tenant, "jobs/" + job.getName() + ".delete");
                final DCRequestBuilder requestBuilder = new DCRequestBuilder(RequestBuilder.POST, url);
                requestBuilder.setHeader("Content-Type", "application/json");
                requestBuilder.send("", new DCRequestCallback() {
                    @Override
                    protected void onSuccess(Request request, Response response) {
                        Window.Location.reload();
                    }
                });
            }
        }
    });

    final boolean analysisJob = JobIdentifier.JOB_TYPE_ANALYSIS_JOB.equals(job.getType());

    if (analysisJob) {
        menuBar.addSeparator();

        menuBar.addItem("Job definition (xml)", new Command() {
            @Override
            public void execute() {
                String url = Urls.createRepositoryUrl(_tenant, "jobs/" + job.getName() + ".analysis.xml");
                Window.open(url, "datacleaner_job_details", null);
                _popup.hide();
            }
        });
        menuBar.addItem("Show latest result", new Command() {
            @Override
            public void execute() {
                String url = Urls.createRepositoryUrl(_tenant,
                        "results/" + job.getName() + "-latest.analysis.result.dat");
                Window.open(url, "datacleaner_job_details", null);
                _popup.hide();
            }
        });
    }

    _popup.setWidget(menuBar);
    _popup.showRelativeTo((UIObject) event.getSource());
}

From source file:org.eobjects.datacleaner.monitor.scheduling.widgets.SchedulePanel.java

License:Open Source License

public SchedulePanel(final ClientConfig clientConfig, final ScheduleDefinition schedule,
        final SchedulingServiceAsync service) {
    super();/*from w w w  . ja  v  a 2  s. c  om*/

    _clientConfig = clientConfig;
    _schedule = schedule;

    initWidget(uiBinder.createAndBindUi(this));

    // add the job type as a style name
    final String jobType = schedule.getJob().getType();
    if (jobType != null) {
        addStyleName(jobType);
    }

    final boolean analysisJob = JobIdentifier.JOB_TYPE_ANALYSIS_JOB.equals(jobType);

    updateScheduleWidgets();

    final TenantIdentifier tenant = _clientConfig.getTenant();

    final String encodedJobName = URL.encodeQueryString(schedule.getJob().getName());

    if (_clientConfig.isJobEditor()) {
        jobLabel.addClickHandler(new CustomizeJobClickHandler(this, tenant));
    }

    if (_clientConfig.isScheduleEditor()) {
        CustomizeScheduleClickHandler handler = new CustomizeScheduleClickHandler(this, service, tenant,
                schedule);
        scheduleAnchor.addClickHandler(handler);

        final String token = History.getToken();
        GWT.log("Encoded job name: " + encodedJobName);
        if (("schedule_" + encodedJobName).equals(token)) {
            History.newItem("");
            handler.showSchedulingPopup();
        }
    }

    if (!_clientConfig.isJobEditor()) {
        alertsPanel.setVisible(false);
    }

    if (_clientConfig.isScheduleEditor()) {
        TriggerJobClickHandler handler = new TriggerJobClickHandler(service, tenant, _schedule);
        triggerNowButton.addClickHandler(handler);

        final String token = History.getToken();
        if (("trigger_" + encodedJobName).equals(token)) {
            History.newItem("");
            handler.showExecutionPopup();
        }
    }

    if (_clientConfig.isJobEditor() && analysisJob) {
        launchButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                String url = Urls.createRepositoryUrl(tenant,
                        "jobs/" + schedule.getJob().getName() + ".launch.jnlp");
                Window.open(url, "_blank", null);
            }
        });
    } else {
        launchButton.setVisible(false);
    }

    historyButton.addClickHandler(new JobHistoryClickHandler(service, tenant, schedule));

    final List<AlertDefinition> alerts = schedule.getAlerts();
    final Anchor expandAlertsAnchor = new Anchor(alerts.size() + " alert(s)");
    if (alerts.isEmpty()) {
        expandAlertsAnchor.addStyleName("discrete");
    }
    expandAlertsAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            final FlowPanel alertListPanel = new FlowPanel();
            alertListPanel.setStyleName("AlertListPanel");

            if (alerts.isEmpty()) {
                Label label = new Label("(no alerts)");
                label.setStylePrimaryName("AlertPanel");
                alertListPanel.add(label);
            }
            for (AlertDefinition alert : alerts) {
                AlertPanel alertPanel = new AlertPanel(service, schedule, alert);
                alertListPanel.add(alertPanel);
            }

            alertsPanel.clear();
            alertsPanel.add(new CreateAlertAnchor(service, schedule));
            alertsPanel.add(alertListPanel);
        }
    });
    alertsPanel.add(expandAlertsAnchor);
}

From source file:org.eobjects.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 = new Button("Close");
    button.addClickHandler(new ClickHandler() {
        @Override//from  ww w .j  a  v a  2 s.  co m
        public void onClick(ClickEvent event) {
            // full page refresh.
            closeWizardAfterFinishing(datastoreName, "datastores.jsf");
        }
    });

    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.jsf?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.eurekastreams.web.client.ui.common.stream.renderers.ResourceCountWidget.java

License:Apache License

/**
 * Constructor.// www .java 2 s  .c o  m
 *
 * @param inCountType
 *            the count type.
 * @param inResoureceUrl
 *            activity url.
 * @param thumbs
 *            thumbnails.
 * @param desc
 *            description.
 * @param title
 *            title.
 * @param inLikeCount
 *            like count.
 * @param inLikers
 *            who has liked this activity.
 * @param inIsLiked
 *            if the person has liked the current activity.
 */
public ResourceCountWidget(final CountType inCountType, final String inResoureceUrl, final String title,
        final String desc, final String[] thumbs, final Integer inLikeCount,
        final List<PersonModelView> inLikers, final Boolean inIsLiked) {
    thisIsLiked = inIsLiked;
    countType = inCountType;
    resourceUrl = inResoureceUrl;

    initWidget(widget);

    if (!hasUsersWhoLikedBeenAddedToRoot) {
        setup();
    }

    widget.addMouseOverHandler(new MouseOverHandler() {
        public void onMouseOver(final MouseOverEvent arg0) {
            countType = inCountType;
            resourceUrl = inResoureceUrl;
            if (likeCount > 0) {
                showPanel();
                usersWhoLikedPanelWrapper.setVisible(true);
            }
        }
    });

    likers = inLikers;
    likeCount = inLikeCount;

    likeCountLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectCount());
    likeCountLink.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
            showActorsPopup(inCountType, inResoureceUrl);
        }
    });

    final FlowPanel likeCountPanel = new FlowPanel();

    if (inCountType.equals(CountType.LIKES)) {
        final FlowPanel likeContainer = new FlowPanel();
        likeContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectLikeButton());

        if (thisIsLiked) {
            likeContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectUnlikeButton());
        } else {
            likeContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectLikeButton());
        }

        Anchor likeLink = new Anchor();

        EventBus.getInstance().addObserver(ResourceLikeChangeEvent.class,
                new Observer<ResourceLikeChangeEvent>() {
                    public void update(final ResourceLikeChangeEvent event) {
                        if (event.getResponse()) {
                            likeContainer.removeStyleName(
                                    StaticResourceBundle.INSTANCE.coreCss().eurekaConnectLikeButton());
                            likeContainer.addStyleName(
                                    StaticResourceBundle.INSTANCE.coreCss().eurekaConnectUnlikeButton());
                            updatePanel(LikeActionType.ADD_LIKE);
                            currentPanel.showPanel();
                            usersWhoLikedPanelWrapper.setVisible(true);
                        } else {
                            likeContainer.removeStyleName(
                                    StaticResourceBundle.INSTANCE.coreCss().eurekaConnectUnlikeButton());
                            likeContainer.addStyleName(
                                    StaticResourceBundle.INSTANCE.coreCss().eurekaConnectLikeButton());
                            updatePanel(LikeActionType.REMOVE_LIKE);
                            currentPanel.showPanel();
                            usersWhoLikedPanelWrapper.setVisible(false);
                        }

                        likeCountLink.setText(likeCount.toString());
                    }
                });

        likeLink.addClickHandler(new ClickHandler() {

            public void onClick(final ClickEvent arg0) {
                thisIsLiked = !thisIsLiked;
                final HashMap<String, Serializable> request = new HashMap<String, Serializable>();
                request.put("resourceurl", inResoureceUrl);
                request.put("liked", thisIsLiked);

                LikeResourceModel.getInstance().insert(request);
            }
        });

        likeContainer.add(likeLink);
        likeContainer.add(likeCountLink);
        likeCountPanel.add(likeContainer);
    } else {
        FlowPanel shareContainer = new FlowPanel();
        shareContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectShareButton());

        Anchor shareLink = new Anchor();
        shareLink.addClickHandler(new ClickHandler() {
            public void onClick(final ClickEvent arg0) {
                String thumbsStr = "";
                final int height = 380;
                final int width = 800;

                for (String thumb : thumbs) {
                    if (thumbsStr.length() > 0) {
                        thumbsStr += ",";
                    }
                    thumbsStr += thumb;
                }

                Window.open(
                        "/widget.html?widget=sharedialog&thumbs=" + thumbsStr + "&desc=" + desc + "&title="
                                + title + "&resourceurl=" + inResoureceUrl,
                        null, WidgetJSNIFacadeImpl.nativeGetCenteredPopupFeatureString(width, height)
                                + ",status=yes,toolbar=no,menubar=no,location=no");
            }
        });

        shareContainer.add(shareLink);
        shareContainer.add(likeCountLink);
        likeCountPanel.add(shareContainer);
    }

    widget.add(likeCountPanel);

    updatePanel(null);
}

From source file:org.eurekastreams.web.client.ui.common.stream.renderers.ResourceCountWidget.java

License:Apache License

/**
 * Pops up a window showing a list of people.
 *
 * @param inCountType/*from   w ww .j  av a2 s  .  c  o m*/
 *            Type of people.
 * @param inResoureceUrl
 *            URL of resource.
 */
private static void showActorsPopup(final CountType inCountType, final String inResoureceUrl) {
    final int height = 320;
    final int width = 400;
    String actorType = CountType.LIKES.equals(inCountType) ? "likes" : "shares";
    Window.open("/widget.html?widget=actordialog&actortype=" + actorType + "&resourceurl=" + inResoureceUrl,
            null, WidgetJSNIFacadeImpl.nativeGetCenteredPopupFeatureString(width, height)
                    + ",status=yes,toolbar=no,menubar=no,location=no");
}

From source file:org.eurekastreams.web.client.ui.connect.support.WidgetUtilities.java

License:Apache License

/**
 * Pops up an activity share box from a widget.
 *
 * @param activityId/*from   w  ww  .ja va  2s  .  c o  m*/
 *            Activity ID.
 */
public static void showShareActivityPopup(final long activityId) {
    final int width = 650;
    final int height = 340;
    Window.open(WidgetUtilities.getShareActivityPopupUrl(activityId), "_blank",
            "menubar=no,status=no,toolbar=no,location=no,"
                    + WidgetJSNIFacadeImpl.nativeGetCenteredPopupFeatureString(width, height));
}