it would be trivial to write a jdbc dao impl for the phonebook as well.

-igor


On 9/11/07, Holda, Dariusz <[EMAIL PROTECTED]> wrote:
>
>
> Sorry for late response. I was dragged to another task.
> Thanks for pointing  me to the svn repository, it helped a lot. Shame I
> can't use Hibernate or Ibatis as you do in your project.
>
> Thanks again,
> Dariusz
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:[EMAIL PROTECTED]
> Sent: 31 August 2007 16:50
> To: [email protected]
> Subject: Re: DataView paging
>
> you are holding on to the entire list in your data provider, this is
> bad.
> you should only load the pieces of your list you need.
>
> further your loadabledetachablemodel is broken since you hold on to the
> actual object itself. loadabel detachable models are meant to hold on to
> the
> id, and in load() load the object from the database based on that id
>
> makes sense? see wicket-phonebook example in wicket-stuff svn.
>
> -igor
>
>
> On 8/31/07, Holda, Dariusz <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> > I'm using my implementation of a DataView to display list of objects
> > that are own by another object.
> > I wrote my IDataProvider and LoadableDetachableModel so I can page
> > through the list - the list is quite long it can even have 5000, 6000
> > objects.
> > I'm displaying 10 rows on each page.
> > When I run application locally from my eclipse, everything is fine but
> > when I run it on a server the delay during page changing is
> significant
> > e.g. 3 or more seconds.
> > Could someone advise me on this issue?
> > I'm attaching code snippets.
> >
> > class MyObjectDataProvider implements IDataProvider {
> >
> >         private static final long serialVersionUID =
> > -254289478999293765L;
> >         private List<MyObject> myObjects;
> >
> >         public MyObjectDataProvider(List<MyObject> myObjects){
> >                 this.myObjects = myObjects;
> >         }
> >
> >         public Iterator<MyObject> iterator(int first, int count) {
> >                 return new
> ArrayList<MyObject>(myObjects.subList(first,
> > first+count)).iterator();
> >         }
> >
> >         public IModel model(Object arg0) {
> >                 return new MyObjectModel((MyObject)arg0);
> >         }
> >
> >         public int size() {
> >                 return myObjects.size();
> >         }
> >
> >         public void setMyObjects(
> >                         List<MyObject> myObjects) {
> >                 this.myObjects = myObjects;
> >         }
> >
> >         private final class MyObjectModel extends
> > LoadableDetachableModel{
> >
> >                 private static final long serialVersionUID =
> > 8575601860619558208L;
> >                 private MyObject psc;
> >
> >                 public MyObjectModel(MyObject psc){
> >                         this.psc = psc;
> >                 }
> >
> >                 @Override
> >                 protected Object load() {
> >                         return psc;
> >                 }
> >
> >                 @Override
> >                 public int hashCode(){
> >                         return psc.hashCode();
> >                 }
> >
> >                 @Override
> >                 public boolean equals(Object o){
> >                         if(this == o){
> >                                 return true;
> >                         }
> >                         if(o instanceof MyObjectModel){
> >                                 MyObjectModel that = (MyObjectModel)o;
> >                                 if(this.psc == null ? that.psc==null:
> > this.psc.equals(that.psc)){
> >                                         return true;
> >                                 }
> >                         }
> >                         return false;
> >                 }
> >         }
> > }
> >
> > class MyObjectDataView extends DataView {
> >
> >         private static final long serialVersionUID =
> > -5679706549137629007L;
> >
> >
> >         /**
> >          * Constructor.
> >          *
> >          * @param name of this Component
> >          * @param myObjectModel model containing list of MyObject
> > objects
> >          */
> >         public MyObjectDataView(String name, IDataProvider
> > myObjectDataProvider) {
> >                 super(name, myObjectDataProvider);
> >         }
> >
> >         @Override
> >         protected void populateItem(Item item) {
> >                 MyObject psc = (MyObject)item.getModelObject();
> >                 TextField field1 = new TextField("field1",new
> > PropertyModel(psc,"field1"));
> >                 site.setEnabled(false);
> >
> >                 TextField field2 = new TextField("field2",new
> > PropertyModel(psc,"field2"));
> >                 currency.setEnabled(false);
> >
> >                 item.add(field1);
> >                 item.add(field2);
> >                 item.add(new TextField("field3",new
> > PropertyModel(psc,"field3"))));
> >                 item.add(new TextField("field4",new
> > PropertyModel(psc,"field4"))));
> >                 item.add(new TextField("field5",new
> > PropertyModel(psc,"field5"))));
> >                 item.add(new CheckBox("field6",new
> > PropertyModel(psc,"field6"))));
> >         }
> > }
> >
> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - -
> > - - - - - - -
> >
> > This message is intended only for the personal and confidential use of
> the
> > designated recipient(s) named above.  If you are not the intended
> recipient
> > of this message you are hereby notified that any review,
> dissemination,
> > distribution or copying of this message is strictly prohibited.  This
> > communication is for information purposes only and should not be
> regarded as
> > an offer to sell or as a solicitation of an offer to buy any financial
> > product, an official confirmation of any transaction, or as an
> official
> > statement of Lehman Brothers.  Email transmission cannot be guaranteed
> to be
> > secure or error-free.  Therefore, we do not represent that this
> information
> > is complete or accurate and it should not be relied upon as such.  All
> > information is subject to change without notice.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - -
>
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above.  If you are not the intended recipient
> of this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited.  This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
> secure or error-free.  Therefore, we do not represent that this information
> is complete or accurate and it should not be relied upon as such.  All
> information is subject to change without notice.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to