com.missiondata.oss.lakeshore.widget
Class BatchedList

java.lang.Object
  extended bycom.missiondata.oss.lakeshore.Controller
      extended bycom.missiondata.oss.lakeshore.Component
          extended bycom.missiondata.oss.lakeshore.widget.BatchedList

public class BatchedList
extends Component

Handles pagination and navigation (with back button support) of lists of items. The user of this class must render the current list and the navigation, e.g.,

 private BatchedList batcher;

 public BigList(List listOfItems)
 {
   batcher = new BatchedList(listOfItems);
 }

 public void renderOn(Renderer r)
 {
   for (Iterator iterator = batcher.batch().iterator(); iterator.hasNext();)
   {
     ListItem listItem = (ListItem)iterator.next();
     r.anchor(iterator.next(), new CallBack()
     {
       public void execute(String s) {//do something interesting}
     });
   }
   r.render(batcher);
 }


Field Summary
static int DEFAULT_SIZE
           
 
Constructor Summary
BatchedList(int batchSize, java.util.List items)
           
BatchedList(java.util.List itemList)
           
 
Method Summary
 java.lang.String applyFilter(BatchedListFilter filter)
           
 java.util.List batch()
           
 java.util.List batch(int page)
           
 int endIndex()
           
 int endIndex(int page)
           
 int getCurrentPage()
           
 int maxPages()
           
 void nextPage()
           
 boolean onFirstPage()
           
 boolean onLastPage()
           
 void previousPage()
           
 void renderOn(Renderer r)
           
 void setBatchedListPageDecorator(BatchedListPageDecorator batchedListPageDecorator)
           
 int size()
           
 void sort(java.util.Comparator c)
           
 int startIndex()
           
 int startIndex(int page)
           
 boolean turnToPageWith(java.lang.Object object)
          Turn to the page with the specific object
 
Methods inherited from class com.missiondata.oss.lakeshore.Controller
activeController, answer, answer, answerAction, answerAction, call, call, callAction, callAction, callMethod, callMethod, clearDelegate, getParent, getRequestHandler, getSessionAttribute, getUploadedFile, inform, isUserInRole, onAnswer, onAnswer, receiveCall, render, resumeCall, setDelegate, setParent, setRequestHandler, setSessionAttribute, setThreadManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
See Also:
Constant Field Values
Constructor Detail

BatchedList

public BatchedList(java.util.List itemList)

BatchedList

public BatchedList(int batchSize,
                   java.util.List items)
Method Detail

getCurrentPage

public int getCurrentPage()

size

public int size()

startIndex

public int startIndex()

startIndex

public int startIndex(int page)

endIndex

public int endIndex()

endIndex

public int endIndex(int page)

batch

public java.util.List batch()

batch

public java.util.List batch(int page)

maxPages

public int maxPages()

onFirstPage

public boolean onFirstPage()

onLastPage

public boolean onLastPage()

nextPage

public void nextPage()

previousPage

public void previousPage()

renderOn

public void renderOn(Renderer r)
Specified by:
renderOn in class Component

setBatchedListPageDecorator

public void setBatchedListPageDecorator(BatchedListPageDecorator batchedListPageDecorator)

sort

public void sort(java.util.Comparator c)

applyFilter

public java.lang.String applyFilter(BatchedListFilter filter)
Parameters:
filter -
Returns:
BatchedListFilter.FILTER_APPLIED BatchedListFilter.FILTER_REMOVED BatchedListFilter.FILTER_APPLIED_NO_EFFECT

turnToPageWith

public boolean turnToPageWith(java.lang.Object object)
Turn to the page with the specific object

Parameters:
object -
Returns:
true if the object was found, false otherwise