/** * Returns index of the last item in a current page. Use in UI where you need a message: * <code>Displaying 101 to 140 items</code> ir something similar. * * @return index of the last item in a current page. */ public long getTo(){ long count = getCount(); if((currentPageIndex * pageSize) > count){ return count; }else{ return currentPageIndex * pageSize; } } }
/** * @return a number of pages */ public long pageCount() { try { long results = getCount(); long fullPages = results / pageSize; return results % pageSize == 0 ? fullPages : fullPages + 1; } catch (Exception mustNeverHappen) { throw new InternalException(mustNeverHappen); } }
/** * Returns index of the last item in a current page. Use in UI where you need a message: * <code>Displaying 101 to 140 items</code> ir something similar. * * @return index of the last item in a current page. */ public long getTo(){ long count = getCount(); if((currentPageIndex * pageSize) > count){ return count; }else{ return currentPageIndex * pageSize; } } }
/** * @return a number of pages */ public long pageCount() { try { long results = getCount(); long fullPages = results / pageSize; return results % pageSize == 0 ? fullPages : fullPages + 1; } catch (Exception mustNeverHappen) { throw new InternalException(mustNeverHappen); } }
public long pageCount() { try { long results = getCount(); long fullPages = results / pageSize; return results % pageSize == 0 ? fullPages : fullPages + 1; } catch (Exception mustNeverHappen) { throw new InternalException(mustNeverHappen); } }