Search in sources :

Example 6 with FormDialogImpl

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;
}
Also used : FormDialogImpl(org.activityinfo.client.page.common.dialog.FormDialogImpl) TargetForm(org.activityinfo.client.page.config.form.TargetForm)

Example 7 with FormDialogImpl

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;
}
Also used : AttributeDTO(org.activityinfo.shared.dto.AttributeDTO) AttributeGroupDTO(org.activityinfo.shared.dto.AttributeGroupDTO) IndicatorDTO(org.activityinfo.shared.dto.IndicatorDTO) FormDialogImpl(org.activityinfo.client.page.common.dialog.FormDialogImpl) FieldBinding(com.extjs.gxt.ui.client.binding.FieldBinding) ActivityDTO(org.activityinfo.shared.dto.ActivityDTO)

Example 8 with FormDialogImpl

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());
        }
    });
}
Also used : FormDialogImpl(org.activityinfo.client.page.common.dialog.FormDialogImpl) FormDialogCallback(org.activityinfo.client.page.common.dialog.FormDialogCallback) FormEvent(com.extjs.gxt.ui.client.event.FormEvent) HiddenField(com.extjs.gxt.ui.client.widget.form.HiddenField)

Aggregations

FormDialogImpl (org.activityinfo.client.page.common.dialog.FormDialogImpl)8 FormDialogCallback (org.activityinfo.client.page.common.dialog.FormDialogCallback)4 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 ProjectForm (org.activityinfo.client.page.config.form.ProjectForm)2 VoidResult (org.activityinfo.shared.command.result.VoidResult)2 FieldBinding (com.extjs.gxt.ui.client.binding.FieldBinding)1 FormEvent (com.extjs.gxt.ui.client.event.FormEvent)1 HiddenField (com.extjs.gxt.ui.client.widget.form.HiddenField)1 DatabaseForm (org.activityinfo.client.page.config.form.DatabaseForm)1 PartnerForm (org.activityinfo.client.page.config.form.PartnerForm)1 TargetForm (org.activityinfo.client.page.config.form.TargetForm)1 UserForm (org.activityinfo.client.page.config.form.UserForm)1 UpdateUserPermissions (org.activityinfo.shared.command.UpdateUserPermissions)1 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)1 AttributeDTO (org.activityinfo.shared.dto.AttributeDTO)1 AttributeGroupDTO (org.activityinfo.shared.dto.AttributeGroupDTO)1 IndicatorDTO (org.activityinfo.shared.dto.IndicatorDTO)1 UserDatabaseDTO (org.activityinfo.shared.dto.UserDatabaseDTO)1