Search in sources :

Example 1 with ModalDialogBase

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

the class RSConnect method onRSConnectDeploymentFailed.

@Override
public void onRSConnectDeploymentFailed(final RSConnectDeploymentFailedEvent event) {
    String failedPath = event.getData().getPath();
    // if this looks like an API call, process the path to get the 'bare'
    // server URL
    int pos = failedPath.indexOf("__api__");
    if (pos < 1) {
        // if not, just get the host
        pos = failedPath.indexOf("/", 10) + 1;
    }
    if (pos > 0) {
        failedPath = failedPath.substring(0, pos);
    }
    final String serverUrl = failedPath;
    new ModalDialogBase() {

        @Override
        protected Widget createMainWidget() {
            setText("Publish Failed");
            addOkButton(new ThemedButton("OK", new ClickHandler() {

                @Override
                public void onClick(ClickEvent arg0) {
                    closeDialog();
                }
            }));
            HorizontalPanel panel = new HorizontalPanel();
            Image errorImage = new Image(new ImageResource2x(MessageDialogImages.INSTANCE.dialog_error2x()));
            errorImage.getElement().getStyle().setMarginTop(1, Unit.EM);
            errorImage.getElement().getStyle().setMarginRight(1, Unit.EM);
            panel.add(errorImage);
            panel.add(new HTML("<p>Your content could not be published because " + "of a problem on the server.</p>" + "<p>More information may be available on the server's home " + "page:</p>" + "<p><a href=\"" + serverUrl + "\">" + serverUrl + "</a>" + "</p>" + "<p>If the error persists, contact the server's " + "administrator.</p>" + "<p><small>Error code: " + event.getData().getHttpStatus() + "</small></p>"));
            return panel;
        }
    }.showModal();
}
Also used : ThemedButton(org.rstudio.core.client.widget.ThemedButton) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalDialogBase(org.rstudio.core.client.widget.ModalDialogBase) Widget(com.google.gwt.user.client.ui.Widget) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) HTML(com.google.gwt.user.client.ui.HTML) JsArrayString(com.google.gwt.core.client.JsArrayString) Image(com.google.gwt.user.client.ui.Image)

Aggregations

JsArrayString (com.google.gwt.core.client.JsArrayString)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 HTML (com.google.gwt.user.client.ui.HTML)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 Image (com.google.gwt.user.client.ui.Image)1 Widget (com.google.gwt.user.client.ui.Widget)1 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)1 ModalDialogBase (org.rstudio.core.client.widget.ModalDialogBase)1 ThemedButton (org.rstudio.core.client.widget.ThemedButton)1