Search in sources :

Example 1 with RSConnectPublishButton

use of org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton in project rstudio by rstudio.

the class PlotsPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_PLOT, true, commands_.savePlotAsImage());
    publishButton_.setPublishHtmlSource(new PublishHtmlSource() {

        @Override
        public String getTitle() {
            return "Current Plot";
        }

        @Override
        public void generatePublishHtml(final CommandWithArg<String> onComplete) {
            dependencies_.withRMarkdown("Publishing plots", new Command() {

                @Override
                public void execute() {
                    final Size size = ZoomUtils.getZoomedSize(getPlotFrameSize(), new Size(400, 350), new Size(800, 700));
                    server_.plotsCreateRPubsHtml("Plot", "", size.width, size.height, new SimpleRequestCallback<String>() {

                        @Override
                        public void onResponseReceived(String rpubsHtmlFile) {
                            onComplete.execute(rpubsHtmlFile);
                        }
                    });
                }
            });
        }
    });
    plotsToolbar_ = new PlotsToolbar(commands_, publishButton_);
    return plotsToolbar_;
}
Also used : Command(com.google.gwt.user.client.Command) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) PublishHtmlSource(org.rstudio.studio.client.rsconnect.model.PublishHtmlSource) Size(org.rstudio.core.client.Size) PlotsToolbar(org.rstudio.studio.client.workbench.views.plots.ui.PlotsToolbar)

Example 2 with RSConnectPublishButton

use of org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton in project rstudio by rstudio.

the class PresentationPane method createMainToolbar.

@Override
protected Toolbar createMainToolbar() {
    boolean isTutorial = session_.getSessionInfo().getPresentationState().isTutorial();
    Toolbar toolbar = new Toolbar();
    slideNavigationMenu_ = new SlideNavigationToolbarMenu(toolbar);
    slideNavigationMenu_.setEditButtonVisible(!isTutorial);
    toolbar.addLeftSeparator();
    toolbar.addLeftWidget(commands_.presentationFullscreen().createToolbarButton());
    // More
    if (!isTutorial) {
        ToolbarPopupMenu moreMenu = new ToolbarPopupMenu();
        moreMenu.addItem(commands_.clearPresentationCache().createMenuItem(false));
        moreMenu.addSeparator();
        moreMenu.addItem(commands_.presentationViewInBrowser().createMenuItem(false));
        moreMenu.addItem(commands_.presentationSaveAsStandalone().createMenuItem(false));
        ToolbarButton moreButton = new ToolbarButton("More", new ImageResource2x(StandardIcons.INSTANCE.more_actions2x()), moreMenu);
        toolbar.addRightWidget(moreButton);
        // Create the publish button and wire it to our HTML generator
        publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_PRES, false, null);
        publishButton_.setPublishHtmlSource(new PublishHtmlSource() {

            @Override
            public void generatePublishHtml(final CommandWithArg<String> onCompleted) {
                server_.createPresentationRPubsSource(new SimpleRequestCallback<PresentationRPubsSource>() {

                    @Override
                    public void onResponseReceived(PresentationRPubsSource source) {
                        onCompleted.execute(source.getSourceFilePath());
                    }

                    @Override
                    public void onError(ServerError error) {
                        display_.showErrorMessage("Error Saving Presentation", Presentation.getErrorMessage(error));
                    }
                });
            }

            @Override
            public String getTitle() {
                return "Presentation:\n" + getPresentationTitle();
            }
        });
        toolbar.addRightSeparator();
        toolbar.addRightWidget(publishButton_);
    } else {
        toolbar.addRightWidget(commands_.tutorialFeedback().createToolbarButton());
    }
    toolbar.addRightSeparator();
    toolbar.addRightWidget(refreshButton_ = commands_.refreshPresentation().createToolbarButton());
    progressButton_ = new ToolbarButton(CoreResources.INSTANCE.progress_gray(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent e) {
        }
    });
    toolbar.addRightWidget(progressButton_);
    progressButton_.setVisible(false);
    return toolbar;
}
Also used : ServerError(org.rstudio.studio.client.server.ServerError) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) PublishHtmlSource(org.rstudio.studio.client.rsconnect.model.PublishHtmlSource) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) SlideNavigationToolbarMenu(org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu) PresentationRPubsSource(org.rstudio.studio.client.workbench.views.presentation.model.PresentationRPubsSource) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 3 with RSConnectPublishButton

use of org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton in project rstudio by rstudio.

the class ProfilerEditingTargetWidget method createToolbar.

