Hi, this is YesNoCheckBox referred from previous posts. You can modify to fit
your need.

Roland.

--
public class YesNoCheckBox extends CheckBox {

        public YesNoCheckBox(String id) {
                super(id);
        }

        @Override
        protected IModel initModel() {
                return new CheckBoxYesNoModel(super.initModel());
        }

        private class CheckBoxYesNoModel implements IModel {
                final IModel model;

                public CheckBoxYesNoModel(IModel model) {
                        this.model = model;
                }

                public void detach() {
                        model.detach();
                }

                public Object getObject() {
                        return convertToComponent(model.getObject());
                }

                public void setObject(Object object) {
                        model.setObject(convertFromComponent(object));
                }

                protected Object convertToComponent(Object o) {
                        if (o.toString().equalsIgnoreCase("y"))
                                return true;
                        else
                                return false;
                }

                protected Object convertFromComponent(Object o) {
                        if (((Boolean) o) == true)
                                return "y";
                        else
                                return "n";
                }
        }
}
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Use-Byte-for-CheckBox-instead-of-Boolean-tp3236065p3238209.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to