Search in sources :

Example 1 with Page

use of org.activityinfo.client.page.Page 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.client.page.config.link.IndicatorLinkPage) Page(org.activityinfo.client.page.Page) GetSchema(org.activityinfo.shared.command.GetSchema) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO)

Aggregations

RunAsyncCallback (com.google.gwt.core.client.RunAsyncCallback)1 Page (org.activityinfo.client.page.Page)1 IndicatorLinkPage (org.activityinfo.client.page.config.link.IndicatorLinkPage)1 GetSchema (org.activityinfo.shared.command.GetSchema)1 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)1