com.atlassian.jira.web.action.util.lists
Class ListPager<T>

java.lang.Object
  extended by com.atlassian.jira.web.action.util.lists.ListPager<T>

public abstract class ListPager<T>
extends Object

This is a simple pager that can reduce a big list into paged sizes. Its designed for use within webwork actions/jsp in that it is immutable (eg one page per created ListPager) and actions can only really show one page of data per render.

You need to specify the page number you want to go to, the number of rows per page and the full list you want to page.


Constructor Summary
ListPager(List<T> fullList, int pageNo, int rowsPerPage)
          Creates a ListPager that pages a list from a certain page number.
 
Method Summary
protected abstract  String generatePageURL(int targetPageNo, int rowsPerPage)
          Each implementation of this class is expected to generate their own URLS based on the passed in page number
 String getEndPageURL()
           
 int getFromIndex()
           
 int getFullListSize()
           
 List<T> getList()
           
 String getNextPageURL()
           
 int getPageNumber()
           
 String getPrevPageURL()
           
 int getRowsPerPage()
           
 String getStartPageURL()
           
 int getToIndex()
           
 boolean hasMultiplePages()
          Returns true if the pager has multiple pages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListPager

public ListPager(List<T> fullList,
                 int pageNo,
                 int rowsPerPage)
Creates a ListPager that pages a list from a certain page number. If the page number is greater than makes sense, it is trims it back to the last possible page number.

Parameters:
fullList - is the full list of object
pageNo - is a zero based index
rowsPerPage - must be > 0
Method Detail

getPrevPageURL

public String getPrevPageURL()
Returns:
null if there is no previous link url possible otherwise calls generatePageURL(int, int) to generate an URL

getNextPageURL

public String getNextPageURL()
Returns:
null if there is no next link url possible otherwise calls generatePageURL(int, int) to generate an URL

getStartPageURL

public String getStartPageURL()

getEndPageURL

public String getEndPageURL()

generatePageURL

protected abstract String generatePageURL(int targetPageNo,
                                          int rowsPerPage)
Each implementation of this class is expected to generate their own URLS based on the passed in page number

Parameters:
targetPageNo - the target page number
rowsPerPage - the rows per page
Returns:
an non null URL

getList

public List<T> getList()
Returns:
the paged list of object

getPageNumber

public int getPageNumber()

getRowsPerPage

public int getRowsPerPage()

getFullListSize

public int getFullListSize()

getFromIndex

public int getFromIndex()

getToIndex

public int getToIndex()

hasMultiplePages

public boolean hasMultiplePages()
Returns true if the pager has multiple pages. If this is false, then all the link generating methods will return null, since there isnt more than one page of data.

Returns:
returns true if the pager has multiple pages


Copyright © 2002-2012 Atlassian. All Rights Reserved.