Right, we would need to have something like this:

Public abstract class ModelIteratorDecorator {
        private Iterator delegate;

        ...

        public boolean hasNext() {
                return delegate.hasNext();
        }

        public Object next() {
                return model(delegate.next());
        }

        public abstract Imodel model(Object o);

        ...
}

And then in your dataprovider :

        public Iterator iterator(int first, int count) {
                Iterator it=getiteratorfromdatastore();
                return new ModelIteratorDecorator(it) {
                        public Imodel model(Object o) {
                                ...
                }
        }

This seems more complicated and more verbouse.

-Igor


 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Jonathan Locke
> Sent: Wednesday, August 10, 2005 3:18 PM
> To: [email protected]
> Subject: Re: [Wicket-user] DataView: IDataProvider.primaryKey() vote
> 
> 
> no, you just write an adaptor...
> 
> Johan Compagner wrote:
> 
> >
> >>
> >> i also don't quite understand the choice of the word 
> "Data" here...  
> >> isn't this really a TableView
> >> or GridView more than a DataView?  and if you keep the details of 
> >> sorting and key/identity on the other side of the 
> interface, it would 
> >> work with things other than database objects...
> >
> > It is supposed to be an easy DataView for database objects Else you 
> > would just get a ListView...
> >
> >>
> >> btw, why does model() exist?  couldn't iterator just 
> produce a bunch 
> >> of IModels?  this seems nice to me...
> >
> > If you don't do that then you have to loop twice over everything...
> > first in the iterator (that just returns directly a 
> hibernate list (or 
> > whatever db impl you have)
> >
> > return getContactsDB().find(first, count, "firstName", 
> > true).iterator();
> >
> > Then that method would be completely different.
> > First iterate yourself build up yet another List wrap 
> everything you 
> > get inside a IModel and then call iterate again on it.
> >
> >
> >
> > -------------------------------------------------------
> > 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
> >
> 
> 
> -------------------------------------------------------
> 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
> 
> 
> 




-------------------------------------------------------
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

Reply via email to