Return-Path: X-Original-To: apmail-chemistry-dev-archive@www.apache.org Delivered-To: apmail-chemistry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1443A1080C for ; Wed, 8 Jan 2014 09:30:51 +0000 (UTC) Received: (qmail 65825 invoked by uid 500); 8 Jan 2014 09:30:49 -0000 Delivered-To: apmail-chemistry-dev-archive@chemistry.apache.org Received: (qmail 65624 invoked by uid 500); 8 Jan 2014 09:30:44 -0000 Mailing-List: contact dev-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list dev@chemistry.apache.org Received: (qmail 65615 invoked by uid 99); 8 Jan 2014 09:30:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jan 2014 09:30:43 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [95.76.221.88] (HELO mail.savatech.ro) (95.76.221.88) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 08 Jan 2014 09:30:39 +0000 Received: (qmail 2463 invoked from network); 8 Jan 2014 09:23:32 -0000 Received: from unknown (HELO ?192.168.5.219?) (192.168.5.219) by 0 with SMTP; 8 Jan 2014 09:23:32 -0000 Message-ID: <52CD1AA7.2040504@savatech.ro> Date: Wed, 08 Jan 2014 11:30:15 +0200 From: Dan Corneanu User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: dev@chemistry.apache.org Subject: ItemIterable page fetching X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hello, 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, Dan. -- Corneanu Dan Sava Technologies SRL Sf. Nicolae Nr. 5 Ap. 2 300015 Timisoara Romania Phone: +40 256 201 269 Email: cdan@savatech.ro Web: http://www.savatech.ro