Actually no, it doesn't make much more since. And yes, it's probably because I don't understand Wicket that well. What is confusing is...
add(......) {
@Override protected void populateItem(ListItem<Person> row)
{
Person person=row.getModelObject();
row.add(new Label("firstName", person.getFirstName());
...
}
{
Person person=row.getModelObject();
row.add(new Label("firstName", person.getFirstName());
...
}
}
So how would you create a ListView and then add it to the page (not all at once). That would make more since. At least to me. :) If I said anything that downplayed Wicket in my article, it wasn't on purpose. I tried to say most of my issues were my own lack of understanding. I like Wicket. I am still just trying to determine if it is something I want to invest time in and use.
Thanks for the help.
Gregg
On 1/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
by the way Gregg, your post is a little unfair. sure it is hard to understand whats going on if youve never seen wicket before because there is some casting involved. consider the same example if generics were used (yes currently not supported)
add(new ListView<Person>("people", getPeople())
{
@Override protected void populateItem(ListItem<Person> row)
{
Person person=row.getModelObject();
row.add(new Label("firstName", person.getFirstName());
...
}
}
is that easier to understand at a first glance if you dont know wicket? i think so.
-Igor
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
