yes this is wrong.
I don't know why that worked in 1.1 because i also believe it shouldn't have worked there also but maybe this behaviour was only
introduced in 1.2

If you give the component its onw model. Then that component is the Root model object
And if that is the case a getModelObject() call to that component will return the real object inside the compoundmodel.
this way you can get the real object (summary) back. Else this wouldn't be possible.

you can do stuff like this:

Form form = new Form("x", new CompoundPropertyModel(new Person())
form.add(new TextField("name")) << this displays/edits the name property of the person
form.submit()
{
   form.getModelObject () << this will return the person itself so that you can save it.
}


johan


On 3/23/06, Steve Knight < [EMAIL PROTECTED]> wrote:
Before I upgraded to Wicket 1.2, I was doing something like this:

CompoundPropertyModel model = new CompoundPropertyModel(summary);
add(new Label("surfaceCount", model));
add(new Label("unknownCount", model));

And Wicket would properly bind the properties of my model to the labels.  However, after upgrading to Wicket 1.2-beta2, this no longer works and instead of binding the individual properties of my model class, it simply uses toString(), which I assume is the default when it can't find the properties.

If I use this, it works as expected:

CompoundPropertyModel model = new CompoundPropertyModel(summary);
setModel(model);
add(new Label("surfaceCount", model));
add(new Label("unknownCount"));

So, I guess I'm a little confused.  Was I not using the CompundPropertyModel correctly before?

Steve



Reply via email to