private Toolbar createToolbar(Commands commands, PublishHtmlSource publishHtmlSource) {
    Toolbar toolbar = new EditingTargetToolbar(commands, true);
    toolbar.addLeftWidget(commands.gotoProfileSource().createToolbarButton());
    toolbar.addLeftWidget(commands.saveProfileAs().createToolbarButton());
    toolbar.addRightWidget(publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null));
    publishButton_.setPublishHtmlSource(publishHtmlSource);
    publishButton_.setContentType(RSConnect.CONTENT_TYPE_HTML);
    return toolbar;
}
Also used : EditingTargetToolbar(org.rstudio.studio.client.workbench.views.source.editors.EditingTargetToolbar) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) EditingTargetToolbar(org.rstudio.studio.client.workbench.views.source.editors.EditingTargetToolbar) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 4 with RSConnectPublishButton

use of org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton in project rstudio by rstudio.

the class ShinyApplicationPanel method initToolbar.

@Override
protected void initToolbar(Toolbar toolbar, Commands commands) {
    urlBox_ = new Label("");
    Style style = urlBox_.getElement().getStyle();
    style.setColor("#606060");
    urlBox_.addStyleName(ThemeStyles.INSTANCE.selectableText());
    urlBox_.getElement().getStyle().setMarginRight(7, Unit.PX);
    toolbar.addLeftWidget(urlBox_);
    toolbar.addLeftSeparator();
    ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton();
    popoutButton.setText("Open in Browser");
    toolbar.addLeftWidget(popoutButton);
    toolbar.addLeftSeparator();
    ToolbarButton refreshButton = commands.reloadShinyApp().createToolbarButton();
    refreshButton.setLeftImage(commands.viewerRefresh().getImageResource());
    refreshButton.getElement().getStyle().setMarginTop(1, Unit.PX);
    toolbar.addLeftWidget(refreshButton);
    publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_NONE, true, null);
    toolbar.addRightWidget(publishButton_);
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) Label(com.google.gwt.user.client.ui.Label) Style(com.google.gwt.dom.client.Style)

Example 5 with RSConnectPublishButton

use of org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton in project rstudio by rstudio.

the class RmdOutputPanel method initToolbar.

@Override
protected void initToolbar(Toolbar toolbar, Commands commands) {
    slideNavigationMenu_ = new SlideNavigationToolbarMenu(toolbar, 400, 100, true);
    fileLabel_ = new ToolbarLabel();
    fileLabel_.addStyleName(ThemeStyles.INSTANCE.subtitle());
    fileLabel_.getElement().getStyle().setMarginRight(7, Unit.PX);
    toolbar.addLeftWidget(fileLabel_);
    fileLabelSeparator_ = toolbar.addLeftSeparator();
    ToolbarButton popoutButton = commands.viewerPopout().createToolbarButton();
    popoutButton.setText("Open in Browser");
    toolbar.addLeftWidget(popoutButton);
    findTextBox_ = new FindTextBox("Find");
    findTextBox_.setIconVisible(true);
    findTextBox_.setOverrideWidth(120);
    findTextBox_.getElement().getStyle().setMarginRight(6, Unit.PX);
    findSeparator_ = toolbar.addLeftSeparator();
    toolbar.addLeftWidget(findTextBox_);
    findTextBox_.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent event) {
            // enter key triggers a find
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                event.preventDefault();
                event.stopPropagation();
                findInTopic(findTextBox_.getValue().trim(), findTextBox_);
                findTextBox_.focus();
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
                findTextBox_.setValue("");
            }
        }

        private void findInTopic(String term, CanFocus findInputSource) {
            // get content window
            WindowEx contentWindow = getFrame().getWindow();
            if (contentWindow == null)
                return;
            if (!contentWindow.find(term, false, false, true, false)) {
                RStudioGinjector.INSTANCE.getGlobalDisplay().showMessage(MessageDialog.INFO, "Find in Page", "No occurences found", findInputSource);
            }
        }
    });
    toolbar.addLeftSeparator();
    publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null);
    toolbar.addRightWidget(publishButton_);
    toolbar.addRightSeparator();
    toolbar.addRightWidget(commands.viewerRefresh().createToolbarButton());
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) CanFocus(org.rstudio.core.client.widget.CanFocus) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) SlideNavigationToolbarMenu(org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu) WindowEx(org.rstudio.core.client.dom.WindowEx) FindTextBox(org.rstudio.core.client.widget.FindTextBox)

Aggregations

RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)8 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)5 Toolbar (org.rstudio.core.client.widget.Toolbar)4 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)3 ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)3 PublishHtmlSource (org.rstudio.studio.client.rsconnect.model.PublishHtmlSource)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)2 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)2 WindowEx (org.rstudio.core.client.dom.WindowEx)2 CanFocus (org.rstudio.core.client.widget.CanFocus)2 FindTextBox (org.rstudio.core.client.widget.FindTextBox)2 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)2 SlideNavigationToolbarMenu (org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu)2 ServerError (org.rstudio.studio.client.server.ServerError)2 EditingTargetToolbar (org.rstudio.studio.client.workbench.views.source.editors.EditingTargetToolbar)2 Animation (com.google.gwt.animation.client.Animation)1 Style (com.google.gwt.dom.client.Style)1 Command (com.google.gwt.user.client.Command)1