Thanks, I check out that link. It makes more since now. So would you use a CompountPropertyModel when you want to get the value of an object? Say out of a Person bean that you populated and that wasn't a page property?
Gregg
On 1/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
the model is a locator for the underlying value object, so what it really affords you is a level of indirection.
take a simple read only example. the use of the model allows the underlying value object to change dynamically w/out the component knowing or worrying about it.
so for example new Label("id", "hello world") is nice. but its value object ("hello world") is static and doesnt change.
now suppose you want that value to change, lets say the label represents a page property and you want it to update automatically w/out having to worry about it. so now you can create a model to pull the value from the page property.
new Label("id", new PropertyModel(this, "hello"));
now everytime the label renders it will ask its model for the value object, which in turn calls getHello() on the page. and now the label always displays whatever is in the hello property of the page w/out any tweaking.
so as i said, its a very nice level of indirection that can contain any amount of logic. you can achieve some very cool behaviors due to this, but i dont have time to go into them right now. recently on the list i showed one of these here:
http://thread.gmane.org/gmane.comp.java.wicket.user/7469
if you are intereseted.
hope this explains some of it, im short on time :(
-Igor
On 1/18/06, Gregg D Bolinger <[EMAIL PROTECTED] > wrote:I blogged about it recently but I wondered if anyone had any other documentation that explains when one should use which IModel implementation? Anything other than browsing through all the example code? Thanks.
Gregg
