Search in sources :

Example 1 with PlotsToolbar

use of org.rstudio.studio.client.workbench.views.plots.ui.PlotsToolbar 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)

Aggregations

Command (com.google.gwt.user.client.Command)1 Size (org.rstudio.core.client.Size)1 PublishHtmlSource (org.rstudio.studio.client.rsconnect.model.PublishHtmlSource)1 RSConnectPublishButton (org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton)1 PlotsToolbar (org.rstudio.studio.client.workbench.views.plots.ui.PlotsToolbar)1