use of org.rstudio.studio.client.workbench.exportplot.model.SavePlotAsImageContext in project rstudio by rstudio.
the class Plots method onSavePlotAsImage.
void onSavePlotAsImage() {
view_.bringToFront();
final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Error");
indicator.onProgress("Preparing to export plot...");
// get the default directory
FileSystemItem defaultDir = ExportPlotUtils.getDefaultSaveDirectory(workbenchContext_.getCurrentWorkingDir());
// get context
server_.getSavePlotContext(defaultDir.getPath(), new SimpleRequestCallback<SavePlotAsImageContext>() {
@Override
public void onResponseReceived(SavePlotAsImageContext context) {
indicator.onCompleted();
exportPlot_.savePlotAsImage(globalDisplay_, server_, context, ExportPlotOptions.adaptToSize(uiPrefs_.get().exportPlotOptions().getValue(), getPlotSize()), saveExportOptionsOperation_);
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
use of org.rstudio.studio.client.workbench.exportplot.model.SavePlotAsImageContext in project rstudio by rstudio.
the class ViewerPresenter method onViewerSaveAsImage.
@Handler
public void onViewerSaveAsImage() {
display_.bringToFront();
final ProgressIndicator indicator = globalDisplay_.getProgressIndicator("Error");
indicator.onProgress("Preparing to export plot...");
// get the default directory
FileSystemItem defaultDir = ExportPlotUtils.getDefaultSaveDirectory(workbenchContext_.getCurrentWorkingDir());
// get context
server_.getViewerExportContext(defaultDir.getPath(), new SimpleRequestCallback<SavePlotAsImageContext>() {
@Override
public void onResponseReceived(SavePlotAsImageContext context) {
indicator.onCompleted();
new SaveViewerPlotAsImageDesktopDialog(globalDisplay_, display_.getUrl(), context, ExportPlotOptions.adaptToSize(pUIPrefs_.get().exportViewerOptions().getValue(), display_.getViewerFrameSize()), saveExportOptionsOperation_).showModal();
}
@Override
public void onError(ServerError error) {
indicator.onError(error.getUserMessage());
}
});
}
Aggregations