@Override public int getEstimatedCount() { return fetcher.getEstimatedCount(); }
@Override public int count() { return fetcher.getEstimatedCount(); }
@Override public int countAllValues(Token token) throws CountingNotSupportedException, ServiceException { Fetcher f = browser.restoreFetcher(token.getCookie()); int res = f.getEstimatedCount(); if (res <= 0) { res = PagingServiceUtilities.countManually(this, token); } return res; }
public int gotoPage(int pageNumber) throws BrowseException { final int itemsPerPage = getItemsPerPage(); fetcher.setPageSize(itemsPerPage); if (pageNumber < 0) { pageNumber = 0; } else if (fetcher.getEstimatedCount() != -1) { final int numberOfPages = fetcher.getEstimatedCount() / itemsPerPage + (fetcher.getEstimatedCount() % itemsPerPage > 0 ? 1 : 0); if (pageNumber >= numberOfPages) { pageNumber = numberOfPages - 1; } } final int moveBy = pageNumber - currentPageNumber; if (moveBy != 0) { if (moveBy > 1) { fetcher.fetchNext((moveBy - 1) * itemsPerPage); // fetcher.fetchNext(itemsPerPage); } else if (moveBy < -1) { fetcher.fetchPrevious((-moveBy - 1) * itemsPerPage); // fetcher.fetchPrevious(itemsPerPage); } else if (moveBy == 1) { fetcher.fetchNext(); } else if (moveBy == -1) { fetcher.fetchPrevious(); } } return pageNumber; }
.getDataFields(), getItemsPerPage(), sortFields, order, filters); totalResults = fetcher.getEstimatedCount();