use of org.rstudio.studio.client.rsconnect.model.PublishHtmlSource in project rstudio by rstudio.
the class ProfilerEditingTarget method initialize.
public void initialize(SourceDocument document, FileSystemContext fileContext, FileType type, Provider<String> defaultNameProvider) {
// initialize doc, view, and presenter
doc_ = document;
PublishHtmlSource publishHtmlSource = new PublishHtmlSource() {
@Override
public void generatePublishHtml(CommandWithArg<String> onComplete) {
onComplete.execute(htmlLocalPath_);
}
@Override
public String getTitle() {
return "Profile";
}
};
view_ = new ProfilerEditingTargetWidget(commands_, publishHtmlSource);
defaultNameProvider_ = defaultNameProvider;
getName().setValue(getAndSetInitialName());
presenter_.attach(doc_, view_);
}
use of org.rstudio.studio.client.rsconnect.model.PublishHtmlSource 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;
}
use of org.rstudio.studio.client.rsconnect.model.PublishHtmlSource 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_;
}
use of org.rstudio.studio.client.rsconnect.model.PublishHtmlSource in project rstudio by rstudio.
the class ViewerPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
toolbar_ = new Toolbar();
// add html widget buttons
toolbar_.addLeftWidget(commands_.viewerBack().createToolbarButton());
toolbar_.addLeftWidget(commands_.viewerForward().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerZoom().createToolbarButton());
// export commands
exportButtonSeparator_ = toolbar_.addLeftSeparator();
ToolbarPopupMenu exportMenu = new ToolbarPopupMenu();
exportMenu.addItem(commands_.viewerSaveAsImage().createMenuItem(false));
exportMenu.addItem(commands_.viewerCopyToClipboard().createMenuItem(false));
exportMenu.addSeparator();
exportMenu.addItem(commands_.viewerSaveAsWebPage().createMenuItem(false));
exportButton_ = new ToolbarButton("Export", new ImageResource2x(StandardIcons.INSTANCE.export_menu2x()), exportMenu);
toolbar_.addLeftWidget(exportButton_);
exportButton_.setVisible(false);
exportButtonSeparator_.setVisible(false);
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerClear().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerClearAll().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerPopout().createToolbarButton());
toolbar_.addLeftSeparator();
toolbar_.addLeftWidget(commands_.viewerStop().createToolbarButton());
// add publish button
publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_DOCUMENT, true, null);
toolbar_.addRightWidget(publishButton_);
toolbar_.addRightSeparator();
toolbar_.addRightWidget(commands_.viewerRefresh().createToolbarButton());
// create an HTML generator
publishButton_.setPublishHtmlSource(new PublishHtmlSource() {
@Override
public void generatePublishHtml(final CommandWithArg<String> onCompleted) {
server_.viewerCreateRPubsHtml(getTitle(), "", new ServerRequestCallback<String>() {
@Override
public void onResponseReceived(String htmlFile) {
onCompleted.execute(htmlFile);
}
@Override
public void onError(ServerError error) {
globalDisplay_.showErrorMessage("Could Not Publish", error.getMessage());
}
});
}
@Override
public String getTitle() {
String title = frame_.getTitle();
if (StringUtil.isNullOrEmpty(title))
title = "Viewer Content";
return title;
}
});
return toolbar_;
}
Aggregations