Search in sources :

Example 1 with BootstrapToggleConfig

use of de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggleConfig in project ocvn by devgateway.

the class CheckBoxToggleBootstrapFormComponent method inputField.

@Override
protected BootstrapToggle inputField(final String id, final IModel<Boolean> model) {
    config = new BootstrapToggleConfig();
    config.withOnStyle(BootstrapToggleConfig.Style.info).withOffStyle(BootstrapToggleConfig.Style.warning).withStyle("customCssClass");
    final BootstrapToggle checkBoxToggle = new BootstrapToggle("field", initFieldModel(), config) {

        private static final long serialVersionUID = 1L;

        @Override
        protected CheckBox newCheckBox(final String id, final IModel<Boolean> model) {
            wrappedCheckbox = super.newCheckBox(id, model);
            wrappedCheckbox.add(new AjaxFormComponentUpdatingBehavior("change") {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(final AjaxRequestTarget target) {
                    CheckBoxToggleBootstrapFormComponent.this.onUpdate(target);
                }
            });
            return wrappedCheckbox;
        }
    };
    return checkBoxToggle;
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) BootstrapToggleConfig(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggleConfig) BootstrapToggle(de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggle)

Aggregations

BootstrapToggle (de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggle)1 BootstrapToggleConfig (de.agilecoders.wicket.extensions.markup.html.bootstrap.form.checkbox.bootstraptoggle.BootstrapToggleConfig)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)1 IModel (org.apache.wicket.model.IModel)1