use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class DbProjectEditor method onEdit.
@Override
protected void onEdit(final ProjectDTO model) {
final FormDialogImpl<ProjectForm> dialog = new FormDialogImpl<ProjectForm>(new ProjectForm());
dialog.setWidth(450);
dialog.setHeight(300);
dialog.getForm().getBinding().bind(model);
dialog.show(new FormDialogCallback() {
@Override
public void onValidated() {
service.execute(RequestChange.update(model, "name", "description"), dialog, new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
// handled by monitor
}
@Override
public void onSuccess(VoidResult result) {
dialog.hide();
eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
view.refresh();
}
});
}
});
}
use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class DbUserEditor method add.
private void add() {
final UserForm form = new UserForm(db);
final FormDialogImpl dlg = new FormDialogImpl(form);
dlg.setHeading(I18N.CONSTANTS.newUser());
dlg.setWidth(400);
dlg.setHeight(300);
final String host = Window.Location.getHostName();
dlg.show(new FormDialogCallback() {
@Override
public void onValidated() {
dispatcher.execute(new UpdateUserPermissions(db, form.getUser(), host), dlg, new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(VoidResult result) {
loader.load();
dlg.hide();
}
});
}
});
}
use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class BoundLocationSection method save.
@Override
public void save(final AsyncCallback<Void> callback) {
if (isDirty()) {
newLocation();
dispatcher.execute(new CreateLocation(location), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(VoidResult result) {
callback.onSuccess(null);
}
});
} else {
callback.onSuccess(null);
}
}
use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.
the class SiteDialog method updateSite.
private void updateSite() {
final SiteDTO updated = new SiteDTO(site);
updateModel(updated);
dispatcher.execute(new UpdateSite(site, updated), new AsyncCallback<VoidResult>() {
@Override
public void onFailure(Throwable caught) {
showError(caught);
}
@Override
public void onSuccess(VoidResult result) {
hide();
callback.onSaved(updated);
}
});
}
use of org.activityinfo.shared.command.result.VoidResult 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();
}
}
Aggregations