Search in sources :

Example 1 with RunAsyncCallback

use of com.google.gwt.core.client.RunAsyncCallback 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 RunAsyncCallback

use of com.google.gwt.core.client.RunAsyncCallback in project pentaho-platform by pentaho.

the class MantleController method activateWaitingSecurityPanel.

public void activateWaitingSecurityPanel(boolean activate) {
    if (activate && (adminPanelAwaitingActivation != null)) {
        for (int i = 0; i < MantleXul.getInstance().getAdminContentDeck().getWidgetCount(); i++) {
            Widget w = MantleXul.getInstance().getAdminContentDeck().getWidget(i);
            if (adminPanelAwaitingActivation.id.equals(w.getElement().getId())) {
                ISysAdminPanel sysAdminPanel = sysAdminPanelsMap.get(adminPanelAwaitingActivation.id);
                if (sysAdminPanel != null) {
                    sysAdminPanel.activate();
                }
                break;
            }
        }
        GWT.runAsync(new RunAsyncCallback() {

            public void onSuccess() {
                if (UserRolesAdminPanelController.getInstance().getId().equals(adminPanelAwaitingActivation.id)) {
                    model.loadUserRolesAdminPanel();
                    UserRolesAdminPanelController.getInstance().getElement().setId((UserRolesAdminPanelController.getInstance()).getId());
                } else if ((EmailAdminPanelController.getInstance()).getId().equals(adminPanelAwaitingActivation.id)) {
                    model.loadEmailAdminPanel();
                    EmailAdminPanelController.getInstance().getElement().setId((EmailAdminPanelController.getInstance()).getId());
                } else if ((ContentCleanerPanel.getInstance()).getId().equals(adminPanelAwaitingActivation.id)) {
                    model.loadSettingsPanel();
                    ContentCleanerPanel.getInstance().getElement().setId((ContentCleanerPanel.getInstance()).getId());
                } else {
                    model.loadAdminContent(adminPanelAwaitingActivation.id, adminPanelAwaitingActivation.url);
                }
            }

            public void onFailure(Throwable reason) {
            }
        });
    } else if (!activate) {
        adminPanelAwaitingActivation = null;
    }
}
Also used : RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) Widget(com.google.gwt.user.client.ui.Widget) ISysAdminPanel(org.pentaho.mantle.client.admin.ISysAdminPanel)

Example 3 with RunAsyncCallback

use of com.google.gwt.core.client.RunAsyncCallback in project activityinfo by bedatadriven.

the class ReportLoader method load.

@Override
public void load(final PageId pageId, final PageState pageState, final AsyncCallback<Page> callback) {
    GWT.runAsync(new RunAsyncCallback() {

        @Override
        public void onFailure(Throwable reason) {
            callback.onFailure(reason);
        }

        @Override
        public void onSuccess() {
            if (ReportsPage.PAGE_ID.equals(pageId)) {
                callback.onSuccess(reportsPage.get());
            } else if (ReportDesignPage.PAGE_ID.equals(pageId)) {
                ReportDesignPage page = reportDesignPage.get();
                page.navigate(pageState);
                callback.onSuccess(page);
            } else {
                GWT.log("ReportLoader received a request it didn't know how to handle: " + pageState.toString(), null);
            }
        }
    });
}
Also used : RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback)

Example 4 with RunAsyncCallback

use of com.google.gwt.core.client.RunAsyncCallback in project gwt-test-utils by gwt-test-utils.

the class MainGwtTest method runAsync.

@Test
public void runAsync() {
    // Test
    GWT.runAsync(new RunAsyncCallback() {

        @Override
        public void onFailure(Throwable reason) {
            fail("GWT.runAsync() has called \"onFailure\" callback");
        }

        @Override
        public void onSuccess() {
            success = true;
        }
    });
    // Then
    assertThat(success).isTrue();
}
Also used : RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) Test(org.junit.Test)

Example 5 with RunAsyncCallback

