what i have shown you will work independently of the fact that you are
sure or not :)
-igor
On Tue, Mar 25, 2008 at 2:51 PM, <[EMAIL PROTECTED]> wrote:
> I am not sure how this would solve my problem
> I intend to only use
> new CheckBox("checked") without adding any other arguments
> since I expect it to resolve the form's compoundpropertymodel
> whose object is entitybean with "checked" as column name.
>
>
>
>
>
>
> >or you can simply do:
> >
> >class YesNoCheckBox extends CheckBox {
> >
> > protected IModel initModel() {
> > return new CheckBoxYesNoModel(super.initModel());
> > }
> >}
> >
> >-igor
> >
> >On Tue, Mar 25, 2008 at 2:29 PM, <[EMAIL PROTECTED]> wrote:
> >> Use model decorator sometimes seems troublesome.
> >> I need to use a form containing a lot of checkboxes and other types
> >> with compoundproperty model with a entity bean, say record.
> >> Most formcoponent ids are identical to their record property name,
> >> such as Textfield("firstName") and record also has "firstName"
> >> if I use the extra decorator indirection for checkbox,
> >> I'd have to use
> >> CheckBox("checked",new CustomerModel(new PropertyModel(record,"checked"))
> >> or is there a better/convenient way to do this?
> >>
> >>
> >>
> >> >you forgot the important detach() { room.detach(); }
> >> >
> >>
> >> >-igor
> >> >
> >> >
> >> >On Tue, Mar 25, 2008 at 1:52 PM, Timo Rantalaiho <[EMAIL PROTECTED]>
> >> >wrote:
> >> >>
> >>
> >>
> >> >> On Tue, 25 Mar 2008, [EMAIL PROTECTED] wrote:
> >> >> > Is there built-in mechanism to auto convert the checkbox model
> value
> >> >> > to be a character set Y/N or Yes/No or any other pairs?
> >> >> > This is frequently used pattern.
> >> >>
> >> >> Probably you could set your own IConverter on the component
> >> >> corresponding the checkbox. The converter can then be reused
> >> >> as needed.
> >> >>
> >> >> I've typically (if not always) used checkboxes with custom models
> >> >> directly toggling things in domain objects, e.g.
> >> >>
> >> >> class RoomReservedModel extends Model {
> >> >> private IModel room;
> >> >>
> >> >> public RoomReservedModel(IModel room) {
> >> >> this.room = room;
> >> >> }
> >> >>
> >> >> @Override
> >> >> public void setObject(Object object) {
> >> >> room().setReserved((Boolean) object);
> >> >> }
> >> >>
> >> >> @Override
> >> >> public Object getObject() {
> >> >> return room().isReserved();
> >> >> }
> >> >>
> >> >> private Room room() {
> >> >> return (Room) room.getObject();
> >> >> }
> >> >> }
> >> >>
> >> >> Best wishes,
> >> >> Timo
> >> >>
> >> >> --
> >> >> Timo Rantalaiho
> >> >> Reaktor Innovations Oy <URL: http://www.ri.fi/ >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >>
> >> >
> >> >---------------------------------------------------------------------
> >> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]