I think that is how ListItem started out many months ago. There have
been several been several shouting indecent words about that, and it
was 'fixed' to what it is now. I don't know, someone else (Johan?)
should defend that decission.
There's a break-out for you though. Simply override:
protected ListItem newItem(final int index)
And create the ListItem model yourself, using any model you like, or -
even better - override: getListItemModel. That method seems to be made
for your case, so I included it with the JavaDocs.
/**
* Subclasses may provide their own ListItemModel with extended
* functionality. The default ListItemModel works fine with mostly
static
* lists where index remains valid. In cases where the underlying list
* changes a lot (many users using the application), it may not longer
be
* appropriate. In that case your own ListItemModel implementation
should
* use an id (e.g. the database' record id) to identify and load the
list
* item model object.
*
* @param listViewModel
* The ListView's model
* @param index
* The list item index
* @return The ListItemModel created
*/
protected IModel getListItemModel(final IModel listViewModel, final int
index)
{
return new ListItemModel(this, index);
}
Good luck,
Eelco
On 9/13/05, Jim McBeath <[EMAIL PROTECTED]> wrote:
> The difference between your example and my program is that, in your
> example, you are changing a property of an object contained in the List,
> whereas I am attempting to change the actual object in the List. Thus when
> the ListItemModel makes a shallow copy of that object for its own use,
> and then passes that copy to the PropertyModel used by your TextField,
> it works for you, but not for me. Your example does not make use of
> ListItemModel.onSetObject, so does not exercise the problem.
>
> I consider the onSetObject method of ListItemModel as currently implemented
> to be broken and suggest that it be modified so that it updates the
> underlying list value, something like this:
>
> ((List)listView.getModelObject()).set(index,object);
>
> I think this would solve my problem. What I don't know is if it would
> break anything else. For example, I don't yet know how form validation
> is done (that lifecycle thing... :-) ), so perhaps this fix wouldn't work.
>
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user