public class PagerPaginationSupport extends Object implements PaginationSupport
Pager - which cannot report the total
size of the result. The Pager.getCurrentPage() returns
a list of objects currently loaded in memory, which can return a List.size().
This number is imprecise, however, and is used as functional approximation. For various reasons explained
in the {#link Pager} javadoc, the only way to gain an accurate total size from a {#link Pager} is by using
its iterator and keeping count of each object.
If you have a regular, average sized list of items then use PaginationSupport.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_COUNT_ON_EACH_PAGE |
int[] |
nextStartIndexes |
List |
page |
Integer |
pagerSize |
int[] |
previousStartIndexes |
| Constructor and Description |
|---|
PagerPaginationSupport() |
PagerPaginationSupport(int countOnEachPage) |
| Modifier and Type | Method and Description |
|---|---|
int |
getCountOnEachPage() |
int |
getEndIndex() |
com.atlassian.user.search.page.Pager |
getItems() |
int |
getNextIndex() |
int |
getNextStartIndex()
Returns the next start index.
|
int[] |
getNextStartIndexes()
Returns an array of start indexes for pages that appear after the current page
If there are no further pages, null is returned
|
int |
getNiceEndIndex()
Returns an end index for use in the UI.
|
int |
getNiceStartIndex()
Returns a start index for use in the UI.
|
List |
getPage()
returns a subset of the list of items passed in, based on startIndex and the max result per page
|
int |
getPageSize()
Returns the number of items available on the current page.
|
int |
getPreviousIndex() |
int |
getPreviousStartIndex()
Returns the previous start index.
|
int[] |
getPreviousStartIndexes()
Returns an array of start indexes for pages that appear before the current page
If there are no preceding pages, null is returned
|
int |
getStartIndex()
Returns the start index.
|
int |
getStartIndexValue()
Always return the start index value, regardless of whether the pagination has any total.
|
int |
getTotal()
Returns the total number of items in the list
|
boolean |
isTryNext() |
void |
setItems(com.atlassian.user.search.page.Pager items) |
void |
setStartIndex(int startIndex) |
void |
setTryNext(boolean tryNext) |
void |
skipTo(int indexPosition) |
public static final int DEFAULT_COUNT_ON_EACH_PAGE
public List page
public Integer pagerSize
public int[] nextStartIndexes
public int[] previousStartIndexes
public PagerPaginationSupport()
public PagerPaginationSupport(int countOnEachPage)
public int getCountOnEachPage()
public com.atlassian.user.search.page.Pager getItems()
public void setItems(com.atlassian.user.search.page.Pager items)
public void setStartIndex(int startIndex)
public int getNiceEndIndex()
PaginationSupportgetNiceEndIndex in interface PaginationSupportpublic int getEndIndex()
public int getStartIndex()
PaginationSupportgetStartIndex in interface PaginationSupportpublic int getStartIndexValue()
getStartIndexValue in interface PaginationSupportpublic int getNextIndex()
public int getNextStartIndex()
PaginationSupportgetNextStartIndex in interface PaginationSupportpublic int getPreviousIndex()
public int getPreviousStartIndex()
PaginationSupportgetPreviousStartIndex in interface PaginationSupportpublic int[] getNextStartIndexes()
PaginationSupportgetNextStartIndexes in interface PaginationSupportpublic int[] getPreviousStartIndexes()
PaginationSupportgetPreviousStartIndexes in interface PaginationSupportpublic int getNiceStartIndex()
PaginationSupportgetNiceStartIndex in interface PaginationSupportpublic List getPage()
getPage in interface PaginationSupportpublic int getTotal()
PaginationSupportgetTotal in interface PaginationSupportpublic void skipTo(int indexPosition)
public boolean isTryNext()
public void setTryNext(boolean tryNext)
public int getPageSize()
PaginationSupportgetPageSize in interface PaginationSupportCopyright © 2003–2017 Atlassian. All rights reserved.