use of org.activityinfo.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.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class DimensionTree method onModelChanged.
private void onModelChanged() {
if (needToReloadDimensions(model)) {
clearIndicatorSpecificDimensions();
dispatcher.execute(new GetSchema(), new MaskingAsyncMonitor(treePanel, I18N.CONSTANTS.loading()), new AsyncCallback<SchemaDTO>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(SchemaDTO result) {
populateIndicatorSpecificDimensions(result);
applyModelState(result);
}
});
}
}
use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class DbUserEditor method delete.
private void delete() {
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(this, I18N.CONSTANTS.deleting()), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(VoidResult result) {
store.remove(model);
}
});
}
use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class DbUserEditor method save.
private void save() {
BatchCommand batch = new BatchCommand();
for (Record record : store.getModifiedRecords()) {
batch.add(new UpdateUserPermissions(db.getId(), (UserPermissionDTO) record.getModel()));
}
dispatcher.execute(batch, new MaskingAsyncMonitor(this, I18N.CONSTANTS.saving()), new AsyncCallback<BatchResult>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
}
@Override
public void onSuccess(BatchResult result) {
store.commitChanges();
}
});
}
use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class MonthlyReportsPanel method save.
private void save() {
ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<UpdateMonthlyReports.Change>();
for (Record record : store.getModifiedRecords()) {
IndicatorRowDTO report = (IndicatorRowDTO) record.getModel();
for (String property : record.getChanges().keySet()) {
UpdateMonthlyReports.Change change = new UpdateMonthlyReports.Change();
change.setIndicatorId(report.getIndicatorId());
change.setMonth(IndicatorRowDTO.monthForProperty(property));
change.setValue((Double) report.get(property));
changes.add(change);
}
}
service.execute(new UpdateMonthlyReports(currentSiteId, changes), new MaskingAsyncMonitor(this, I18N.CONSTANTS.save()), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
}
@Override
public void onSuccess(VoidResult result) {
}
});
}
Aggregations