public class Folder<O>
extends java.lang.Object
修飾子とタイプ | クラス | 説明 |
---|---|---|
static class |
Folder.SortOrder |
修飾子とタイプ | フィールド | 説明 |
---|---|---|
static int |
DEFAULT_PAGESIZE |
|
static java.lang.String |
PAGESIZE |
コンストラクタ | 説明 |
---|---|
Folder() |
修飾子とタイプ | メソッド | 説明 |
---|---|---|
boolean |
addElement(O element) |
Add an element only if it does not already exist
|
int |
addElements(java.util.List<O> elems) |
Add elements only if they do not already exist
Re-sorts the array if a sorter is set and any elements are actually added.
|
void |
addSorter(java.lang.String id,
java.util.Comparator<O> sorter) |
Adds a new sorter to the folder.
|
java.util.Iterator<O> |
currentPageIterator() |
Returns an iterator containing the elements on the current page.
|
void |
firstPage() |
Sets folder to display first page.
|
int |
getCurrentPage() |
Returns the current page.
|
java.lang.String |
getCurrentSortBy() |
|
Folder.SortOrder |
getCurrentSortingDirection() |
|
O |
getFirstElement() |
Returns the first element of the sorted folder.
|
O |
getLastElement() |
Returns the last element of the sorted folder.
|
O |
getNextElement(O element) |
Retrieves the next element in the sorted array.
|
int |
getPageOf(O element) |
Returns the page this element is on, using the current sort, or 1 if not found
|
int |
getPages() |
Returns the number of pages in the folder.
|
int |
getPageSize() |
Returns page size.
|
O |
getPreviousElement(O element) |
Retrieves the previous element in the sorted array.
|
int |
getSize() |
Returns the size of the folder.
|
boolean |
isFirstElement(O element) |
Returns true, if elements.equals( firstElementOfTheSortedArray ).
|
boolean |
isFirstPage() |
Returns true, if folder shows points to the first page.
|
boolean |
isLastElement(O element) |
Returns true, if elements.equals( lastElementOfTheSortedArray ).
|
boolean |
isLastPage() |
Returns true, if folder shows points to the last page.
|
void |
lastPage() |
Sets folder to display last page.
|
void |
nextPage() |
Turns folder to next page.
|
void |
previousPage() |
Turns folder to previous page.
|
void |
removeElement(O element) |
Remove an element
|
void |
removeElements(java.util.Collection<O> elems) |
Remove elements
|
void |
setCurrentPage(int currentPage) |
Sets the current page to the given parameter.
|
void |
setElements(O[] elements) |
Set the array of objects the folder should manage.
|
void |
setPageSize(int pageSize) |
Set page size.
|
void |
setSortBy(java.lang.String id,
Folder.SortOrder direction) |
Activates sorting by the choosen Comparator.
|
void |
sort() |
Sorts the elements according the order given by @link addSorter()
and @link setSortBy().
|
public static final java.lang.String PAGESIZE
public static final int DEFAULT_PAGESIZE
public int getCurrentPage()
public void setCurrentPage(int currentPage)
currentPage
- The current page to set.public int getSize()
public int getPages()
public int getPageSize()
public void setPageSize(int pageSize)
pageSize
- The page size to set.public void sort()
public void setElements(O[] elements)
elements
- Array of Os.public void removeElement(O element)
element
- to removepublic void removeElements(java.util.Collection<O> elems)
elems
- to removepublic boolean addElement(O element)
element
- to addpublic int addElements(java.util.List<O> elems)
elems
- to addpublic java.util.Iterator<O> currentPageIterator()
public void nextPage()
public void previousPage()
public void firstPage()
public void lastPage()
public void addSorter(java.lang.String id, java.util.Comparator<O> sorter)
id
- ID to identify the Comparator with @link setSortBy()sorter
- a Comparator to sort the Array given by @link setElements()public void setSortBy(java.lang.String id, Folder.SortOrder direction)
id
- ID to identify the Comparator stored with @link addSorter()direction
- UP or DOWN. UP is reverse sort.public java.lang.String getCurrentSortBy()
public Folder.SortOrder getCurrentSortingDirection()
public O getFirstElement()
public O getLastElement()
public O getNextElement(O element)
element
- public O getPreviousElement(O element)
element
- public boolean isLastPage()
public boolean isFirstPage()
public boolean isLastElement(O element)
element
- public boolean isFirstElement(O element)
element
- public int getPageOf(O element)
element
-