Search in sources :

Example 1 with HyperlinkLabel

use of org.rstudio.core.client.widget.HyperlinkLabel 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)

Example 2 with HyperlinkLabel

use of org.rstudio.core.client.widget.HyperlinkLabel in project rstudio by rstudio.

the class SupportPopupMenu method addMenuItem.

private void addMenuItem(FlexTable supportTable, String caption, final String email, final GlobalDisplay globalDisplay) {
    // maintain reference to containing class for closing
    final PopupPanel popupPanel = this;
    // create a hyperlink label for this URL
    HyperlinkLabel link = new HyperlinkLabel(caption, new ClickHandler() {

        public void onClick(ClickEvent event) {
            globalDisplay.openEmailComposeWindow(email, null);
            popupPanel.hide();
        }
    });
    int row = supportTable.getRowCount();
    supportTable.setWidget(row, 0, link);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ThemedPopupPanel(org.rstudio.core.client.widget.ThemedPopupPanel) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) HyperlinkLabel(org.rstudio.core.client.widget.HyperlinkLabel)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 HyperlinkLabel (org.rstudio.core.client.widget.HyperlinkLabel)2 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 HTML (com.google.gwt.user.client.ui.HTML)1 PopupPanel (com.google.gwt.user.client.ui.PopupPanel)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 MessageDialog (org.rstudio.core.client.widget.MessageDialog)1 Operation (org.rstudio.core.client.widget.Operation)1 ThemedPopupPanel (org.rstudio.core.client.widget.ThemedPopupPanel)1 SimpleRequestCallback (org.rstudio.studio.client.common.SimpleRequestCallback)1