use of org.rstudio.studio.client.workbench.views.source.editors.text.events.ChunkSatelliteWindowOpenedEvent in project rstudio by rstudio.
the class ChunkSatelliteWindow method onInitialize.
@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
chunkWindowParams_ = params.cast();
String title = "RStudio: Notebook Output";
Window.setTitle(title);
ChunkOutputHost chunkOutputHost = new ChunkOutputHost() {
@Override
public void onOutputRemoved(final ChunkOutputWidget widget) {
}
@Override
public void onOutputHeightChanged(ChunkOutputWidget widget, int height, boolean ensureVisible) {
}
};
chunkOutputWidget_ = new ChunkOutputWidget(chunkWindowParams_.getDocId(), chunkWindowParams_.getChunkId(), RmdChunkOptions.create(), ChunkOutputWidget.EXPANDED, // can close
false, chunkOutputHost, ChunkOutputSize.Full);
Element ele = chunkOutputWidget_.getElement();
ele.addClassName(ThemeStyles.INSTANCE.selectableText());
// Append the chunkOutputWidget as an HTML element, not as a widget.
// Why? Chunks are widgets that are attached to the ACE editor as HTML
// elements, not as widgets. The reason being that GWT does not support
// triggering events for widgets that are not attached to their hierarchy.
// Therefore, if we attach this element as a widget, GWT will remove
// events in some cases which will cause functionality to be lost.
mainPanel.getElement().appendChild(chunkOutputWidget_.getElement());
chunkOutputWidget_.getElement().getStyle().setHeight(100, Unit.PCT);
mainPanel.addStyleName("ace_editor");
pEventBus_.get().addHandler(ChunkSatelliteCodeExecutingEvent.TYPE, this);
pEventBus_.get().addHandler(ChunkSatelliteCacheEditorStyleEvent.TYPE, this);
pEventBus_.get().addHandler(ChunkPlotRefreshedEvent.TYPE, this);
pEventBus_.get().addHandler(ChunkPlotRefreshFinishedEvent.TYPE, this);
pEventBus_.get().addHandler(ChunkChangeEvent.TYPE, this);
pEventBus_.get().addHandler(RmdChunkOutputFinishedEvent.TYPE, this);
pEventBus_.get().addHandler(RmdChunkOutputEvent.TYPE, this);
Window.addWindowClosingHandler(new ClosingHandler() {
@Override
public void onWindowClosing(ClosingEvent arg0) {
server_.cleanReplayNotebookChunkPlots(chunkWindowParams_.getDocId(), chunkWindowParams_.getChunkId(), new ServerRequestCallback<Void>() {
@Override
public void onError(ServerError error) {
}
});
}
});
pEventBus_.get().fireEventToMainWindow(new ChunkSatelliteWindowOpenedEvent(chunkWindowParams_.getDocId(), chunkWindowParams_.getChunkId()));
}
Aggregations