size() is meant to retrieve the total number of entries
iterator() is meant to retrieve the subset that fits into the current page
so these two things are largely unrelated - eg two different queries to the
database

still there is enough flexibility to accomplish what you want

class CustomDataProvider extends SortableDataProvider implements IDetachable
{
 private transient MyIterator iterator;
 private transient loaded=false;

 private void load() {
      if (loaded==false) {
           iterator=...;
          loaded=true;
      }
}

 public void detach() { loaded=false; }

 public long size() { load(); return iterator.size(); }
 public Iterator iterator(...) { return iterator; }
}

-igor



On 11/23/06, Manu <[EMAIL PROTECTED]> wrote:

Hi, there,

I have the following composition:

WebPage >...

... DataView > CustomProvider extends SortableDataProvider

... PagingNavigator > DataView

The ERROR? I found is this:

When clicking on any of the navigation buttons (PagingNavigator), my
CustomProvider implementation is managed by Wicket FW calling its
implemented (abstract in SortableDataProvider) in the following order:

1 size()
2 iterator(int first, int count)

That causes wrong results, because it calls first the size() to check
the results obtained when I havent called the iterator(...) yet, and
inside my implementation of iterator(int first, int count) I obviously
do the call to the API that accesses to my persistent layer obtaining
the results according to the specified (first, count) pair...

So, what happens in practice... that when navigating the size() method
retrieves the before obtained iterator.size(), and not the new one
that will be obtained immediatly after it, when calling to
iterator(...).

So, if the order was this:

1 iterator(...)
2 size()

The problem would be solved...

Please, would you mind explaining my how to resolve this issue?

Thank you!

M

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to