Search in sources :

Example 31 with HTML

use of com.google.gwt.user.client.ui.HTML in project rstudio by rstudio.

the class VersionControlPage method acceptNavigation.

@Override
protected boolean acceptNavigation() {
    SessionInfo sessionInfo = RStudioGinjector.INSTANCE.getSession().getSessionInfo();
    if (!sessionInfo.isVcsAvailable(getVcsId())) {
        NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
        VerticalPanel verticalPanel = new VerticalPanel();
        verticalPanel.addStyleName(styles.vcsNotInstalledWidget());
        if (Desktop.isDesktop()) {
            HTML msg = new HTML("<p>" + getTitle() + " was not detected " + "on the system path.</p>" + "<p>To create projects from " + getTitle() + " " + "repositories you should install " + getTitle() + " " + "and then restart RStudio.</p>" + "<p>Note that if " + getTitle() + " is installed " + "and not on the path, then you can specify its location using " + "the " + (BrowseCap.isMacintosh() ? "Preferences" : "Options") + " dialog.</p>");
            msg.setWidth("100%");
            verticalPanel.add(msg);
            HelpLink vcsHelpLink = new VcsHelpLink();
            vcsHelpLink.setCaption("Using " + getTitle() + " with RStudio");
            vcsHelpLink.addStyleName(styles.vcsHelpLink());
            verticalPanel.add(vcsHelpLink);
        } else {
            HTML msg = new HTML("<p>An installation of " + getTitle() + " was not detected " + "on this system.</p>" + "<p>To create projects from " + getTitle() + " " + "repositories you should request that your server " + "administrator install the " + getTitle() + " package.</p>");
            msg.setWidth("100%");
            verticalPanel.add(msg);
        }
        MessageDialog dlg = new MessageDialog(MessageDialog.INFO, getTitle() + " Not Found", verticalPanel);
        dlg.addButton("OK", (Operation) null, true, false);
        dlg.showModal();
        return false;
    } else {
        return true;
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) HelpLink(org.rstudio.studio.client.common.HelpLink) VcsHelpLink(org.rstudio.studio.client.common.vcs.VcsHelpLink) SessionInfo(org.rstudio.studio.client.workbench.model.SessionInfo) HTML(com.google.gwt.user.client.ui.HTML) MessageDialog(org.rstudio.core.client.widget.MessageDialog) VcsHelpLink(org.rstudio.studio.client.common.vcs.VcsHelpLink)

Example 32 with HTML

use of com.google.gwt.user.client.ui.HTML in project rstudio by rstudio.

the class ShowContentDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    // main widget is scroll panel with embeddeed html 
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setStylePrimaryName(styleName_);
    HTML htmlContent = new HTML(content_);
    if (isFixedFont_)
        FontSizer.applyNormalFontSize(htmlContent);
    scrollPanel.setWidget(htmlContent);
    // if we don't have a preferred size then size based on content
    Size size = preferredSize_;
    if (size.isEmpty())
        size = DomMetrics.measureHTML(content_, styleName_);
    // compute the widget size and set it
    Size minimumSize = new Size(300, 300);
    size = DomMetrics.adjustedElementSize(size, minimumSize, // pad
    70, // client margin
    100);
    scrollPanel.setSize(size.width + "px", size.height + "px");
    // return it
    return scrollPanel;
}
Also used : Size(org.rstudio.core.client.Size) HTML(com.google.gwt.user.client.ui.HTML) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 33 with HTML

use of com.google.gwt.user.client.ui.HTML in project rstudio by rstudio.

the class GlassAttacher method createGlassWidget.

private static Widget createGlassWidget() {
    HTML glass = new HTML();
    glass.setSize("100%", "100%");
    Element glassElem = glass.getElement();
    glassElem.getStyle().setBackgroundColor("white");
    glassElem.getStyle().setProperty("opacity", "0.0");
    glassElem.getStyle().setProperty("filter", "alpha(opacity=0)");
    return glass;
}
Also used : Element(com.google.gwt.dom.client.Element) HTML(com.google.gwt.user.client.ui.HTML)

Example 34 with HTML

use of com.google.gwt.user.client.ui.HTML 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 35 with HTML

use of com.google.gwt.user.client.ui.HTML 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

HTML (com.google.gwt.user.client.ui.HTML)91 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)26 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)26 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)24 JSONString (com.google.gwt.json.client.JSONString)15 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)14 FlexTable (com.google.gwt.user.client.ui.FlexTable)13 Image (com.google.gwt.user.client.ui.Image)10 Button (org.gwtbootstrap3.client.ui.Button)10 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)8 Test (org.junit.Test)8 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)8 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)7 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)7 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)7 Widget (com.google.gwt.user.client.ui.Widget)7 Label (com.google.gwt.user.client.ui.Label)6 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)5 Command (com.google.gwt.user.client.Command)5 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5