Search in sources :

Example 1 with RootLayoutPanel

use of com.google.gwt.user.client.ui.RootLayoutPanel in project rstudio by rstudio.

the class SatelliteApplication method initialize.

public void initialize(String name, SatelliteApplicationView view, Satellite satellite, Provider<AceThemes> pAceThemes, ApplicationUncaughtExceptionHandler uncaughtExHandler, Commands commands) {
    name_ = name;
    view_ = view;
    satellite_ = satellite;
    pAceThemes_ = pAceThemes;
    uncaughtExHandler_ = uncaughtExHandler;
    commands.showRequestLog().addHandler(new CommandHandler() {

        public void onCommand(AppCommand command) {
            GWT.runAsync(new RunAsyncCallback() {

                public void onFailure(Throwable reason) {
                    Window.alert(reason.toString());
                }

                public void onSuccess() {
                    final RequestLogVisualization viz = new RequestLogVisualization();
                    final RootLayoutPanel root = RootLayoutPanel.get();
                    root.add(viz);
                    root.setWidgetTopBottom(viz, 10, Unit.PX, 10, Unit.PX);
                    root.setWidgetLeftRight(viz, 10, Unit.PX, 10, Unit.PX);
                    viz.addCloseHandler(new CloseHandler<RequestLogVisualization>() {

                        public void onClose(CloseEvent<RequestLogVisualization> event) {
                            root.remove(viz);
                        }
                    });
                }
            });
        }
    });
}
Also used : AppCommand(org.rstudio.core.client.command.AppCommand) RequestLogVisualization(org.rstudio.studio.client.application.ui.RequestLogVisualization) RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) CommandHandler(org.rstudio.core.client.command.CommandHandler) RootLayoutPanel(com.google.gwt.user.client.ui.RootLayoutPanel)

Example 2 with RootLayoutPanel

use of com.google.gwt.user.client.ui.RootLayoutPanel in project rstudio by rstudio.

the class RStudio method showProgress.

private Command showProgress() {
    final Label background = new Label();
    background.getElement().getStyle().setZIndex(1000);
    background.getElement().getStyle().setBackgroundColor("#e1e2e5");
    final RootLayoutPanel rootPanel = RootLayoutPanel.get();
    rootPanel.add(background);
    rootPanel.setWidgetTopBottom(background, 0, Style.Unit.PX, 0, Style.Unit.PX);
    rootPanel.setWidgetLeftRight(background, 0, Style.Unit.PX, 0, Style.Unit.PX);
    String progressUrl = ProgressImages.createLargeGray().getUrl();
    StringBuilder str = new StringBuilder();
    str.append("<img src=\"");
    str.append(progressUrl);
    str.append("\"");
    if (BrowseCap.devicePixelRatio() > 1.0)
        str.append("width=24 height=24");
    str.append("/>");
    final SimplePanel progressPanel = new SimplePanel();
    final Element div = progressPanel.getElement();
    div.setInnerHTML(str.toString());
    div.getStyle().setWidth(100, Style.Unit.PCT);
    div.getStyle().setMarginTop(200, Style.Unit.PX);
    div.getStyle().setProperty("textAlign", "center");
    div.getStyle().setZIndex(1000);
    ElementIds.assignElementId(div, ElementIds.LOADING_SPINNER);
    rootPanel.add(progressPanel);
    return new Command() {

        public void execute() {
            try {
                rootPanel.remove(progressPanel);
                rootPanel.remove(background);
            } catch (Exception e) {
                Debug.log(e.toString());
            }
        }
    };
}
Also used : Command(com.google.gwt.user.client.Command) Element(com.google.gwt.dom.client.Element) Label(com.google.gwt.user.client.ui.Label) SlideLabel(org.rstudio.core.client.widget.SlideLabel) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) RootLayoutPanel(com.google.gwt.user.client.ui.RootLayoutPanel)

Aggregations

RootLayoutPanel (com.google.gwt.user.client.ui.RootLayoutPanel)2 RunAsyncCallback (com.google.gwt.core.client.RunAsyncCallback)1 Element (com.google.gwt.dom.client.Element)1 Command (com.google.gwt.user.client.Command)1 Label (com.google.gwt.user.client.ui.Label)1 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)1 AppCommand (org.rstudio.core.client.command.AppCommand)1 CommandHandler (org.rstudio.core.client.command.CommandHandler)1 SlideLabel (org.rstudio.core.client.widget.SlideLabel)1 RequestLogVisualization (org.rstudio.studio.client.application.ui.RequestLogVisualization)1