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

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

public class PagerFilter<T>
extends java.lang.Object
implements java.io.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  java.util.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
 java.util.List<Page> generatePages(java.util.Collection<T> items)
          generates a collection of page objects which keep track of the pages for display
 java.util.List<T> getCurrentPage(java.util.List<T> itemsCol)
          Gets the current page out of a list of objects.
 int getEnd()
           
 int getMax()
           
 int getNextStart()
           
protected  java.util.Collection<Page> getPages()
           
 java.util.List<Page> getPages(java.util.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.
 java.util.List<Page> restrictPages(java.util.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)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pages

protected java.util.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:
java.lang.IllegalArgumentException - if index is less than 0

getCurrentPage

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

Returns:
the sublist that is the current page.

getPages

public java.util.List<Page> getPages(java.util.Collection<T> itemsCol)

getPages

protected java.util.Collection<Page> getPages()

generatePages

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

Parameters:
items -

restrictPages

public java.util.List<Page> restrictPages(java.util.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2010 Atlassian. All Rights Reserved.