use of org.activityinfo.ui.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DbListPresenter method onRename.
public void onRename() {
DatabaseForm form = new DatabaseForm(dispatcher);
form.getBinding().bind(selection);
// it's not allowed to change country by design
form.hideCountryField();
final FormDialogImpl dialog = new FormDialogImpl(form);
dialog.setWidth(400);
dialog.setHeight(170);
dialog.setHeadingText(I18N.CONSTANTS.renameDatabase());
dialog.show(new FormDialogCallback() {
@Override
public void onValidated() {
update(selection, dialog);
}
});
}
use of org.activityinfo.ui.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DbProjectGrid method showAddDialog.
@Override
public FormDialogTether showAddDialog(ProjectDTO project, FormDialogCallback callback) {
ProjectForm form = new ProjectForm();
form.getBinding().bind(project);
form.getNameField().setValidator(new UniqueNameValidator(grid.getStore().getModels()));
FormDialogImpl<ProjectForm> dlg = new FormDialogImpl<>(form);
dlg.setWidth(450);
dlg.setHeight(300);
dlg.setHeadingText(messages.createProject());
dlg.show(callback);
return dlg;
}
use of org.activityinfo.ui.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DbTargetGrid method showAddDialog.
@Override
public FormDialogTether showAddDialog(TargetDTO target, UserDatabaseDTO db, boolean editDialog, FormDialogCallback callback) {
TargetForm form = new TargetForm(db);
form.getBinding().setStore(store);
form.getBinding().bind(store.getRecord(target).getModel());
FormDialogImpl<TargetForm> dlg = new FormDialogImpl<TargetForm>(form);
dlg.setWidth(450);
dlg.setHeight(300);
if (editDialog) {
dlg.setHeadingText(messages.editTarget());
} else {
dlg.setHeadingText(messages.createTarget());
}
dlg.show(callback);
return dlg;
}
use of org.activityinfo.ui.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DbPartnerEditor method showEditDialog.
private void showEditDialog(PartnerDTO partner) {
PartnerForm form = new PartnerForm(otherPartnerNames(partner));
form.getBinding().bind(partner);
FormDialogImpl<PartnerForm> dlg = new FormDialogImpl<>(form);
dlg.setWidth(450);
dlg.setHeight(300);
dlg.setHeadingText(I18N.CONSTANTS.newPartner());
dlg.show(new FormDialogCallback() {
@Override
public void onValidated(FormDialogTether dlg) {
dispatcher.execute(new UpdatePartner(db.getId(), partner), 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) {
LOGGER.fine("DbPartnerEditor tried to add partner '" + partner.getName() + "' to database " + db.getId() + " but it already exists");
MessageBox.alert(I18N.CONSTANTS.newPartner(), I18N.CONSTANTS.duplicatePartner(), null);
} else {
LOGGER.fine("DbPartnerEditor added/updated new partner '" + partner.getName() + "' to database " + db.getId());
eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
dlg.hide();
updateStore(partner, result);
}
}
});
}
});
}
use of org.activityinfo.ui.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DbProjectEditor method onEdit.
@Override
protected void onEdit(final ProjectDTO model) {
final ProjectDTO copy = new ProjectDTO();
copy.setProperties(model.getProperties());
final FormDialogImpl<ProjectForm> dialog = new FormDialogImpl<ProjectForm>(new ProjectForm()) {
@Override
public void onCancel() {
model.setProperties(copy.getProperties());
}
};
dialog.setWidth(450);
dialog.setHeight(300);
dialog.getForm().getBinding().bind(model);
List<ProjectDTO> allowed = Lists.newArrayList(store.getModels());
allowed.remove(model);
dialog.getForm().getNameField().setValidator(new UniqueNameValidator(allowed));
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();
}
});
}
});
}
Aggregations