> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Christian Essl
>
> No it is not the same issue again.
>
> However I was thinking about it and somehow realized that
> most of pagable db views have identical rows (with different
> data of course).
>
> So I though maybe even a stronger optimization than optimized
> item removal, would be to build at the start of DataView all
> the DataItems for the viewSize and allways keep them. Than
> just repopulate the dataitems through populate(DataItem
> dm,IModel newModel) with the new data. The non used DataItems
> should be hidden.
The optmized-item-removal in the context of the dataview is not really an
optimization. It is a way for you to keep state in your dataitems and all
attached items across requests. So for example you can set a row to be
highlited (store the highlight flag in the dataitem), and that will last
across requests, if we do a removeall() every time than that wont be
possible w/out some outside model keeping track of highlited rows.
Im not sure what the performance gain would be if we precreate dataitems,
because remember that if we do that instead of creating new ones we would
need to keep versions of everything that changed so that the back button
works. I think its more efficient to just create a new one whenever needed -
but of course this is just off the top of my head.
> I also wonder why the DataItem needs an IModel, wouldn't it
> be enought to pass the object gotten from the iterator
> straight through to populateItem(DataItem i, Object data)?
This is so that the dataprovider can wrap the object and the model can be
passed on to the items added to the dataitem. If that's not done you would
have to wrap it yourself everytime which gets old. Currently just
datitem.getModel() and pass that on to your objects and if you want the
object itself dataitem.getModelObject().
BTW, something just hit me, since we removed primarykey() from idataprovider
we can now do this:
public class ListAdapter implements IDataProvider
{
private List list;
public ListAdapter(List list) {
this.list=list;
}
public Iterator iterator(int first, int count)
{
return list.listIterator(first);
}
public int size()
{
return list.size();
}
public IModel model(Object object)
{
return new Model((Serializable)object);
}
}
-Igor
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user