Search in sources :

Example 1 with ShinyViewerType

use of org.rstudio.studio.client.shiny.model.ShinyViewerType in project rstudio by rstudio.

the class ShinyViewerTypePopupMenu method getDynamicPopupMenu.

@Override
public void getDynamicPopupMenu(final ToolbarPopupMenu.DynamicPopupMenuCallback callback) {
    final ToolbarPopupMenu menu = this;
    server_.getShinyViewerType(new ServerRequestCallback<ShinyViewerType>() {

        @Override
        public void onResponseReceived(ShinyViewerType response) {
            int viewerType = response.getViewerType();
            commands_.shinyRunInPane().setChecked(false);
            commands_.shinyRunInViewer().setChecked(false);
            commands_.shinyRunInBrowser().setChecked(false);
            if (ShinyViewerType.SHINY_VIEWER_PANE == viewerType)
                commands_.shinyRunInPane().setChecked(true);
            if (ShinyViewerType.SHINY_VIEWER_WINDOW == viewerType)
                commands_.shinyRunInViewer().setChecked(true);
            if (ShinyViewerType.SHINY_VIEWER_BROWSER == viewerType)
                commands_.shinyRunInBrowser().setChecked(true);
            callback.onPopupMenu(menu);
        }

        @Override
        public void onError(ServerError error) {
            callback.onPopupMenu(menu);
        }
    });
}
Also used : ShinyViewerType(org.rstudio.studio.client.shiny.model.ShinyViewerType) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) ServerError(org.rstudio.studio.client.server.ServerError)

Aggregations

ToolbarPopupMenu (org.rstudio.core.client.widget.ToolbarPopupMenu)1 ServerError (org.rstudio.studio.client.server.ServerError)1 ShinyViewerType (org.rstudio.studio.client.shiny.model.ShinyViewerType)1