use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class BaseMapDialog method loadBaseMaps.
private void loadBaseMaps() {
listView.getStore().removeAll();
listView.getStore().add(googleThumb(GoogleBaseMap.ROADMAP, I18N.CONSTANTS.googleRoadmap()));
listView.getStore().add(googleThumb(GoogleBaseMap.SATELLITE, I18N.CONSTANTS.googleSatelliteMap()));
listView.getStore().add(googleThumb(GoogleBaseMap.HYBRID, I18N.CONSTANTS.googleHybrid()));
listView.getStore().add(googleThumb(GoogleBaseMap.TERRAIN, I18N.CONSTANTS.googleTerrainMap()));
updateSelection();
service.execute(new GetBaseMaps(), new MaskingAsyncMonitor(listView, I18N.CONSTANTS.loading()), new AsyncCallback<BaseMapResult>() {
@Override
public void onFailure(Throwable caught) {
failLoadingBaseMaps();
}
@Override
public void onSuccess(BaseMapResult result) {
List<ModelData> thumbnails = new ArrayList<ModelData>();
for (BaseMap baseMap : result.getBaseMaps()) {
thumbnails.add(tileThumb(baseMap));
}
listView.getStore().add(thumbnails);
updateSelection();
}
});
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class DbUserEditorActions method delete.
public void delete() {
panel.setModified(true);
final UserPermissionDTO model = grid.getSelectionModel().getSelectedItem();
model.setAllowView(false);
model.setAllowViewAll(false);
model.setAllowEdit(false);
model.setAllowEditAll(false);
model.setAllowDesign(false);
model.setAllowManageAllUsers(false);
model.setAllowManageUsers(false);
dispatcher.execute(new UpdateUserPermissions(db.getId(), model), new MaskingAsyncMonitor(panel, I18N.CONSTANTS.deleting()), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
panel.setModified(false);
}
@Override
public void onSuccess(VoidResult result) {
store.remove(model);
panel.setModified(false);
}
});
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class DbUserEditorActions method save.
public void save(final NavigationCallback callback) {
BatchCommand batch = new BatchCommand();
for (Record record : store.getModifiedRecords()) {
batch.add(new UpdateUserPermissions(db.getId(), (UserPermissionDTO) record.getModel()));
}
dispatcher.execute(batch, new MaskingAsyncMonitor(panel, I18N.CONSTANTS.saving()), new AsyncCallback<BatchResult>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
if (callback != null) {
callback.onDecided(false);
}
}
@Override
public void onSuccess(BatchResult result) {
store.commitChanges();
panel.setModified(false);
if (callback != null) {
callback.onDecided(true);
}
}
});
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class DbEditor method deleteEntity.
private void deleteEntity(EntityDTO selectedEntity) {
BatchCommand batchCommand = unsavedChanges();
batchCommand.add(new Delete(selectedEntity));
service.execute(batchCommand, new MaskingAsyncMonitor(container, I18N.CONSTANTS.saving()), new AsyncCallback<BatchResult>() {
@Override
public void onFailure(Throwable caught) {
// Failure case handled by MaskingAsyncMonitor
}
@Override
public void onSuccess(BatchResult result) {
treeStore.commitChanges();
treeStore.remove(selectedEntity);
eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
}
});
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class MonthlyReportsPanel method loadSite.
private void loadSite(final SiteDTO site) {
this.currentSiteId = site.getId();
this.grid.getStore().removeAll();
MaskingAsyncMonitor monitor = new MaskingAsyncMonitor(this, I18N.CONSTANTS.loading());
service.execute(new GetSchema(), monitor).thenDo(schema -> {
service.execute(new GetActivityForm(site.getActivityId()), monitor).thenDo(activity -> {
currentActivity = activity;
populateGrid(site, schema);
});
});
}
Aggregations