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>

public class ListBuilderPaginationSupport<T> extends Object implements 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 Details

    • ListBuilderPaginationSupport

      public ListBuilderPaginationSupport(int startIndex, int pageSize, ListBuilder<T> items)
  • 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 interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<T>
      Returns:
      a nice start index
    • getPage

      public List<T> getPage()
      Returns a subset of the list of items passed in, based on startIndex and the page size
      Specified by:
      getPage in interface PaginationSupport<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 interface PaginationSupport<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 interface PaginationSupport<T>
      Returns:
      the number of items available on the current page.