use of com.google.gwt.core.client.RunAsyncCallback in project rstudio by rstudio.

the class RStudio method delayLoadApplication.

private void delayLoadApplication(final Command dismissProgressAnimation) {
    final RunAsyncCallback runCallback = new RunAsyncCallback() {

        public void onFailure(Throwable reason) {
            dismissProgressAnimation.execute();
            Window.alert("Error: " + reason.getMessage());
        }

        public void onSuccess() {
            // TODO (gary) This early loading of XTermWidget dependencies needs to be
            // removed once I figure out why XTermWidget.load in 
            // TerminalPane:createMainWidget) isn't sufficient. Suspect due to xterm.js
            // loading its add-ons (fit.js) but need to investigate. 
            XTermWidget.load(new Command() {

                public void execute() {
                    AceEditor.load(new Command() {

                        public void execute() {
                            ensureStylesInjected();
                            String view = Window.Location.getParameter("view");
                            if (VCSApplication.NAME.equals(view)) {
                                RStudioGinjector.INSTANCE.getVCSApplication().go(RootLayoutPanel.get(), dismissProgressAnimation);
                            } else if (HTMLPreviewApplication.NAME.equals(view)) {
                                RStudioGinjector.INSTANCE.getHTMLPreviewApplication().go(RootLayoutPanel.get(), dismissProgressAnimation);
                            } else if (ShinyApplicationSatellite.NAME.equals(view)) {
                                RStudioGinjector.INSTANCE.getShinyApplicationSatellite().go(RootLayoutPanel.get(), dismissProgressAnimation);
                            } else if (RmdOutputSatellite.NAME.equals(view)) {
                                RStudioGinjector.INSTANCE.getRmdOutputSatellite().go(RootLayoutPanel.get(), dismissProgressAnimation);
                            } else if (view != null && view.startsWith(SourceSatellite.NAME_PREFIX)) {
                                SourceSatellite satellite = new SourceSatellite(view);
                                satellite.go(RootLayoutPanel.get(), dismissProgressAnimation);
                            } else if (view != null && view.startsWith(ChunkSatellite.NAME_PREFIX)) {
                                ChunkSatellite satellite = new ChunkSatellite(view);
                                satellite.go(RootLayoutPanel.get(), dismissProgressAnimation);
                            } else {
                                RStudioGinjector.INSTANCE.getApplication().go(RootLayoutPanel.get(), dismissProgressAnimation);
                            }
                        }
                    });
                }
            });
        }
    };
    GWT.runAsync(runCallback);
}
Also used : RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) Command(com.google.gwt.user.client.Command) SourceSatellite(org.rstudio.studio.client.workbench.views.source.SourceSatellite) ChunkSatellite(org.rstudio.studio.client.workbench.views.source.editors.text.ChunkSatellite)

Aggregations

RunAsyncCallback (com.google.gwt.core.client.RunAsyncCallback)10 Request (com.google.gwt.http.client.Request)1 RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 Command (com.google.gwt.user.client.Command)1 DeckPanel (com.google.gwt.user.client.ui.DeckPanel)1 RootLayoutPanel (com.google.gwt.user.client.ui.RootLayoutPanel)1 Widget (com.google.gwt.user.client.ui.Widget)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)1 PermissionRefusedException (org.activityinfo.ui.client.local.capability.PermissionRefusedException)1 IndicatorLinkPage (org.activityinfo.ui.client.page.config.link.IndicatorLinkPage)1 ResourcePage (org.activityinfo.ui.client.page.resource.ResourcePage)1 ResourcePlace (org.activityinfo.ui.client.page.resource.ResourcePlace)1 Test (org.junit.Test)1 ISysAdminPanel (org.pentaho.mantle.client.admin.ISysAdminPanel)1 AppCommand (org.rstudio.core.client.command.AppCommand)1 CommandHandler (org.rstudio.core.client.command.CommandHandler)1