|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itmill.toolkit.data.util.IndexedContainer
public class IndexedContainer
Indexed container implementation.
A list implementation of the com.itmill.toolkit.data.Container
interface. A list is a ordered collection wherein the user has a precise
control over where in the list each new Item is inserted. The user may access
the Items by their integer index (position in the list) or by their Item ID.
Container| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.itmill.toolkit.data.Container |
|---|
Container.Editor, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Sortable, Container.Viewer |
| Nested classes/interfaces inherited from interface com.itmill.toolkit.data.Container |
|---|
Container.Editor, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Sortable, Container.Viewer |
| Nested classes/interfaces inherited from interface com.itmill.toolkit.data.Container |
|---|
Container.Editor, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Sortable, Container.Viewer |
| Field Summary |
|---|
| Fields inherited from interface com.itmill.toolkit.data.Container |
|---|
NULL_ITEM_ID |
| Fields inherited from interface com.itmill.toolkit.data.Container |
|---|
NULL_ITEM_ID |
| Fields inherited from interface com.itmill.toolkit.data.Container |
|---|
NULL_ITEM_ID |
| Constructor Summary | |
|---|---|
IndexedContainer()
|
|
IndexedContainer(Collection itemIds)
|
|
| Method Summary | |
|---|---|
boolean |
addContainerProperty(Object propertyId,
Class type,
Object defaultValue)
Adds a new Property to all Items in the list. |
Object |
addItem()
Creates a new Item into the list, and assign it an automatic ID. |
Item |
addItem(Object itemId)
Creates a new Item with the given ID into the list. |
Object |
addItemAfter(Object previousItemId)
Adds new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds new item after the given item. |
Object |
addItemAt(int index)
Adds new item at given index. |
Item |
addItemAt(int index,
Object newItemId)
Adds new item at given index. |
void |
addListener(Container.ItemSetChangeListener listener)
Adds a Item set change listener for the list. |
void |
addListener(Container.PropertySetChangeListener listener)
Registers a new Property set change listener for this list. |
void |
addListener(Property.ValueChangeListener listener)
Registers a new value change listener for this object. |
Object |
clone()
Supports cloning of the IndexedContainer cleanly. |
int |
compare(Object o1,
Object o2)
Compares two items for sorting. |
boolean |
containsId(Object itemId)
Tests if the list contains the specified Item |
boolean |
equals(Object obj)
|
Object |
firstItemId()
Gets the ID of the first Item in the list. |
Property |
getContainerProperty(Object itemId,
Object propertyId)
Gets the Property identified by the given Item ID and Property ID from the lsit. |
Collection |
getContainerPropertyIds()
Gets the ID's of all Properties stored in the list. |
Object |
getIdByIndex(int index)
Gets ID with the index. |
Item |
getItem(Object itemId)
Gets the Item with the given Item ID from the list. |
Collection |
getItemIds()
Gets the ID's of all Items stored in the list. |
Collection |
getSortableContainerPropertyIds()
Gets the container property IDs, which can be used to sort the item. |
Class |
getType(Object propertyId)
Gets the type of a Property stored in the list. |
int |
hashCode()
|
int |
indexOfId(Object itemId)
Gets the index of an id. |
boolean |
isFirstId(Object itemId)
Tests if the Item corresponding to the given Item ID is the first Item in the list. |
boolean |
isLastId(Object itemId)
Tests if the Item corresponding to the given Item ID is the last Item in the list. |
Object |
lastItemId()
Gets the ID of the last Item in the list. |
Object |
nextItemId(Object itemId)
Gets the ID of the Item following the Item that corresponds to the itemId. |
Object |
prevItemId(Object itemId)
Gets the ID of the Item preceding the Item that corresponds to the itemId. |
boolean |
removeAllItems()
Removes all Items from the list. |
boolean |
removeContainerProperty(Object propertyId)
Removes a Property specified by the given Property ID from the list. |
boolean |
removeItem(Object itemId)
Removes the Item corresponding to the given Item ID from the list. |
void |
removeListener(Container.ItemSetChangeListener listener)
Removes a Item set change listener from the object. |
void |
removeListener(Container.PropertySetChangeListener listener)
Removes a previously registered Property set change listener. |
void |
removeListener(Property.ValueChangeListener listener)
Removes a previously registered value change listener. |
int |
size()
Gets the number of Items in the list. |
void |
sort(Object[] propertyId,
boolean[] ascending)
Sort method. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IndexedContainer()
public IndexedContainer(Collection itemIds)
| Method Detail |
|---|
public Item getItem(Object itemId)
null is returned.
getItem in interface ContaineritemId - the ID of the Item to retrieve.
null if the Item is
not found in the listpublic Collection getItemIds()
getItemIds in interface Containerpublic Collection getContainerPropertyIds()
getContainerPropertyIds in interface Containerpublic Class getType(Object propertyId)
getType in interface Containerid - the ID of the Property.
public Property getContainerProperty(Object itemId,
Object propertyId)
null
is returned.
getContainerProperty in interface ContaineritemId - the ID of the Item which contains the requested Property.propertyId - the ID of the Property to retrieve.
nullContainer.getContainerProperty(Object,
Object)public int size()
size in interface Containerpublic boolean containsId(Object itemId)
containsId in interface ContaineritemId - the ID the of Item to be tested for.
true if the operation succeeded,
false if not
public boolean addContainerProperty(Object propertyId,
Class type,
Object defaultValue)
addContainerProperty in interface ContainerpropertyId - the ID of the new Property.type - the Data type of the new Property.defaultValue - the value all created Properties are initialized to.
true if the operation succeeded,
false if notpublic boolean removeAllItems()
Note : The Property ID and type information is preserved.
removeAllItems in interface Containertrue if the operation succeeded,
false if notpublic Object addItem()
null if the operation fails. After a
successful call you can use the
getItemmethod to fetch the
Item.
addItem in interface Containernull in case of a
failurepublic Item addItem(Object itemId)
null if the operation fails or the Container already
contains a Item with the given ID.
addItem in interface ContaineritemId - the ID of the Item to be created.
null in case of a failurepublic boolean removeItem(Object itemId)
removeItem in interface ContaineritemId - the ID of the Item to remove.
true if the operation succeeded,
false if notpublic boolean removeContainerProperty(Object propertyId)
removeContainerProperty in interface ContainerpropertyId - the ID of the Property to remove.
true if the operation succeeded,
false if notpublic Object firstItemId()
firstItemId in interface Container.Orderedpublic Object lastItemId()
lastItemId in interface Container.Orderedpublic Object nextItemId(Object itemId)
null is returned.
nextItemId in interface Container.OrdereditemId - the ID of an Item in the list.
nullpublic Object prevItemId(Object itemId)
null is returned.
prevItemId in interface Container.OrdereditemId - the ID of an Item in the list.
nullpublic boolean isFirstId(Object itemId)
isFirstId in interface Container.OrdereditemId - the ID of an Item in the list.
true if the Item is first in the list,
false if notpublic boolean isLastId(Object itemId)
isLastId in interface Container.OrdereditemId - the ID of an Item in the list.
true if the Item is last in the list,
false if not
public Item addItemAfter(Object previousItemId,
Object newItemId)
Container.OrderedAdding an item after null item adds the item as first item of the ordered container.
addItemAfter in interface Container.OrderedpreviousItemId - Id of the previous item in ordered container.newItemId - Id of the new item to be added.
Container.Ordered.addItemAfter(Object,
Object)public Object addItemAfter(Object previousItemId)
Container.OrderedAdding an item after null item adds the item as first item of the ordered container.
addItemAfter in interface Container.OrderedpreviousItemId - Id of the previous item in ordered container.
Container.Ordered.addItemAfter(Object)public Object getIdByIndex(int index)
getIdByIndex in interface Container.Indexedindex - Index of the requested ID in the container.
public int indexOfId(Object itemId)
indexOfId in interface Container.IndexeditemId - ID of an Item in the collection
public Item addItemAt(int index,
Object newItemId)
Container.IndexedThe indexes of the item currently in the given position and all the following items are incremented.
addItemAt in interface Container.Indexedindex - Index to add the new item.newItemId - Id of the new item to be added.
Container.Indexed.addItemAt(int, Object)public Object addItemAt(int index)
Container.IndexedThe indexes of the item currently in the given position and all the following items are incremented.
addItemAt in interface Container.Indexedindex - Index to add the new item.
Container.Indexed.addItemAt(int)public void addListener(Container.PropertySetChangeListener listener)
addListener in interface Container.PropertySetChangeNotifierlistener - the new Listener to be registered.public void removeListener(Container.PropertySetChangeListener listener)
removeListener in interface Container.PropertySetChangeNotifierlistener - the listener to be removed.public void addListener(Container.ItemSetChangeListener listener)
addListener in interface Container.ItemSetChangeNotifierlistener - the listener to be added.public void removeListener(Container.ItemSetChangeListener listener)
removeListener in interface Container.ItemSetChangeNotifierlistener - the listener to be removed.public void addListener(Property.ValueChangeListener listener)
addListener in interface Property.ValueChangeNotifierlistener - the new Listener to be registeredpublic void removeListener(Property.ValueChangeListener listener)
removeListener in interface Property.ValueChangeNotifierlistener - the listener to be removed.
public void sort(Object[] propertyId,
boolean[] ascending)
Container.Sortable
sort in interface Container.SortablepropertyId - Array of container property IDs, which values are used to
sort the items in container as primary, secondary, ...
sorting criterion. All of the item IDs must be in the
collection returned by
getSortableContainerPropertyIdsascending - Array of sorting order flags corresponding to each
property ID used in sorting. If this array is shorter than
propertyId array, ascending order is assumed for items
where the order is not specified. Use true
to sort in ascending order, false to use
descending order.Container.Sortable.sort(java.lang.Object[],
boolean[])public Collection getSortableContainerPropertyIds()
Container.Sortable
getSortableContainerPropertyIds in interface Container.SortableContainer.Sortable.getSortableContainerPropertyIds()
public int compare(Object o1,
Object o2)
compare in interface ComparatorComparator.compare(java.lang.Object, java.lang.Object),
#sort((java.lang.Object[], boolean[])
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException - if an object cannot be cloned. .public boolean equals(Object obj)
equals in interface Comparatorequals in class ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class ObjectObject.hashCode()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||