Search in sources :

Example 1 with FormEvent

use of com.extjs.gxt.ui.client.event.FormEvent 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.setHeadingText(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.ui.client.page.common.dialog.FormDialogImpl) FormDialogCallback(org.activityinfo.ui.client.page.common.dialog.FormDialogCallback) FormEvent(com.extjs.gxt.ui.client.event.FormEvent) HiddenField(com.extjs.gxt.ui.client.widget.form.HiddenField)

Aggregations

FormEvent (com.extjs.gxt.ui.client.event.FormEvent)1 HiddenField (com.extjs.gxt.ui.client.widget.form.HiddenField)1 FormDialogCallback (org.activityinfo.ui.client.page.common.dialog.FormDialogCallback)1 FormDialogImpl (org.activityinfo.ui.client.page.common.dialog.FormDialogImpl)1