Class ListBuilderPaginationSupport<T>
java.lang.Object
com.atlassian.confluence.plugins.spacedirectory.util.ListBuilderPaginationSupport<T>
- Type Parameters:
T
- - the type of the item
- All Implemented Interfaces:
PaginationSupport<T>
Calculates pagination indexes using a com.atlassian.confluence.core.ListBuilder.
This is preferable to using bucket.core.actions.PaginationSupport, since it only loads
part of the list into memory.
-
Constructor Summary
ConstructorDescriptionListBuilderPaginationSupport
(int startIndex, int pageSize, ListBuilder<T> items) -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the next start index.int[]
Returns an array of start indexes for pages that appear after the current page If there are no further pages, null is returnedint
Returns an end index for use in the UI.int
Returns a start index for use in the UI.getPage()
Returns a subset of the list of items passed in, based on startIndex and the page sizeint
Returns the number of items available on the current page.int
Returns the previous start index.int[]
Returns an array of start indexes for pages that appear before the current page If there are no preceding pages, null is returnedint
Returns the start index.int
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
-
Constructor Details
-
ListBuilderPaginationSupport
-
-
Method Details
-
getNiceEndIndex
public int getNiceEndIndex()Description copied from interface:PaginationSupport
Returns an end index for use in the UI. It returns the end index - 1- Specified by:
getNiceEndIndex
in interfacePaginationSupport<T>
- Returns:
- a nice end index
-
getStartIndex
public int getStartIndex()Description copied from interface:PaginationSupport
Returns the start index. If the start index exceeds the index of the last element, the index of the last element is returned. If the start index is less than 0, 0 is returned.- Specified by:
getStartIndex
in interfacePaginationSupport<T>
- Returns:
- the start index.
-
getStartIndexValue
public int getStartIndexValue()Description copied from interface:PaginationSupport
Always return the start index value, regardless of whether the pagination has any total.- Specified by:
getStartIndexValue
in interfacePaginationSupport<T>
- Returns:
- the start index value, regardless of whether the pagination has any total.
-
getNextStartIndex
public int getNextStartIndex()Returns the next start index. Returns -1 if we are on the last page (there is no next page).- Specified by:
getNextStartIndex
in interfacePaginationSupport<T>
- Returns:
- the next start index. Returns -1 if we are on the last page (there is no next page).
-
getPreviousStartIndex
public int getPreviousStartIndex()Returns the previous start index. Returns -1 if we are on the first page (there is no previous page).- Specified by:
getPreviousStartIndex
in interfacePaginationSupport<T>
- Returns:
- the previous start index. Returns -1 if we are on the first page (there is no previous page).
-
getNextStartIndexes
public int[] getNextStartIndexes()Description copied from interface:PaginationSupport
Returns an array of start indexes for pages that appear after the current page If there are no further pages, null is returned- Specified by:
getNextStartIndexes
in interfacePaginationSupport<T>
- Returns:
- an array of start indexes for pages that appear after the current page
-
getPreviousStartIndexes
public int[] getPreviousStartIndexes()Description copied from interface:PaginationSupport
Returns an array of start indexes for pages that appear before the current page If there are no preceding pages, null is returned- Specified by:
getPreviousStartIndexes
in interfacePaginationSupport<T>
- Returns:
- an array of start indexes for pages that appear before the current page
-
getNiceStartIndex
public int getNiceStartIndex()Description copied from interface:PaginationSupport
Returns a start index for use in the UI. It returns the start index + 1- Specified by:
getNiceStartIndex
in interfacePaginationSupport<T>
- Returns:
- a nice start index
-
getPage
Returns a subset of the list of items passed in, based on startIndex and the page size- Specified by:
getPage
in interfacePaginationSupport<T>
- Returns:
- a subset of the list of items passed in, based on startIndex and the page size
-
getTotal
public int getTotal()Description copied from interface:PaginationSupport
Returns the total number of items in the list- Specified by:
getTotal
in interfacePaginationSupport<T>
- Returns:
- total number of items in the list
-
getPageSize
public int getPageSize()Description copied from interface:PaginationSupport
Returns the number of items available on the current page.- Specified by:
getPageSize
in interfacePaginationSupport<T>
- Returns:
- the number of items available on the current page.
-