chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Corneanu <>
Subject ItemIterable page fetching
Date Wed, 08 Jan 2014 09:30:15 GMT
we use ItemIterable for paging through a query result. The data is
displayed in a grid, page by page and the user can navigate back and forth.
For the rendering phase we use a code similar to:

Iterable it = itemITerable.skipTo(offset).getPage(50);
foreach(Object obj: it) {

Now I have to implement a refresh button that would have to refresh the
currently displayed page (fetch the data again from the server). I know
that the clean solution is to run the query again and get a new instance
of ItemIterable and start from the same offset etc. but due to some
awkward design decisions I am forced to work with the same ItemIterable
instance and find a workaround.

I have investigated the implementations of AbstractIterable and
AbstractIterator (mainly CollectionPageIterable and
CollectionPageIterator) and found out that a call to getPage() always
returns a newly created instance of CollectionPageIterable which in turn
will create a CollectionPageIterator which when requested to iterate
will fetch the items from the server.

Is my understanding of the implementation correct?
Can I assume that the behaviour will stay the same (is part of the
public API) ?

Best regards,

Corneanu Dan

Sava Technologies SRL
Sf. Nicolae Nr. 5 Ap. 2
300015 Timisoara

Phone: +40 256 201 269

View raw message