The more I think about it the more I don't think OIR has anything to do with
the data provider or models. It seems to me OIR is really an artifact of the
dataview.

As far as I can see there are two reasons why you would want to use OIR.
1) you want to keep state across requests
2) creating dataitems is expensive because they contain complex panels, etc.


Also, it still feels somewhat unnatural to let the model implemenation do
equals or hashcode. As I said before, models are really locators (shouldve
probably been called IModelLocator :) ) and locators should not know how to
compare objects, just where to retrieve them. So as far as the patch goes, I
like the idea but maybe we should just do
model.getModelObject().equals(model2.getModelObject()) as opposed to
model.equals(model2). I believe John suggested this as well.

As far as the implementation goes, I think we should have something like
this:

A) DataView.enableOptimizedItemRemoval(IUniqueIdProvider)
B) DataView.enableOptmizedItemRemoval()

The first method will use the unique id of the object since in some cases
its cheaper and easier. The second method will simply use
modelObject.hashchode and modelObject.equals. I still think 90% of the cases
will not have OIR enabled.

Thoughts?
-Igor

P.S. thanks for finding that ordering bug :)


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Christian Essl
> Sent: Saturday, August 13, 2005 3:39 AM
> To: [email protected]
> Subject: Re: [Wicket-user] [Wicket] DataView and optimized 
> item removal
> 
> Attached is the patch. Changed DataView added OIRModel() 
> helper and a test DataViewOIRModelTest.
> 
> With this implementation there is no exception thrown if two 
> objects share an equal IModel. For those ori is silently 
> turned off. Please look at the comments in the code.
> 
> I also replace getDataProvider() to return an empty model 
> instead of null.
> 
> I think in the current code (from the cvs and my patch) the 
> dataitems are not always rendered in the order as they come 
> from the iterator. I guess for existing DataItems setting the 
> index has no effect. Is this right? If so I think this should 
> be fixed.
> 
> Christian
> 
> 
> On Fri, 12 Aug 2005 16:30:37 -0700, Igor Vaynberg 
> <[EMAIL PROTECTED]>
> wrote:
> 
> > Why don't you implement it and email us the patch. That way 
> we can all 
> > take a look at it and see if it works.
> >
> > -Igor
> >
> >
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED]
> >> [mailto:[EMAIL PROTECTED] On Behalf Of 
> >> Christian Essl
> >> Sent: Friday, August 12, 2005 1:48 PM
> >> To: [email protected]
> >> Subject: Re: [Wicket-user] [Wicket] DataView and optimized item 
> >> removal
> >>
> >> On Fri, 12 Aug 2005 12:57:37 -0700, Igor Vaynberg 
> >> <[EMAIL PROTECTED]>
> >> wrote:
> >>
> >> > Explain the benefits of your approach as opposed to the current 
> >> > implementation - I cant think of any off the top of my head.
> >> Because you can use any object not just a string. This 
> means you can 
> >> provide optimized item removal (lets call it oir) also to 
> things like 
> >> wicket.examples.guestbook.Comment objects ( return new 
> >> EqualsModel(ob,ob) ). I do not know an easy way to create 
> a string id 
> >> for this not db held objects. Or in case a particular object is 
> >> contained double in the iterator you can turn of oir for just this 
> >> particular item new Model(ob).
> >> new Model(ob) gives you always an indeed unique id.
> >>
> >> >
> >> > 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.
> >> >
> >>
> >> Performance wise you are right. The difference is with new
> >> List(colleciton) the Model reflects a snapshot not the 
> actual maybe 
> >> changing collection.
> >>
> >> Christian
> >>
> >>
> >>    
> >>
> >>    
> >>            
> >> ___________________________________________________________
> >> 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
> 
> 
> 
> --
> Christian Essl 
> 




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