Q:

Making a model of an item from a list model in wicket

Wicket Version: 6.14
I have a 
LoadableDetachableModel<List<Foo>>

I am trying to use the model with a wizard but each page of the wizard will use a single item of the list.
I want to get a model of each in the list and change the model between each screen in the wizard.
Ideally I could do something like this:
PropertyModel<Foo> fooItemModel = new PropertyModel<Foo>(fooItems, "get(0)");

One other idea I have had is to roll my own ListItemModel and make it take an 
IModel<List<?>>

instead of a ListView.
public ListItemModel(final ListView<T> listView, final int index)
{
    this.listView = listView;
    this.index = index;
}

/**
 * @see org.apache.wicket.model.IModel#getObject()
 */
@Override
public T getObject()
{
    return listView.getModelObject().get(index);
}

/**
 * @see org.apache.wicket.model.IModel#setObject(java.lang.Object)
 */
@Override
public void setObject(T object)
{
    listView.getModelObject().set(index, object);
}

Any advice is appreciated in advanced

A:

I solved the problem by making my own model similar to ListItemModel and using the page index to determine which model to pull out of the main model.
public class ElementModel<T> implements IModel<T>
{
    private static final long serialVersionUID = 1L;

    /** The list model */
    private IModel<List<T>> listModel;

    /** The list item's index */
    private final int index;

    /**
     * Construct
     * 
     * @param listModel
     *            The list model
     * @param index
     *            The index of this model
     */
    public ElementModel(final IModel<List<T>> listModel, final int index)
    {
        this.listModel = listModel;
        this.index = index;
    }

    /**
     * @see org.apache.wicket.model.IModel#getObject()
     */
    @Override
    public T getObject()
    {
        return listModel.getObject().get(index);
    }

    /**
     * @see org.apache.wicket.model.IModel#setObject(java.lang.Object)
     */
    @Override
    public void setObject(T object)
    {
        listModel.getObject().set(index, object);
    }

    /**
     * @see org.apache.wicket.model.IDetachable#detach()
     */
    @Override
    public void detach()
    {
        // Do nothing.
    }
}

