nl.surfnet.coin.teams.domain
Class Pager

java.lang.Object
  extended by nl.surfnet.coin.teams.domain.Pager

public class Pager
extends Object

Utility class for paging


Constructor Summary
Pager(int totalCount, int offset, int pageSize)
           
 
Method Summary
 Page getFirstPage()
           
 Page getLastPage()
           
 Page getNextPage()
           
 int getOffset()
           
 int getPageSize()
           
 Page getPreviousPage()
           
 int getTotalCount()
           
 List<Page> getVisiblePages()
          Start algorithm, example: pagesize 10, visible pages 5, total pages 15 Current page is 4 (first 5): start at 1: 1 - 2 - 3 - 4 - 5 Current page is 12 (last 5): start at 11: 11 - 12 - 13 - 14 - 15 Current page is 8 (middle): start at 6: 6 - 7 - 8 - 9 - 10 If there is at most 1 page, an empty list is returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pager

public Pager(int totalCount,
             int offset,
             int pageSize)
Method Detail

getTotalCount

public int getTotalCount()
Returns:
the totalCount

getFirstPage

public Page getFirstPage()
Returns:
Page in paging that is the first possible page or null if no such navigation item is needed (first page is current)

getPreviousPage

public Page getPreviousPage()
Returns:
Page in paging that goes to the previous page or null if no such item is needed (first page is current)

getNextPage

public Page getNextPage()
Returns:
Page in paging that goes to the next page or null if no such item is needed (last page is current)

getLastPage

public Page getLastPage()
Returns:
Page in paging that goes to the last possible page or null if no such item is needed (last page is current)

getVisiblePages

public List<Page> getVisiblePages()
Start algorithm, example: pagesize 10, visible pages 5, total pages 15 If there is at most 1 page, an empty list is returned.

Returns:
List of Page's that should be visible (sliding pager), can be empty

getOffset

public int getOffset()
Returns:
offset the startpoint within the totalresult for this request

getPageSize

public int getPageSize()
Returns:
(maximum) pagesize for the current resultset


Copyright © 2009-2013 SURFnet bv, The Netherlands. All Rights Reserved.