Example usage for com.google.gwt.core.client JavaScriptObject cast

List of usage examples for com.google.gwt.core.client JavaScriptObject cast

Introduction

In this page you can find the example usage for com.google.gwt.core.client JavaScriptObject cast.

Prototype

@Override
@SuppressWarnings("unchecked")
public <T extends JavascriptObjectEquivalent> T cast() 

Source Link

Document

A helper method to enable cross-casting from any JavaScriptObject type to any other JavaScriptObject type.

Usage

From source file:org.rstudio.studio.client.common.satellite.SatelliteManager.java

License:Open Source License

private void registerDesktopChildWindow(String name, JavaScriptObject window) {
    events_.fireEvent(new WindowOpenedEvent(name, (WindowEx) window.cast()));
}

From source file:org.rstudio.studio.client.common.synctex.Synctex.java

License:Open Source License

private void doForwardSearch(String rootDocument, JavaScriptObject sourceLocationObject) {
    SourceLocation sourceLocation = sourceLocationObject.cast();

    final ProgressIndicator indicator = getSyncProgress();
    server_.synctexForwardSearch(rootDocument, sourceLocation, new ServerRequestCallback<PdfLocation>() {

        @Override/*from  ww w. j ava  2 s .c  om*/
        public void onResponseReceived(PdfLocation location) {
            indicator.onCompleted();

            if (location != null)
                eventBus_.fireEvent(new SynctexViewPdfEvent(location));
        }

        @Override
        public void onError(ServerError error) {
            indicator.onError(error.getUserMessage());
        }

    });
}

From source file:org.rstudio.studio.client.common.synctex.Synctex.java

License:Open Source License

private void doInverseSearch(JavaScriptObject pdfLocationObject) {
    PdfLocation pdfLocation = pdfLocationObject.cast();

    final ProgressIndicator indicator = getSyncProgress();
    server_.synctexInverseSearch(pdfLocation, new ServerRequestCallback<SourceLocation>() {

        @Override/*w  ww.  j a  va  2  s . co m*/
        public void onResponseReceived(SourceLocation location) {
            indicator.onCompleted();

            if (location != null)
                goToSourceLocation(location);
        }

        @Override
        public void onError(ServerError error) {
            indicator.onError(error.getUserMessage());
        }
    });
}

From source file:org.rstudio.studio.client.dataviewer.DataViewerWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    DataItem item = params.cast();
    Window.setTitle(item.getCaption());
    DataViewerPresenter appPresenter = pPresenter_.get();
    appPresenter.showData(item);//  w ww.  j  a  v a 2  s . c om

    // make it fill the containing layout panel
    Widget presWidget = appPresenter.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.rstudio.studio.client.plumber.PlumberAPI.java

License:Open Source License

private void notifyPlumberAPIDisconnected(JavaScriptObject params) {
    PlumberAPIParams apiState = params.cast();
    if (params_ == null)
        return;//w ww  .  j  ava 2 s  .c  o  m

    // remember that this URL is disconnecting (so we don't interrupt R when
    // the window is torn down)
    disconnectingUrl_ = apiState.getUrl();
}

From source file:org.rstudio.studio.client.plumber.PlumberAPI.java

License:Open Source License

private void onPlumberAPIClosed(JavaScriptObject params) {
    PlumberAPIParams apiState = params.cast();

    // this completes any pending disconnection
    disconnectingUrl_ = null;//from   ww w . jav  a  2  s  .  c om

    // if we were asked not to stop when the window closes (i.e. when 
    // changing viewer types), bail out
    if (!stopOnNextClose_) {
        stopOnNextClose_ = true;
        return;
    }

    // If the API is stopping, then the user initiated the stop by
    // closing the API window. Interrupt R to stop the Plumber API.
    if (StringUtil.equals(apiState.getState(), PlumberAPIParams.STATE_STOPPING)) {
        if (commands_.interruptR().isEnabled())
            commands_.interruptR().execute();
        apiState.setState(PlumberAPIParams.STATE_STOPPED);
    }
    eventBus_.fireEvent(new PlumberAPIStatusEvent((PlumberAPIParams) params.cast()));
}

From source file:org.rstudio.studio.client.plumber.ui.PlumberAPIWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    PlumberAPIParams appParams = params.cast();
    Window.setTitle(appParams.getPath() + " - " + "Plumber");
    PlumberAPIPresenter appPresenter = pPresenter_.get();
    appPresenter.loadApp(appParams);//from   w  ww  .ja v a 2 s  .  c o  m

    // make it fill the containing layout panel
    Widget presWidget = appPresenter.asWidget();
    mainPanel.add(presWidget);
    mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
    mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}

From source file:org.rstudio.studio.client.rmarkdown.RmdOutput.java

License:Open Source License

private void notifyRmdOutputClosed(JavaScriptObject closeParams) {
    // save anchor location for presentations and scroll position for 
    // documents/*from w w  w.  j a v a 2s .  c  o  m*/
    RmdPreviewParams params = closeParams.cast();
    cacheDocPosition(params.getResult(), params.getScrollPosition(), params.getAnchor());

    // if this is a Shiny document, stop the associated process
    if (params.isShinyDocument() && !restarting_) {
        server_.terminateRenderRmd(true, new VoidServerRequestCallback());
    }
    shinyDoc_ = null;
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdOutputWindow.java

License:Open Source License

@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
    presenter_ = pPresenter_.get();/*ww w .  j  ava 2 s  .  c  o m*/
    showRenderResult((RmdPreviewParams) params.cast());

    // 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);
}

From source file:org.rstudio.studio.client.rmarkdown.ui.RmdOutputWindow.java

License:Open Source License

@Override
public void reactivate(JavaScriptObject params) {
    showRenderResult((RmdPreviewParams) params.cast());
}