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

Reply via email to