use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.
the class EmbedDialog method show.
public void show(final DataEntryPlace place) {
final String url = "http://www.activityinfo.org/embed.html?sites=" + FilterUrlSerializer.toUrlFragment(place.getFilter());
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(SchemaDTO result) {
Filter filter = place.getFilter();
if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Activity)) {
ActivityDTO singleActivity = result.getActivityById(filter.getRestrictedCategory(DimensionType.Activity));
showPublished(singleActivity, url);
} else if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Database)) {
MessageBox.alert("foo", "not impl", null);
}
}
});
}
use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.
the class SiteGridPanel method updateHeading.
private void updateHeading(final Filter filter) {
setHeading(I18N.CONSTANTS.sitesHeader());
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(SchemaDTO result) {
if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Activity)) {
int activityId = filter.getRestrictedCategory(DimensionType.Activity);
ActivityDTO activity = result.getActivityById(activityId);
setHeading(activity.getDatabase().getName() + " - " + activity.getName());
} else if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Database)) {
int databaseId = filter.getRestrictedCategory(DimensionType.Database);
UserDatabaseDTO db = result.getDatabaseById(databaseId);
setHeading(db.getName());
}
}
});
}
use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.
the class DefaultColumnModelProvider method fetchColumnModels.
@Override
public void fetchColumnModels(final Filter filter, final GroupingModel grouping, final AsyncCallback<ColumnModel> callback) {
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(SchemaDTO result) {
if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Activity)) {
ActivityDTO singleActivity = result.getActivityById(filter.getRestrictedCategory(DimensionType.Activity));
callback.onSuccess(forSingleActivity(grouping, singleActivity));
} else if (filter.isDimensionRestrictedToSingleCategory(DimensionType.Database)) {
UserDatabaseDTO singleDatabase = result.getDatabaseById(filter.getRestrictedCategory(DimensionType.Database));
callback.onSuccess(forSingleDatabase(grouping, singleDatabase));
} else {
callback.onSuccess(forMultipleDatabases(grouping, result));
}
}
});
}
use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.
the class SiteHistoryTab method setSite.
// retrieve all needed data: sitehistoryresult, schema, and locations
public void setSite(final SiteDTO site) {
renderLoading();
dispatcher.execute(new GetSiteHistory(site.getId()), new AsyncCallback<GetSiteHistoryResult>() {
@Override
public void onFailure(Throwable caught) {
renderNotAvailable(site);
}
@Override
public void onSuccess(final GetSiteHistoryResult historyResult) {
if (historyResult.hasHistories()) {
dispatcher.execute(new GetLocations(historyResult.collectLocationIds()), new AsyncCallback<GetLocationsResult>() {
@Override
public void onFailure(Throwable caught) {
renderNotAvailable(site);
}
@Override
public void onSuccess(final GetLocationsResult locationsResult) {
dispatcher.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
renderNotAvailable(site);
}
@Override
public void onSuccess(SchemaDTO schema) {
render(schema, locationsResult.getLocations(), site, historyResult.getSiteHistories());
}
});
}
});
} else {
renderNotAvailable(site);
}
}
});
}
use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.
the class ClusteringOptionsWidget method loadForm.
public void loadForm(final MapLayer layer) {
// mask();
destroyForm();
service.execute(new GetSchema(), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(SchemaDTO schema) {
buildForm(countriesForLayer(schema, layer));
}
});
}
Aggregations