Example usage for org.apache.wicket.markup.html.form Form process

List of usage examples for org.apache.wicket.markup.html.form Form process

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.form Form process.

Prototype

public void process(IFormSubmitter submittingComponent) 

Source Link

Document

Process the form.

Usage

From source file:com.googlecode.wicket.jquery.ui.dialog.AbstractFormDialog.java

License:Apache License

/**
 * DO NOT OVERRIDE UNLESS A VERY GOOD REASON
 *//*w  w w. ja  v  a  2s. com*/
@Override
public void onEvent(IEvent<?> event) {
    Form<?> form = this.getForm(); //null form not handled ; should not go until here if it's the case.

    if (event.getPayload() instanceof DialogEvent) {
        final DialogEvent payload = (DialogEvent) event.getPayload();

        if (payload.isClicked(this.getSubmitButton())) {
            // same technique as AjaxButton class //
            form.process(new IFormSubmitter() {
                public Form<?> getForm() {
                    return AbstractFormDialog.this.getForm();
                }

                public boolean getDefaultFormProcessing() {
                    return AbstractFormDialog.this.getDefaultFormProcessing();
                }

                public void onSubmit() {
                    AbstractFormDialog.this.onSubmit(payload.getTarget());
                }

                public void onError() {
                    AbstractFormDialog.this.onError(payload.getTarget());
                }
            });

            if (!form.hasError()) {
                super.onEvent(event); //close the dialog
            }
        } else {
            super.onEvent(event); //close the dialog
        }
    }
}

From source file:com.googlecode.wicket.jquery.ui.widget.dialog.AbstractFormDialog.java

License:Apache License

@Override
void internalOnClick(AjaxRequestTarget target, DialogButton button) {
    final Form<?> form = this.getForm(button);

    if (form != null) {
        form.process(new DialogFormSubmitter(target));

        if (!form.hasError()) {
            this.onClick(target, button); //fires onClick (& closes the dialog by default)
        }//from   w w w.  j av  a2  s . co  m
    } else {
        this.onClick(target, button); //fires onClick (& closes the dialog by default)
    }
}

From source file:org.geoserver.web.data.store.AbstractWMTSStorePage.java

License:Open Source License

private AjaxSubmitLink saveLink() {
    return new AjaxSubmitLink("save", form) {

        @Override//  w  w w .  jav  a 2s  .  c  om
        protected void onError(AjaxRequestTarget target, Form form) {
            super.onError(target, form);
            target.add(form);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            form.process(this);
            WMTSStoreInfo info = (WMTSStoreInfo) form.getModelObject();
            try {
                onSave(info, target);
            } catch (IllegalArgumentException e) {
                form.error(e.getMessage());
                target.add(form);
            }
        }
    };
}