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);
}
}
});
}
Aggregations