com.atlassian.jira.web.bean
Class PagerFilter<T>

java.lang.Object
  extended by com.atlassian.jira.web.bean.PagerFilter<T>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GroupBrowserFilter, UserBrowserFilter, UserPickerFilter

public class PagerFilter<T>
extends Object
implements Serializable

This is a super class that implements paging for browsers.

Most other filters (which want paging ability) will extend this.

See Also:
Serialized Form

Field Summary
protected  Collection<Page> pages
          Deprecated. since 4.0 use #getPages() rather than access pages directly
 
Constructor Summary
PagerFilter()
           
PagerFilter(int max)
           
PagerFilter(int start, int max)
           
PagerFilter(PagerFilter old)
           
 
Method Summary
 List<Page> generatePages(Collection<T> items)
          generates a collection of page objects which keep track of the pages for display
 List<T> getCurrentPage(List<T> itemsCol)
          Gets the current page out of a list of objects.
 int getEnd()
           
 int getMax()
           
 int getNextStart()
           
protected  Collection<Page> getPages()
           
 List<Page> getPages(Collection<T> itemsCol)
           
 int getPageSize()
           
 int getPreviousStart()
           
 int getStart()
           
static PagerFilter getUnlimitedFilter()
          A pager that will return unlimited number of objects.
static PagerFilter newPageAlignedFilter(int index, int max)
          A pager that has its start aligned to the page containing the index.
 List<Page> restrictPages(Collection<Page> pages, int size)
          Restrict the pagers to a certain number of pages on either side of the current page.
 void setMax(int max)
           
 void setStart(int start)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pages

protected Collection<Page> pages
Deprecated. since 4.0 use #getPages() rather than access pages directly
A collection of Page objects

Constructor Detail

PagerFilter

public PagerFilter()

PagerFilter

public PagerFilter(PagerFilter old)

PagerFilter

public PagerFilter(int max)

PagerFilter

public PagerFilter(int start,
                   int max)
Method Detail

getUnlimitedFilter

public static PagerFilter getUnlimitedFilter()
A pager that will return unlimited number of objects.

Returns:
A PagerFilter with a max set to Integer.MAX_VALUE

newPageAlignedFilter

public static PagerFilter newPageAlignedFilter(int index,
                                               int max)
A pager that has its start aligned to the page containing the index.

Parameters:
index - the index of a result whose page you want the pager to start at
max - the maximum number of results in a page
Returns:
a new pager aligned to the page containing the index
Throws:
IllegalArgumentException - if index is less than 0

getCurrentPage

public List<T> getCurrentPage(List<T> itemsCol)
Gets the current page out of a list of objects.

Returns:
the sublist that is the current page.

getPages

public List<Page> getPages(Collection<T> itemsCol)

getPages

protected Collection<Page> getPages()

generatePages

public List<Page> generatePages(Collection<T> items)
generates a collection of page objects which keep track of the pages for display

Parameters:
items -

restrictPages

public List<Page> restrictPages(Collection<Page> pages,
                                int size)
Restrict the pagers to a certain number of pages on either side of the current page.

The number of pages to list is stored in PAGES_TO_LIST.


getMax

public int getMax()

getPageSize

public int getPageSize()

setMax

public void setMax(int max)

getStart

public int getStart()

setStart

public void setStart(int start)

getEnd

public int getEnd()

getNextStart

public int getNextStart()

getPreviousStart

public int getPreviousStart()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012 Atlassian. All Rights Reserved.