use of org.rstudio.studio.client.rmarkdown.events.ConvertToShinyDocEvent in project rstudio by rstudio.
the class RmdOutput method onRmdRenderCompleted.
@Override
public void onRmdRenderCompleted(RmdRenderCompletedEvent event) {
renderInProgress_ = false;
// that instead
if (onRenderCompleted_ != null) {
onRenderCompleted_.execute();
onRenderCompleted_ = null;
return;
}
// ignore failures and completed Shiny docs (the latter are handled when
// the server starts rather than when the render process is finished)
final RmdRenderResult result = event.getResult();
if (result.isShinyDocument()) {
shinyDoc_ = null;
return;
}
if (result.hasShinyContent() && !result.isShinyDocument()) {
// If the result has Shiny content but wasn't rendered as a Shiny
// document, suggest rendering as a Shiny document instead
new ShinyDocumentWarningDialog(new OperationWithInput<Integer>() {
@Override
public void execute(Integer input) {
switch(input) {
case ShinyDocumentWarningDialog.RENDER_SHINY_NO:
if (result.getSucceeded())
displayRenderResult(result);
break;
case ShinyDocumentWarningDialog.RENDER_SHINY_ONCE:
rerenderAsShiny(result);
break;
case ShinyDocumentWarningDialog.RENDER_SHINY_ALWAYS:
events_.fireEvent(new ConvertToShinyDocEvent(result.getTargetFile()));
break;
}
}
}).showModal();
} else if (result.getSucceeded()) {
displayRenderResult(event.getResult());
}
}
Aggregations