Once again, this has become a philosophical discussion. I say tomato you say tomato.
This is going to live as a contrib package so it wont distrub anything, people who prefer this style will use it. Besides you can do final List mylist; new DataProvider() { public int itemCount() { return mylist.size(); } public Iterator iterator(int first, int count) { return mylist.listIterator(first); } public IModel model(Object o) { return new Model(o); } } And you have a list. Or new DataProvider() { ..... public Iterator iterator(int first, int count) { Session hibernateSession=...; hibernateSession.createQuery(....).setFirstResult(first).setMaxResults(count ).iterate(); // nice and explicit without black magic in the paged list // plus iterate here will use second level cache where as list() will not so you don't have to reconstruct a list from an iterator } } -Igor > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Phil Kulak > Sent: Friday, July 29, 2005 1:55 PM > To: wicket-user@lists.sourceforge.net > Subject: Re: [Wicket-user] lists > > > > It's just as easy to build paging into a List as it is into the > > > component itself. > > > However, the way it is currently, my DAO can return a paging list > > > and set up exactly how said List gets it's data each time > it pages; > > > exactly what a DAO is supposed to do. > > > > Unfortunately the only object that knows exactly how the > paging should > > be set up is the listview and not the dao. How does your > dao know the > > exact window size? If your window is too small you are issuing > > multiple queries, if your window is too big you are getting > more than > > you need which is a waste of memory. In my app the user can > change the > > size of any listview and it was a pain to keep maintaing > paged list window size. > > > > With this interface its transparent because you are getting all > > information you need with every request. > > Look at OrderedPageableList in wicket-contrib-data. All the > settings related to presentation (paging window) are set > bean-style. That way, you get a list from the dao, then > manipulate it to you likeing at any point. Since data is not > fetched until a method from the List interface is called, > this works just fine. > > > >And even > > > though the list has a bunch of extra features for paging, > sorting, > > >or whatever, it's still a list, which is what you expect > to get back > > >when you call a method like findAll(). The way it's set up now is > > >just a lovely way to separate the data access from components. > > > > I agree, it has an air of a more elegant approach, but > there are a lot > > of caveats. What if someone tries to sort the list using > Collections? > > Are you going to bring in 10000 rows with a window size of > 20? Its too > > easy to do something like that, there is no way to know > where the list comes from. > > It's a read-only list that extends AbstractList. Like any > other read-only list, an Unsupported OperationException is > thrown if someone tries to sort it. If someone gets an > iterator and wants to run through 10000 records, well, they > should probably be a least a little bit familiar with the > implementation. If I'm using a LinkedList I know that random > access is slow and write my code accordingly, I don't see how > this is any different. > > > ------------------------------------------------------- > 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_idt77&alloc_id492&op=ick > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------- 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_idt77&alloc_id492&op=click _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user