use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.
the class ProfilerEditingTargetWidget method print.
public void print() {
WindowEx window = profilePage_.getWindow();
window.focus();
window.print();
}
use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.
the class SourceWindowManager method fireEventToSourceWindow.
// Private methods ---------------------------------------------------------
private void fireEventToSourceWindow(String windowId, CrossWindowEvent<?> evt, boolean focus) {
if (StringUtil.isNullOrEmpty(windowId) && !isMainSourceWindow()) {
pSatellite_.get().focusMainWindow();
events_.fireEventToMainWindow(evt);
} else {
// focus window if requested
if (focus) {
pSatelliteManager_.get().activateSatelliteWindow(SourceSatellite.NAME_PREFIX + windowId);
}
WindowEx window = getSourceWindowObject(windowId);
if (window != null) {
events_.fireEventToSatellite(evt, window);
}
}
}
use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.
the class SourceWindowManager method saveWithPrompt.
public void saveWithPrompt(UnsavedChangesItem item, Command onCompleted) {
String windowId = getWindowIdOfDocId(item.getId());
WindowEx window = getSourceWindowObject(windowId);
if (window == null || window.isClosed()) {
onCompleted.execute();
return;
}
// raise the window and ask it to save the item
window.focus();
saveWithPrompt(getSourceWindowObject(windowId), item, onCompleted);
}
use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.
the class SourceWindowManager method updateWindowGeometry.
private boolean updateWindowGeometry() {
final ArrayList<String> changedWindows = new ArrayList<String>();
final JsObject newGeometries = JsObject.createJsObject();
doForAllSourceWindows(new OperationWithInput<Pair<String, WindowEx>>() {
@Override
public void execute(Pair<String, WindowEx> input) {
String windowId = input.first;
WindowEx window = input.second;
// read the window's current geometry
SatelliteWindowGeometry newGeometry = SatelliteWindowGeometry.create(sourceWindows_.get(windowId), window.getScreenX(), window.getScreenY(), window.getInnerWidth(), window.getInnerHeight());
// compare to the old geometry (if any)
if (windowGeometry_.hasKey(windowId)) {
SatelliteWindowGeometry oldGeometry = windowGeometry_.getObject(windowId);
if (!oldGeometry.equals(newGeometry))
changedWindows.add(windowId);
} else {
changedWindows.add(windowId);
}
newGeometries.setObject(windowId, newGeometry);
}
;
});
if (changedWindows.size() > 0)
windowGeometry_ = newGeometries;
return changedWindows.size() > 0;
}
use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.
the class PlotsPanePreviewer method getPreviewClientRect.
public Rectangle getPreviewClientRect() {
WindowEx win = imageFrame_.getElement().<IFrameElementEx>cast().getContentWindow();
Document doc = win.getDocument();
NodeList<Element> images = doc.getElementsByTagName("img");
if (images.getLength() > 0) {
ElementEx img = images.getItem(0).cast();
return new Rectangle(img.getClientLeft(), img.getClientTop(), img.getClientWidth(), img.getClientHeight());
} else {
return new Rectangle(0, 0, 0, 0);
}
}
Aggregations