AjaxCheckBox 
-------------

                 Key: WICKET-4302
                 URL: https://issues.apache.org/jira/browse/WICKET-4302
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 1.5.3
            Reporter: Johannes Odland
            Priority: Minor


AjaxCheckBox does not support providing an IAjaxCallDecorator the same way 
AjaxLink does. 
Beeing able to provide your own ajax decorator is convenient, if you want to 
run your own code before or after the ajax call is triggered.

Suggested implementation as in AjaxLink follows:

public abstract class AjaxCheckBox extends CheckBox {

    public AjaxCheckBox(final String id) {
        this(id, null);
    }

    public AjaxCheckBox(final String id, final IModel<Boolean> model) {
        super(id, model);

        setOutputMarkupId(true);

        add(new AjaxFormComponentUpdatingBehavior("onclick") {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                AjaxCheckBox.this.onUpdate(target);
            }

            @Override
            protected IAjaxCallDecorator getAjaxCallDecorator() {
                return AjaxCheckBox.this.getAjaxCallDecorator();
            }
        });
    }

    /**
     * Returns ajax call decorator that will be used to decorate the ajax call.
     *
     * @return ajax call decorator
     */
    protected IAjaxCallDecorator getAjaxCallDecorator() {
        return null;
    }

    /**
     * Listener method invoked on an ajax update call
     *
     * @param target target
     */
    protected abstract void onUpdate(AjaxRequestTarget target);

}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to