use of org.activityinfo.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DbTargetGrid method showAddDialog.
@Override
public FormDialogTether showAddDialog(TargetDTO target, UserDatabaseDTO db, 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);
dlg.setHeading(messages.createTarget());
dlg.show(callback);
return dlg;
}
use of org.activityinfo.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class DesignView method showNewForm.
@Override
public FormDialogTether showNewForm(EntityDTO entity, FormDialogCallback callback) {
AbstractDesignForm form = createForm(entity);
form.getBinding().bind(entity);
for (FieldBinding field : form.getBinding().getBindings()) {
field.getField().clearInvalid();
}
FormDialogImpl dlg = new FormDialogImpl(form);
dlg.setWidth(form.getPreferredDialogWidth());
dlg.setHeight(form.getPreferredDialogHeight());
dlg.setScrollMode(Style.Scroll.AUTOY);
if (entity instanceof ActivityDTO) {
dlg.setHeading(I18N.CONSTANTS.newActivity());
} else if (entity instanceof AttributeGroupDTO) {
dlg.setHeading(I18N.CONSTANTS.newAttributeGroup());
} else if (entity instanceof AttributeDTO) {
dlg.setHeading(I18N.CONSTANTS.newAttribute());
} else if (entity instanceof IndicatorDTO) {
dlg.setHeading(I18N.CONSTANTS.newIndicator());
}
dlg.show(callback);
return dlg;
}
use of org.activityinfo.client.page.common.dialog.FormDialogImpl in project activityinfo by bedatadriven.
the class AttachmentsPresenter method onUpload.
public void onUpload() {
form = new AttachmentForm();
form.setEncoding(Encoding.MULTIPART);
form.setMethod(Method.POST);
HiddenField<String> blobField = new HiddenField<String>();
blobField.setName("blobId");
blobid = UUID.uuid();
blobField.setValue(blobid);
form.add(blobField);
final FormDialogImpl dialog = new FormDialogImpl(form);
dialog.setWidth(400);
dialog.setHeight(200);
dialog.setHeading(I18N.CONSTANTS.newAttachment());
dialog.show(new FormDialogCallback() {
@Override
public void onValidated() {
form.setAction("/ActivityInfo/attachment?blobId=" + blobid + "&siteId=" + currentSite.getId());
form.submit();
dialog.getSaveButton().setEnabled(false);
}
});
form.addListener(Events.Submit, new Listener<FormEvent>() {
@Override
public void handleEvent(FormEvent event) {
dialog.hide();
view.setAttachmentStore(currentSite.getId());
}
});
}
Aggregations