org.pm4j.core.pm.pageable
Interface PageableCollection<T_ITEM>

Type Parameters:
T_ITEM - The type of items handled by this set.
All Known Implementing Classes:
PageableListImpl, PageablePmsForBeans

public interface PageableCollection<T_ITEM>

Common interface for pageable object sets.

It allows to navigate over a set of objects using a page index.

Author:
olaf boede

Nested Class Summary
static interface PageableCollection.Filter<T>
          Interface for classes used to filter collection items.
 
Method Summary
 void deSelect(T_ITEM item)
          Removes the given item from the set of selected items.
 PageableCollection.Filter<?> getBackingItemFilter()
           
 int getCurrentPageIdx()
           
 java.util.List<T_ITEM> getItemsOnPage()
           
 int getNumOfItems()
           
 int getPageSize()
           
 java.util.Collection<T_ITEM> getSelectedItems()
           
 boolean isMultiSelect()
           
 boolean isSelected(T_ITEM item)
           
 void onUpdateCollection()
          Gets called whenever the collection behind this instance was updated.
 void select(T_ITEM item)
          Adds the given item to the set of selected items.
 void setBackingItemFilter(PageableCollection.Filter<?> filter)
          Provides a filter that will be applied to the items of the backing collection.
 void setCurrentPageIdx(int pageIdx)
           
 void setItemFilter(PageableCollection.Filter<?> filter)
          Provides a filter that will be applied to the items of this collection.
 void setMultiSelect(boolean isMultiSelect)
          Defines the selection behavior.
 void setPageSize(int newSize)
           
 void sortBackingItems(java.util.Comparator<?> sortComparator)
          Provides a sort comparator that will be applied to the items of the backing collection.
 void sortItems(java.util.Comparator<?> sortComparator)
          Sorts the items of this collection based on the given operator.
 

Method Detail

getItemsOnPage

java.util.List<T_ITEM> getItemsOnPage()
Returns:
The set of item to display on the current page.

getPageSize

int getPageSize()
Returns:
The number of items to reserve space for on the current page.

setPageSize

void setPageSize(int newSize)
Parameters:
newSize - The new page size. Should be greater than zero.

getCurrentPageIdx

int getCurrentPageIdx()
Returns:
The current page number. Starts with one.

setCurrentPageIdx

void setCurrentPageIdx(int pageIdx)
Parameters:
pageIdx - Navigates to the specified page.

Valid range: 1 .. #getTotalPageNum().


sortItems

void sortItems(java.util.Comparator<?> sortComparator)
Sorts the items of this collection based on the given operator.

Parameters:
sortComparator - The item comparator to use.
May be null to switch sorting off.

sortBackingItems

void sortBackingItems(java.util.Comparator<?> sortComparator)
Provides a sort comparator that will be applied to the items of the backing collection.

In case of a simple collection (without backing collection), the comparator will be applied to the items of this collection.

Parameters:
sortComparator - The item comparator to use.
May be null to switch sorting off.

setItemFilter

void setItemFilter(PageableCollection.Filter<?> filter)
Provides a filter that will be applied to the items of this collection.

Parameters:
filter - The item filter to use.
May be null to switch filtering off.

setBackingItemFilter

void setBackingItemFilter(PageableCollection.Filter<?> filter)
Provides a filter that will be applied to the items of the backing collection.

In case of a simple collection (without backing collection), the filter will be applied to the items of this collection.

Parameters:
filter - The item filter to use.
May be null to switch filtering off.

getBackingItemFilter

PageableCollection.Filter<?> getBackingItemFilter()
Returns:
The current filter definition for the backing collection.

getNumOfItems

int getNumOfItems()
Returns:
The total number of object within this set.

isSelected

boolean isSelected(T_ITEM item)
Parameters:
item - The item to check.
Returns:
true if the item was selected.

select

void select(T_ITEM item)
Adds the given item to the set of selected items.

Has no effect if the item is already selected.

Parameters:
item - The item to select.

deSelect

void deSelect(T_ITEM item)
Removes the given item from the set of selected items.

Has no effect if the item was not selected.

Parameters:
item - The item to deselect.

isMultiSelect

boolean isMultiSelect()
Returns:
true if more than one item can be selected.

setMultiSelect

void setMultiSelect(boolean isMultiSelect)
Defines the selection behavior.

Parameters:
isMultiSelect -

getSelectedItems

java.util.Collection<T_ITEM> getSelectedItems()
Returns:
The set of selected items.

onUpdateCollection

void onUpdateCollection()
Gets called whenever the collection behind this instance was updated.