Hi Igor,
Thanks for the code. I just browsed it through I'll use it for DB backed
lists.
Why not have
public interface DataProvider extends Serializable
{
Iterator getElements(int first, int minCount);
int getCount();
}
If you have a List you have an Iterator and an Iterator will work for any
Collection (and more). I think minCount should tell just the minimum
number of elements the iterator should contain. This is just to get it
easy and cheap from a List. (Maybe alternatively it could also be just a
hint so that the iterator could actually be smaller).
Maybe keep the Object to IModel translation in the DataView (ListView) - I
have to extend it anyway. In case it is a horizontal concern, you could
easaly write a delegating Iterator: (and plug it in whereever you need it)
public class ModelIterator implements Iterator{
private Iterator _delegate;
public boolean hasNext(){
return _delegate.hasNext();
}
public Object next(){
return makeIModel(_delegate.next());
}
......
}
I think this could keep the Model interface quite simple and functional.
Certainly more than the current List.
Thanks,
Christian
On Wed, 27 Jul 2005 13:16:11 -0700, Igor Vaynberg <[EMAIL PROTECTED]>
wrote:
Hi Christian,
Attached are my proof-of-concept classes ive been playing around with.
Basically this is the interface and cannibilized versions of listview and
pageablelistview. With very little work these can be extended to support
lists transparently. I havent had much time to spend on it lately because
they work for me and there was no interest, so make sure you test them if
you use them. Also I would appreciate any feedback on the interface.
If/when rfe 1245561 gets implemented, it will be trivial to make these
work
with navigation classes that currently only support listviews.
Igor
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Christian Essl
Sent: Wednesday, July 27, 2005 1:06 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] lists
Hi,
I am quite a new Wicket user and have to agree with Igor. I
found ListView always a bit 'magical' confusing. I do not
realy understand wheter I've to keep my list (indexed) stable
between calls and in case of DB backed lists how to do that.
If I want to provide a custom model which methods of list are
used etc. Do I even have to store my list in session etc.
In the end it took me quite some time that there is a method
on ListView to overwride. Still it seems quite unatural to
first provide a model and than to change the component just
to adjust the provided model.
Further it is most often more easy to provide a model from a
list than a list from a model. List is a 20+ method
interface, which is in case you do not know AbstractList or
want to provide something more performent no way easy to
implement. (After you got the concept of models Swing with
ListView is realy easy).
To me Igors proposal is much more clear. It states clearly
what ListView needs - or better does not need. It doesn't
need an extend, where I always think twice if I do not know
the superclass very well and it it is easy to implement.
Writing a wrapper around a real List is very easy if it is
not already provided from the framework.
Just my new user thougts,
Christian
On Mon, 25 Jul 2005 08:57:14 -0700, Igor Vaynberg
<[EMAIL PROTECTED]>
wrote:
>> > As opposed to IModel getListItemModel(final IModel
listViewModel,
>> > final int
>> > index) ?
>> > What exactly does index mean in a context of a database
>> backed list?
>> > What kind of a model does listViewModel represent?
>> >
>>
>> Ok didn't know you would use that method to get a listitem model.
>>
>> But this you already can make on youre own that's no
problem at all.
>> Just subclass ListView once and make youre own IModel
>> definition/implementation for that ListView And youre IModel
>> definition has that getListItemModel() method override the
>> getListItemModel() of listview. Cast to youre Model and call it.
>
> You are right I can do that no problem.
> What I was trying to achieve in all these discussions is to
create a
> simpler/standard/non-list-dependent/more user-aware way to do this
> because I thought other people would have the same problem and thus
> would need a similar solution. However, since no one chimed in on
> this, I guess I am alone. So, maybe, the best solution is for me to
> roll my own version of listview that works how I want it to
and leave
> the framework default as it is since it looks like it works
for most
> people.
>
> Igor
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration
Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Christian Essl
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos -
Hier anmelden: http://mail.yahoo.de
-------------------------------------------------------
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Christian Essl
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
-------------------------------------------------------
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
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user