|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecti2p.susi.util.Folder
public class Folder
Folder object manages a array Object[] to support paging and sorting. You create a folder object, set the contents with setElements(), add Comparators with addSorter(), choose one with sortBy() and and then fetch the content of the current page with currentPageIterator().
Field Summary | |
---|---|
(package private) Comparator |
currentSorter
|
static int |
DEFAULT_PAGESIZE
|
static boolean |
DOWN
|
static String |
PAGESIZE
|
static boolean |
UP
|
Constructor Summary | |
---|---|
Folder()
|
Method Summary | |
---|---|
void |
addSorter(String id,
Comparator sorter)
Adds a new sorter to the folder. |
Iterator |
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. |
Object |
getElementAtPosXonCurrentPage(int x)
Returns the element on the current page on the given position. |
Object |
getFirstElement()
Returns the first element of the sorted folder. |
Object |
getLastElement()
Returns the last element of the sorted folder. |
Object |
getNextElement(Object element)
Retrieves the next element in the sorted array. |
int |
getPages()
Returns the number of pages in the folder. |
int |
getPageSize()
Returns page size. |
Object |
getPreviousElement(Object element)
Retrieves the previous element in the sorted array. |
int |
getSize()
Returns the size of the folder. |
boolean |
isFirstElement(Object element)
Returns true, if elements.equals( firstElementOfTheSortedArray ). |
boolean |
isFirstPage()
Returns true, if folder shows points to the first page. |
boolean |
isLastElement(Object 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 |
setCurrentPage(int currentPage)
Sets the current page to the given parameter. |
void |
setElements(Object[] elements)
Set the array of objects the folder should manage. |
void |
setPageSize(int pageSize)
Set page size. |
void |
setSortingDirection(boolean direction)
Sets the sorting direction of the folder. |
void |
sortBy(String id)
Activates sorting by the choosen Comparator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PAGESIZE
public static final int DEFAULT_PAGESIZE
public static final boolean DOWN
public static final boolean UP
Comparator currentSorter
Constructor Detail |
---|
public Folder()
Method Detail |
---|
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 setElements(Object[] elements)
elements
- Array of Objects.public Iterator currentPageIterator()
public void nextPage()
public void previousPage()
public void firstPage()
public void lastPage()
public void addSorter(String id, Comparator sorter)
id
- ID to identify the Comparator with @link sortBy()sorter
- a Comparator to sort the Array given by @link setElements()public void sortBy(String id)
id
- ID to identify the Comparator stored with @link addSorter()public Object getElementAtPosXonCurrentPage(int x)
x
- Position of the element on the current page.
public void setSortingDirection(boolean direction)
direction
- @link UP or @link DOWNpublic Object getFirstElement()
public Object getLastElement()
public Object getNextElement(Object element)
element
-
public Object getPreviousElement(Object element)
element
-
public boolean isLastPage()
public boolean isFirstPage()
public boolean isLastElement(Object element)
element
- public boolean isFirstElement(Object element)
element
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |