Why insist on a CompoundPropertyModel? My first instinct would be to create a custom model for the checkboxes (which sets/unsets a single bit).
Thomas > -----Original Message----- > From: Markus Strickler [mailto:[EMAIL PROTECTED] > Sent: Donnerstag, 31. Januar 2008 13:00 > To: [email protected] > Subject: Re: Wrapping a POJO > > Hi- > > thanks for the quick reply. My description probably wasn't > clear enough. > My problem is that I have several checkboxes in the interface > that all map to a single Integer in the POJO. So there is not > accessor that accepts a boolean, which is why I need some way > to translate between the POJO and the model that backs the form. > The wiki actually has an example that is somewhat similar > (<http://cwiki.apache.org/WICKET/listview-with-checkboxes.html > >) but only wraps a String. > But coming to think of it, I can probably just access the > POJO fields through the wrapper like this: wrapper.pojo.field. > > OK, I'll probably try this. > > Thanks again, > -markus > > Zitat von Per Newgro <[EMAIL PROTECTED]>: > > > Hi Markus, > > > > you simply have to provide the POJO to the CompoundPropertyModel. > > Provide simple PropertyModels related to the compound model > for the fields. > > > > You can imagine the whole concept as "the path to the value". > > > > Pojo myPojo = new Pojo(); > > IModel model = new CompoundPropertyModel(myPojo); IModel > > aPropertyModel = new PropertyModel(model, > "theNameOfAccessorInPojo"); > > Label myPojoProperty = new Label("aWicketId", new aPropertyModel); > > > > I use a label. Replace it by your component. > > > > Cheers > > Per > > > > PS: If you new to wicket - checkout the wiki and the examples. They > > explain alot. > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > > --------------------------------------------------------------------- > 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]
