use of org.activityinfo.client.page.common.dialog.FormDialogCallback in project activityinfo by bedatadriven.
the class DbListPresenter method onAdd.
public void onAdd() {
final UserDatabaseDTO db = new UserDatabaseDTO();
DatabaseForm form = new DatabaseForm(dispatcher);
form.getBinding().bind(db);
final FormDialogImpl dialog = new FormDialogImpl(form);
dialog.setWidth(400);
dialog.setHeight(200);
dialog.setHeading(I18N.CONSTANTS.newDatabase());
dialog.show(new FormDialogCallback() {
@Override
public void onValidated() {
save(db, dialog);
}
});
}
use of org.activityinfo.client.page.common.dialog.FormDialogCallback in project activityinfo by bedatadriven.
the class DbPartnerEditor method onAdd.
// public void onSelectionChanged(PartnerDTO selectedItem) {
// this.view.setActionEnabled(UIActions.delete, selectedItem != null);
// }
@Override
protected void onAdd() {
final PartnerDTO newPartner = new PartnerDTO();
this.view.showAddDialog(newPartner, new FormDialogCallback() {
@Override
public void onValidated(final FormDialogTether dlg) {
service.execute(new AddPartner(db.getId(), newPartner), dlg, new AsyncCallback<CreateResult>() {
@Override
public void onFailure(Throwable caught) {
Log.debug("DbPartnerEditor caught exception while executing command AddPartner: ", caught);
}
@Override
public void onSuccess(CreateResult result) {
if (result instanceof DuplicateCreateResult) {
Log.debug("DbPartnerEditor tried to add partner '" + newPartner.getName() + "' to database " + db.getId() + " but it already exists");
MessageBox.alert(I18N.CONSTANTS.newPartner(), I18N.CONSTANTS.duplicatePartner(), null);
} else {
Log.debug("DbPartnerEditor added new partner '" + newPartner.getName() + "' to database " + db.getId());
newPartner.setId(result.getNewId());
store.add(newPartner);
eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
dlg.hide();
}
}
});
}
});
}
use of org.activityinfo.client.page.common.dialog.FormDialogCallback in project activityinfo by bedatadriven.
the class LockedPeriodGrid method startCreate.
@Override
public void startCreate() {
addLockedPeriod.startCreate();
form = new FormDialogImpl<AddLockedPeriodDialog>(addLockedPeriod);
form.setHeading(I18N.CONSTANTS.addTimeLock());
form.setWidth(400);
form.setHeight(350);
form.show(new FormDialogCallback() {
@Override
public void onValidated() {
super.onValidated();
}
@Override
public void onValidated(FormDialogTether dlg) {
LockedPeriodGrid.this.lockedPeriod = addLockedPeriod.getValue();
eventBus.fireEvent(new CreateEvent());
}
@Override
public void onCancelled() {
eventBus.fireEvent(new CancelCreateEvent());
}
});
}
use of org.activityinfo.client.page.common.dialog.FormDialogCallback 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.client.page.common.dialog.FormDialogCallback 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();
}
});
}
});
}
Aggregations