Search in sources :

Example 46 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.

the class ShowContentDialog method addButtons.

protected void addButtons() {
    ThemedButton closeButton = new ThemedButton("Close", new ClickHandler() {

        public void onClick(ClickEvent event) {
            closeDialog();
        }
    });
    addOkButton(closeButton);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 47 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.

the class MessageDialog method addButton.

public ThemedButton addButton(String label, final Operation operation, boolean isDefault, boolean isCancel) {
    ThemedButton button = new ThemedButton(label, new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (operation != null)
                operation.execute();
            closeDialog();
        }
    });
    addButton(button, isDefault, isCancel);
    return button;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 48 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.

the class ModalDialog method commonInit.

private void commonInit(String caption, ThemedButton okButton, final Operation cancelOperation) {
    setText(caption);
    addOkButton(okButton);
    ThemedButton cancelButton = addCancelButton();
    if (cancelOperation != null) {
        cancelButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                cancelOperation.execute();
            }
        });
    }
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 49 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.

the class RPubsUploadDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    Styles styles = RESOURCES.styles();
    SimplePanel mainPanel = new SimplePanel();
    mainPanel.addStyleName(styles.mainWidget());
    VerticalPanel verticalPanel = new VerticalPanel();
    HorizontalPanel headerPanel = new HorizontalPanel();
    headerPanel.addStyleName(styles.headerPanel());
    headerPanel.add(new Image(new ImageResource2x(RESOURCES.publishLarge2x())));
    Label headerLabel = new Label("Publish to RPubs");
    headerLabel.addStyleName(styles.headerLabel());
    headerPanel.add(headerLabel);
    headerPanel.setCellVerticalAlignment(headerLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.add(headerPanel);
    String msg;
    if (!isPublished_ && uploadId_.isEmpty()) {
        msg = "RPubs is a free service from RStudio for sharing " + "documents on the web. Click Publish to get " + "started.";
    } else {
        msg = "This document has already been published on RPubs. You can " + "choose to either update the existing RPubs document, or " + "create a new one.";
    }
    Label descLabel = new Label(msg);
    descLabel.addStyleName(styles.descLabel());
    verticalPanel.add(descLabel);
    // if we have a generator then show title and comment UI
    if (htmlGenerator_ != null) {
        Label titleLabel = new Label("Title (optional):");
        titleLabel.addStyleName(styles.fieldLabel());
        verticalPanel.add(titleLabel);
        titleTextBox_ = new TextBox();
        titleTextBox_.addStyleName(styles.titleTextBox());
        titleTextBox_.getElement().setAttribute("spellcheck", "false");
        verticalPanel.add(titleTextBox_);
        Label commentLabel = new Label("Comment (optional):");
        commentLabel.addStyleName(styles.fieldLabel());
        verticalPanel.add(commentLabel);
        commentTextArea_ = new FixedTextArea(6);
        commentTextArea_.addStyleName(styles.commentTextArea());
        verticalPanel.add(commentTextArea_);
        // not using either for now
        titleLabel.setVisible(false);
        titleTextBox_.setVisible(false);
        commentLabel.setVisible(false);
        commentTextArea_.setVisible(false);
        previewButton_ = new ThemedButton("Preview");
        previewButton_.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                htmlGenerator_.generateStaticHtml(titleTextBox_.getText().trim(), commentTextArea_.getText().trim(), new CommandWithArg<String>() {

                    @Override
                    public void execute(String rpubsFile) {
                        globalDisplay_.showHtmlFile(rpubsFile);
                    }
                });
            }
        });
        addLeftButton(previewButton_);
    }
    HTML warningLabel = new HTML("<strong>IMPORTANT: All documents published to RPubs are " + "publicly visible.</strong> You should " + "only publish documents that you wish to share publicly.");
    warningLabel.addStyleName(styles.warningLabel());
    verticalPanel.add(warningLabel);
    ThemedButton cancelButton = createCancelButton(new Operation() {

        @Override
        public void execute() {
            // if an upload is in progress then terminate it
            if (uploader_.isUploadInProgress()) {
                uploader_.terminateUpload();
            }
        }
    });
    continueButton_ = new ThemedButton("Publish", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performUpload(false);
        }
    });
    updateButton_ = new ThemedButton("Update Existing", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performUpload(true);
        }
    });
    createButton_ = new ThemedButton("Create New", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            performUpload(false);
        }
    });
    if (!isPublished_ && uploadId_.isEmpty()) {
        addOkButton(continueButton_);
        addCancelButton(cancelButton);
    } else {
        addOkButton(updateButton_);
        addButton(createButton_);
        addCancelButton(cancelButton);
    }
    mainPanel.setWidget(verticalPanel);
    return mainPanel;
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML) TextBox(com.google.gwt.user.client.ui.TextBox) CommandWithArg(org.rstudio.core.client.CommandWithArg) Operation(org.rstudio.core.client.widget.Operation) Image(com.google.gwt.user.client.ui.Image) ProgressImage(org.rstudio.core.client.widget.ProgressImage) ThemedButton(org.rstudio.core.client.widget.ThemedButton) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) FixedTextArea(org.rstudio.core.client.widget.FixedTextArea) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 50 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.

the class RStudioAPI method showDialog.

private void showDialog(String caption, String message, final String url) {
    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.addStyleName(RES.styles().textInfoWidget());
    SafeHtml safeMsg = DialogHtmlSanitizer.sanitizeHtml(message);
    HTML msg = new HTML(safeMsg.asString());
    msg.setWidth("100%");
    verticalPanel.add(msg);
    if (!StringUtil.isNullOrEmpty(url)) {
        HyperlinkLabel link = new HyperlinkLabel(url, new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                RStudioGinjector.INSTANCE.getGlobalDisplay().openWindow(url);
            }
        });
        link.addStyleName(RES.styles().installLink());
        verticalPanel.add(link);
    }
    MessageDialog dlg = new MessageDialog(MessageDialog.INFO, caption, verticalPanel);
    dlg.addButton("OK", new Operation() {

        @Override
        public void execute() {
            server_.showDialogCompleted(null, false, new SimpleRequestCallback<Void>());
        }
    }, true, false);
    dlg.showModal();
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HTML(com.google.gwt.user.client.ui.HTML) MessageDialog(org.rstudio.core.client.widget.MessageDialog) Operation(org.rstudio.core.client.widget.Operation) HyperlinkLabel(org.rstudio.core.client.widget.HyperlinkLabel) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback)

Aggregations

ClickHandler (com.google.gwt.event.dom.client.ClickHandler)447 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)437 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)168 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)143 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)129 ArrayList (java.util.ArrayList)128 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)110 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)79 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)48 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)47 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)41 PerunError (cz.metacentrum.perun.webgui.model.PerunError)38 HashMap (java.util.HashMap)37 Button (com.google.gwt.user.client.ui.Button)35 HTML (com.google.gwt.user.client.ui.HTML)34 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)33 Button (org.gwtbootstrap3.client.ui.Button)33 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)31 Image (com.google.gwt.user.client.ui.Image)30 Map (java.util.Map)27