com.atlassian.confluence.plugins.spacedirectory.util
Class ListBuilderPaginationSupport<T>

java.lang.Object
  extended by 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 Summary
ListBuilderPaginationSupport(int startIndex, int pageSize, ListBuilder<T> items)
           
 
Method Summary
 int getCountOnEachPage()
          Deprecated. since 3.0 (at least). Please use getPageSize()}}
 int getNextIndex()
          Deprecated. since 3.0 (at least). Please use getNextStartIndex()}
 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<T> getPage()
          Returns a subset of the list of items passed in, based on startIndex and the page size
 int getPageSize()
          Returns the number of items available on the current page.
 int getPreviousIndex()
          Deprecated. since 3.0 (at least). Please use getPreviousStartIndex()}
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListBuilderPaginationSupport

public ListBuilderPaginationSupport(int startIndex,
                                    int pageSize,
                                    ListBuilder<T> items)
Method Detail

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).

getNextIndex

public int getNextIndex()
Deprecated. since 3.0 (at least). Please use getNextStartIndex()}

Returns:
next start index

getPreviousIndex

public int getPreviousIndex()
Deprecated. since 3.0 (at least). Please use getPreviousStartIndex()}

Returns:
previous start index

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.

getCountOnEachPage

public int getCountOnEachPage()
Deprecated. since 3.0 (at least). Please use getPageSize()}}

Returns:
page size


Copyright © 2003-2011 Atlassian. All Rights Reserved.