Search in sources :

Example 31 with WindowEx

use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.

the class SavePlotAsHandler method webSavePlotAs.

private void webSavePlotAs(final FileSystemItem targetPath, final boolean overwrite, final boolean viewAfterSave, final Operation onCompleted) {
    globalDisplay_.openProgressWindow("_blank", "Converting Plot...", new OperationWithInput<WindowEx>() {

        public void execute(final WindowEx window) {
            savePlotAs(targetPath, overwrite, viewAfterSave, onCompleted, new PlotSaveAsUIHandler() {

                @Override
                public void onSuccess() {
                    // redirect window to view file
                    final String url = server_.getFileUrl(targetPath);
                    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                        @Override
                        public void execute() {
                            window.replaceLocationHref(url);
                        }
                    });
                }

                @Override
                public void onError(ServerError error) {
                    window.close();
                    globalDisplay_.showErrorMessage("Error Saving Plot", error.getUserMessage());
                }

                @Override
                public void onOverwritePrompt() {
                    window.close();
                }
            });
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) ServerError(org.rstudio.studio.client.server.ServerError) WindowEx(org.rstudio.core.client.dom.WindowEx)

Example 32 with WindowEx

use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.

the class ChunkWindowManager method forwardEventToSatelliteAllChunks.

private void forwardEventToSatelliteAllChunks(String docId, CrossWindowEvent<?> event) {
    for (Pair<String, String> chunkPair : satelliteChunks_) {
        if (chunkPair.first != docId)
            continue;
        String chunkId = chunkPair.second;
        String windowName = getName(docId, chunkId);
        if (pSatelliteManager_.get().satelliteWindowExists(windowName)) {
            WindowEx satelliteWindow = pSatelliteManager_.get().getSatelliteWindowObject(windowName);
            events_.fireEventToSatellite(event, satelliteWindow);
        }
    }
}
Also used : WindowEx(org.rstudio.core.client.dom.WindowEx)

Example 33 with WindowEx

use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.

the class ChunkWindowManager method onChunkSatelliteCloseAllWindow.

@Override
public void onChunkSatelliteCloseAllWindow(ChunkSatelliteCloseAllWindowEvent event) {
    ArrayList<Pair<String, String>> newSatelliteChunks = new ArrayList<Pair<String, String>>();
    for (Pair<String, String> chunkPair : satelliteChunks_) {
        String docId = chunkPair.first;
        String chunkId = chunkPair.second;
        if (docId != event.getDocId()) {
            newSatelliteChunks.add(chunkPair);
            continue;
        }
        String windowName = getName(docId, chunkId);
        if (pSatelliteManager_.get().satelliteWindowExists(windowName)) {
            WindowEx satelliteWindow = pSatelliteManager_.get().getSatelliteWindowObject(windowName);
            satelliteWindow.close();
        }
    }
    satelliteChunks_ = newSatelliteChunks;
}
Also used : ArrayList(java.util.ArrayList) WindowEx(org.rstudio.core.client.dom.WindowEx)

Example 34 with WindowEx

use of org.rstudio.core.client.dom.WindowEx in project rstudio by rstudio.

the class ViewerPresenter method onViewerZoom.

@Handler
public void onViewerZoom() {
    Size windowSize = ZoomUtils.getZoomWindowSize(display_.getViewerFrameSize(), zoomWindowDefaultSize_);
    // open and activate window
    NewWindowOptions options = new NewWindowOptions();
    options.setName("_rstudio_viewer_zoom");
    options.setFocus(true);
    options.setCallback(new OperationWithInput<WindowEx>() {

        @Override
        public void execute(WindowEx input) {
            zoomWindow_ = input;
        }
    });
    globalDisplay_.openMinimalWindow(display_.getUrl(), false, windowSize.width, windowSize.height, options);
}
Also used : NewWindowOptions(org.rstudio.studio.client.common.GlobalDisplay.NewWindowOptions) Size(org.rstudio.core.client.Size) WindowEx(org.rstudio.core.client.dom.WindowEx) EnabledChangedHandler(org.rstudio.core.client.command.EnabledChangedHandler) Handler(org.rstudio.core.client.command.Handler)

Aggregations

WindowEx (org.rstudio.core.client.dom.WindowEx)34 JsArrayString (com.google.gwt.core.client.JsArrayString)5 Size (org.rstudio.core.client.Size)5 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)3 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)3 Document (com.google.gwt.dom.client.Document)3 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)3 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)3 ArrayList (java.util.ArrayList)3 Point (org.rstudio.core.client.Point)3 FindTextBox (org.rstudio.core.client.widget.FindTextBox)3 NewWindowOptions (org.rstudio.studio.client.common.GlobalDisplay.NewWindowOptions)3 Command (com.google.gwt.user.client.Command)2 ElementEx (org.rstudio.core.client.dom.ElementEx)2 JsObject (org.rstudio.core.client.js.JsObject)2 CanFocus (org.rstudio.core.client.widget.CanFocus)2 Operation (org.rstudio.core.client.widget.Operation)2 ToolbarButton (org.rstudio.core.client.widget.ToolbarButton)2 ToolbarLabel (org.rstudio.core.client.widget.ToolbarLabel)2 SatelliteWindowGeometry (org.rstudio.studio.client.common.satellite.model.SatelliteWindowGeometry)2