Explain the benefits of your approach as opposed to the current
implementation - I cant think of any off the top of my head.

As far as collections go, performance wise I think you would be better off
transforming it to a list first or to an array and writing an ArrayAdapter.
Assuming your collection interface isnt backed by a dynamic source this
should work ok.

-igor
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Christian Essl
> Sent: Friday, August 12, 2005 12:36 PM
> To: [email protected]
> Subject: Re: [Wicket-user] [Wicket] DataView and optimized 
> item removal
> 
> On Fri, 12 Aug 2005 11:40:02 -0700, Igor Vaynberg 
> <[EMAIL PROTECTED]>
> wrote:
> 
> >> -----Original Message-----
> 
> > 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.
> 
> Thanks for the explanation and I realy did not want to start 
> this over again however: wouldn't it also be good for plain 
> IDataProviders? Just one answer I'll stop immideately.
> 
> I was thinking of a helper:
> 
> class EqualsModel extends Model{
>     private Serializable uniqueKey;
>     EqualsModel(Serializable object, Serializable uniqueKey){
>       super(object;
> 
>       uniqueKey = uniqueKey;
>     }
> 
>     boolean equals(Object ob){
>       if(uniqueKey == null) return super.equals(ob);
>       if(ob instanceof EqualsModel)
>          return uniqueKey.equals(((EqualsModel)ob).uniqueKey);
>       return false;
>     }
> 
>     int hashCode(){
>       return uniqueKey == null ? super.hashCode() : 
> uniqueKey.hashCode();
>     }
> }
> 
> //IDataProvider
> IModel model(Object ob){
>    return new EqualsModel(ob,((MyBean)ob).getId());
> }
> 
> 
> > 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);
> >     }
> >
> > }
> 
> That's very good maybe we could also do it for a Collection?
> 
> public Iterator iterator(int first, int count){
>      Iterator ret = collection.iterator();
>      for(int i=0;i<first;i++){
>        if(ret.hasNext()) ret.next();
>      }
>      return ret;
> }
> 
>       
> 
>       
>               
> ___________________________________________________________
> 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
> [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