use of org.rstudio.studio.client.htmlpreview.model.HTMLPreviewParams in project rstudio by rstudio.
the class HTMLPreviewApplicationWindow method onInitialize.
@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
Window.setTitle("RStudio: Preview HTML");
// create the presenter and activate it with the passed params
HTMLPreviewParams htmlPreviewParams = params.<HTMLPreviewParams>cast();
presenter_ = pPresenter_.get();
presenter_.onActivated(htmlPreviewParams);
// enable command processing
pDesktopHooks_.get();
// make it fill the containing layout panel
Widget presWidget = presenter_.asWidget();
mainPanel.add(presWidget);
mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}
use of org.rstudio.studio.client.htmlpreview.model.HTMLPreviewParams in project rstudio by rstudio.
the class TextEditingTarget method doHtmlPreview.
private void doHtmlPreview(final Provider<HTMLPreviewParams> pParams) {
// command to show the preview window
final Command showPreviewWindowCommand = new Command() {
@Override
public void execute() {
HTMLPreviewParams params = pParams.get();
events_.fireEvent(new ShowHTMLPreviewEvent(params));
}
};
// command to run the preview
final Command runPreviewCommand = new Command() {
@Override
public void execute() {
final HTMLPreviewParams params = pParams.get();
server_.previewHTML(params, new SimpleRequestCallback<Boolean>());
}
};
if (pParams.get().isNotebook()) {
saveThenExecute(null, new Command() {
@Override
public void execute() {
generateNotebook(new Command() {
@Override
public void execute() {
showPreviewWindowCommand.execute();
runPreviewCommand.execute();
}
});
}
});
} else // due to popup activation rules but at least it will show up
if (isNewDoc()) {
saveThenExecute(null, CommandUtil.join(showPreviewWindowCommand, runPreviewCommand));
} else // beat the popup blockers) then save & run
if (dirtyState().getValue()) {
showPreviewWindowCommand.execute();
saveThenExecute(null, runPreviewCommand);
} else // otherwise show the preview window then run the preview
{
showPreviewWindowCommand.execute();
runPreviewCommand.execute();
}
}
use of org.rstudio.studio.client.htmlpreview.model.HTMLPreviewParams in project rstudio by rstudio.
the class HTMLPreviewApplicationWindow method reactivate.
@Override
public void reactivate(JavaScriptObject params) {
if (params != null) {
HTMLPreviewParams htmlPreviewParams = params.<HTMLPreviewParams>cast();
presenter_.onActivated(htmlPreviewParams);
}
}
Aggregations