com.atlassian.user.search.page
Class MergedListPager

java.lang.Object
  extended bycom.atlassian.user.search.page.MergedListPager
All Implemented Interfaces:
Pager

public class MergedListPager
extends java.lang.Object
implements Pager


Field Summary
 Pager currentPager
           
 
Fields inherited from interface com.atlassian.user.search.page.Pager
EMPTY_PAGER, NO_POSITION, PRELOAD_LIMIT
 
Method Summary
 java.util.List getCurrentPage()
          returns a list of results (up to the limit defined in PRELOAD_LIMIT).
if there is insufficient preloaded results in the first pager, it will go to the next pager and so on, until the preload limit is reached or all pagers have been checked.
 int getIndex()
           
 int getIndexOfFirstItemInCurrentPage()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
          Use this if you want a typical iterator over the entire data.
 void nextPage()
           
 boolean onLastPage()
           
 void skipTo(int index)
          Will run the index up to this point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentPager

public Pager currentPager
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Pager

iterator

public java.util.Iterator iterator()
Description copied from interface: Pager
Use this if you want a typical iterator over the entire data.

Specified by:
iterator in interface Pager
Returns:
an iterator over all results. Note: calling this multiple times does not reset the iterator back to the first element, as DefaultPager itself does not do this.

getCurrentPage

public java.util.List getCurrentPage()
returns a list of results (up to the limit defined in PRELOAD_LIMIT).
if there is insufficient preloaded results in the first pager, it will go to the next pager and so on, until the preload limit is reached or all pagers have been checked. Calling this method will move the position of the iterator! (like skipTo() does) Note: this will exhaust all the results in a pager before going to the next one. It does not loop through the preloaded results of each each pager passed in. Note: the position in which we start pulling elements from in the iterator is set by skipTo()

Specified by:
getCurrentPage in interface Pager
Returns:
a single, preloaded page.

nextPage

public void nextPage()
Specified by:
nextPage in interface Pager

onLastPage

public boolean onLastPage()
Specified by:
onLastPage in interface Pager

skipTo

public void skipTo(int index)
            throws PagerException
Will run the index up to this point. Calling Pager.getCurrentPage() will then return a page holding this index.

Specified by:
skipTo in interface Pager
Parameters:
index -
Throws:
PagerException - - if the number of items in the backing data is exceeded by the index.

getIndex

public int getIndex()
Specified by:
getIndex in interface Pager
Returns:
the current index position of the pager

getIndexOfFirstItemInCurrentPage

public int getIndexOfFirstItemInCurrentPage()
Specified by:
getIndexOfFirstItemInCurrentPage in interface Pager
Returns:
the index of the first item in the current page, relative to the start of the set


Copyright © 2005-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.