Sorry, just speed reading, saw the setOutputMarkupId() call which made
me think you might be doing Ajax...

As for your real question, I don't know.  I'm probably wrong, as it's
been a while since I looked into anything complex with models, but
  new CompoundPropertyModel(
    new PersonPropertyModel(EditTeamPersonPanel.this.getModel()
seems to have an extra layer beyond what I'd expect?

If it's not that, then I'd be looking to see if it would be looking
for something like "setObject(Component c, String s)" rather than
"setObject(Component c, Object o)"?

/Gwyn


On 14/08/06, Mats Norén <[EMAIL PROTECTED]> wrote:
> Not really, I'm not using any Ajax-stuff or anything like that.
> How do you mean?
>
> /Mats
>
>
> On 8/14/06, Gwyn Evans <[EMAIL PROTECTED]> wrote:
> > Does this thread apply?
> > (http://www.nabble.com/ajax-failed-to-update-a-component-%28wicket-1.2%29-tf1844050.html#a5033398)
> > /Gwyn
> >
> > On 13/08/06, Mats Norén <[EMAIL PROTECTED]> wrote:
> > > What I want the following code to do is to iterate all propertyTypes
> > > and create or lookup the appropriate property on my Person-object and
> > > create a TextField for each one.
> > >
> > > I've defined a model for the propertyTypes and a model for a
> > > TeamPerson-object which contains my Person.
> > >
> > > Everything works fine except that the setObject(Component c, Object o)
> > > in  PersonPropertyModel is never called.
> > > On screen the form renders and look fine but nothing gets written back.
> > >
> > > Would appreciate another pair of eyes on this.
> > >
> > >
> > > IModel propertyTypes = new LoadableDetachableModel() {
> > >             protected Object load() {
> > >                     return userService.allPropertyTypes();
> > >                 }
> > >             };
> > >
> > >             ListView dynamicProperties = new
> > > ListView("dynamicProperties", propertyTypes) {
> > >
> > >                 protected void populateItem(ListItem item) {
> > >
> > >                     TextField valueField = new TextField("value");
> > >                     valueField.setOutputMarkupId(true);
> > >                     FormComponentFeedbackBorder feedbackBorder = new
> > > FormComponentFeedbackBorder("feedback");
> > >                     feedbackBorder.setRenderBodyOnly(true);
> > >                     feedbackBorder.add(valueField);
> > >
> > >                     item.add(feedbackBorder);
> > >
> > >                     Label label = new Label("propertyType.name");
> > >                     label.add(new AttributeModifier("for", true, new
> > > Model(valueField.getId())));
> > >                     item.add(label);
> > >
> > >                 }
> > >
> > >                 protected IModel getListItemModel(IModel
> > > listViewModel, int index) {
> > >                     PropertyType pt = (PropertyType)
> > > super.getListItemModel(listViewModel, index).getObject(null);
> > >                     return new CompoundPropertyModel(new
> > > PersonPropertyModel(EditTeamPersonPanel.this.getModel(), pt));
> > >                 }
> > >
> > >             }.setReuseItems(true);
> > >
> > >
> > >
> > > public class PersonPropertyModel extends AbstractModel {
> > >
> > >         private final IModel teamPerson;
> > >         private final PropertyType propertyType;
> > >
> > >         public PersonPropertyModel(IModel teamPersonModel,
> > > PropertyType propertyType) {
> > >             this.teamPerson = teamPersonModel;
> > >             this.propertyType = propertyType;
> > >         }
> > >
> > >         public Object getObject(Component c) {
> > >             logger.info("Calling getObject for component: " + c.getId());
> > >             TeamPerson tp = (TeamPerson) teamPerson.getObject(c);
> > >             Person person = tp.getPerson();
> > >             PersonProperty pp = person.getPropertyOfType(propertyType);
> > >             if (pp == null) {
> > >                 logger.info("Adding new property");
> > >                 pp = new PersonProperty();
> > >                 pp.setPerson(person);
> > >                 pp.setPropertyType(propertyType);
> > >             }
> > >             return pp;
> > >         }
> > >
> > >         public void setObject(Component c, Object o) {
> > >             TeamPerson tp = (TeamPerson) teamPerson.getObject(c);
> > >             Person person = tp.getPerson();
> > >             logger.info("Calling setObject for property: " +
> > > ((PersonProperty) o).getPropertyType().getName());
> > >             person.setPropertyOfType((PersonProperty) o);
> > >         }
> > >
> > >
> > >         public void detach() {
> > >             super.detach();
> > >             teamPerson.detach();
> > >         }
> > >     }
> > >
> > > /Mats
> > >
> > > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job 
> > > easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> >
> >
> > --
> > Download Wicket 1.2.1 now! - http://wicketframework.org
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job 
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-- 
Download Wicket 1.2.1 now! - http://wicketframework.org

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to