Search in sources :

Example 11 with RunAsyncCallback

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

the class ConfigLoader method load.

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

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

        @Override
        public void onSuccess() {
            final Page page = pageProviders.get(pageId).get();
            if (page == null) {
                callback.onFailure(new Exception("ConfigLoader didn't know how to handle " + place.toString()));
            } else if (page instanceof DbPage) {
                dispatch.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {

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

                    @Override
                    public void onSuccess(SchemaDTO result) {
                        DbPageState dbPlace = (DbPageState) place;
                        ((DbPage) page).go(result.getDatabaseById(dbPlace.getDatabaseId()));
                        callback.onSuccess(page);
                    }
                });
            } else {
                page.navigate(place);
                callback.onSuccess(page);
            }
        }
    });
}
Also used : RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) IndicatorLinkPage(org.activityinfo.ui.client.page.config.link.IndicatorLinkPage) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) SchemaDTO(org.activityinfo.legacy.shared.model.SchemaDTO)

Example 12 with RunAsyncCallback

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

the class PerspectiveManager method showSchedulesPerspective.

private void showSchedulesPerspective() {
    GWT.runAsync(new RunAsyncCallback() {

        public void onSuccess() {
            DeckPanel contentDeck = MantleApplication.getInstance().getContentDeck();
            if (MantleApplication.getInstance().getContentDeck().getWidgetIndex(SchedulesPerspectivePanel.getInstance()) == -1) {
                contentDeck.add(SchedulesPerspectivePanel.getInstance());
            } else {
                SchedulesPerspectivePanel.getInstance().refresh();
            }
            contentDeck.showWidget(contentDeck.getWidgetIndex(SchedulesPerspectivePanel.getInstance()));
        }

        public void onFailure(Throwable reason) {
        }
    });
    setCheckMMenuItem(false, true);
}
Also used : DeckPanel(com.google.gwt.user.client.ui.DeckPanel) RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback)

Example 13 with RunAsyncCallback

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

the class RefreshSchedulesCommand method performOperation.

protected void performOperation(boolean feedback) {
    try {
        // $NON-NLS-1$
        final String url = GWT.getHostPageBaseURL() + "api/repo/files/canAdminister";
        RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, url);
        requestBuilder.setHeader("accept", "text/plain");
        requestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
        requestBuilder.sendRequest(null, new RequestCallback() {

            public void onError(Request request, Throwable caught) {
                GWT.runAsync(new RunAsyncCallback() {

                    public void onSuccess() {
                        SchedulesPerspectivePanel.getInstance().refresh();
                    }

                    public void onFailure(Throwable reason) {
                    }
                });
            }

            public void onResponseReceived(Request request, final Response response) {
                GWT.runAsync(new RunAsyncCallback() {

                    public void onSuccess() {
                        SchedulesPerspectivePanel.getInstance().refresh();
                    }

                    public void onFailure(Throwable reason) {
                    }
                });
            }
        });
    } catch (RequestException e) {
        Window.alert(e.getMessage());
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RequestCallback(com.google.gwt.http.client.RequestCallback) RunAsyncCallback(com.google.gwt.core.client.RunAsyncCallback) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

RunAsyncCallback (com.google.gwt.core.client.RunAsyncCallback)13 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 PermissionRefusedException (org.activityinfo.client.local.capability.PermissionRefusedException)1 Synchronizer (org.activityinfo.client.local.sync.Synchronizer)1 Page (org.activityinfo.client.page.Page)1 IndicatorLinkPage (org.activityinfo.client.page.config.link.IndicatorLinkPage)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 SchemaDTO (org.activityinfo.legacy.shared.model.SchemaDTO)1 GetSchema (org.activityinfo.shared.command.GetSchema)1 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)1 PermissionRefusedException (org.activityinfo.ui.client.local.capability.PermissionRefusedException)1 IndicatorLinkPage (org.activityinfo.ui.client.page.config.link.IndicatorLinkPage)1