use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class MonthlyReportsPanel method save.
public Promise<Void> save() {
ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<>();
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(report.get(property));
changes.add(change);
}
}
final Promise<Void> promise = new Promise<>();
service.execute(new UpdateMonthlyReports(currentSiteId, changes), new MaskingAsyncMonitor(this, I18N.CONSTANTS.saving()), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
promise.onFailure(caught);
}
@Override
public void onSuccess(VoidResult result) {
store.commitChanges();
promise.onSuccess(null);
}
});
return promise;
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class ShareReportDialog method show.
public void show(final Report report) {
if (report.getIndicators().isEmpty()) {
MessageBox.alert(I18N.CONSTANTS.alert(), I18N.CONSTANTS.unableToShareReport(), null);
return;
}
super.show();
this.currentReport = report;
// we need to combine the databases which already have visiblity with
// those that could potentially be added
BatchCommand batch = new BatchCommand();
batch.add(new GetIndicators(currentReport.getIndicators()));
batch.add(new GetReportVisibility(currentReport.getId()));
dispatcher.execute(batch, new MaskingAsyncMonitor(grid, I18N.CONSTANTS.loading()), new SuccessCallback<BatchResult>() {
@Override
public void onSuccess(BatchResult batch) {
populateGrid((IndicatorResult) batch.getResult(0), (ReportVisibilityResult) batch.getResult(1));
}
});
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class PrintDataEntryForm method print.
public void print(final int activityId) {
setVisible(true);
dispatcher.execute(new GetActivityForm(activityId), new MaskingAsyncMonitor(this, I18N.CONSTANTS.loading()), new AsyncCallback<ActivityFormDTO>() {
@Override
public void onFailure(Throwable caught) {
showError(caught);
}
@Override
public void onSuccess(ActivityFormDTO result) {
renderForm(result);
}
});
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class EmailDialog method onButtonPressed.
@Override
protected void onButtonPressed(Button button) {
if (button.getItemId().equals(OK)) {
final UpdateReportSubscription update = new UpdateReportSubscription();
update.setReportId(reportMetadata.getId());
if (weekly.getValue()) {
update.setEmailDelivery(EmailDelivery.WEEKLY);
update.setEmailDay(dayOfWeek.getMappedValue());
} else if (monthly.getValue()) {
update.setEmailDelivery(EmailDelivery.MONTHLY);
update.setEmailDay(dayOfMonth.getMappedValue());
} else {
update.setEmailDelivery(EmailDelivery.NONE);
}
dispatcher.execute(update, new MaskingAsyncMonitor(this, I18N.CONSTANTS.saving()), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(VoidResult result) {
hide();
reportMetadata.setEmailDelivery(update.getEmailDelivery());
reportMetadata.setDay(update.getEmailDay());
callback.onUpdated();
}
});
} else if (button.getItemId().equals(CANCEL)) {
hide();
}
}
use of org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.
the class ShareReportDialog method show.
public void show(ReportMetadataDTO metadata) {
super.show();
dispatcher.execute(new GetReportModel(metadata.getId()), new MaskingAsyncMonitor(grid, I18N.CONSTANTS.loading()), new SuccessCallback<ReportDTO>() {
@Override
public void onSuccess(ReportDTO reportDTO) {
show(reportDTO.getReport());
}
});
}
Aggregations