|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itmill.toolkit.data.util.ContainerOrderedWrapper
public class ContainerOrderedWrapper
A wrapper class for adding external ordering to containers not implementing
the Container.Ordered interface.
If the wrapped container is changed directly (that is, not through the
wrapper), the ordering must be updated with the updateOrderWrapper()
method.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.itmill.toolkit.data.Container |
|---|
Container.Editor, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeEvent, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Sortable, Container.Viewer |
| Field Summary |
|---|
| Fields inherited from interface com.itmill.toolkit.data.Container |
|---|
NULL_ITEM_ID |
| Constructor Summary | |
|---|---|
ContainerOrderedWrapper(Container toBeWrapped)
Constructs a new ordered wrapper for an existing Container. |
|
| Method Summary | |
|---|---|
boolean |
addContainerProperty(Object propertyId,
Class type,
Object defaultValue)
Registers a new Property to all Items in the Container. |
Object |
addItem()
Creates a new Item into the Container, assigns it an automatic ID, and adds it to the ordering. |
Item |
addItem(Object itemId)
Registers a new Item by its ID to the underlying container and to the ordering. |
Object |
addItemAfter(Object previousItemId)
Adds new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds new item after the given item. |
void |
addListener(Container.ItemSetChangeListener listener)
Adds an Item set change listener for the object. |
void |
addListener(Container.PropertySetChangeListener listener)
Registers a new Property set change listener for this Container. |
boolean |
containsId(Object itemId)
Tests if the Container contains the specified Item |
Object |
firstItemId()
Gets the ID of the first Item in the Container. |
Property |
getContainerProperty(Object itemId,
Object propertyId)
Gets the Property identified by the given itemId and propertyId from the Container. |
Collection |
getContainerPropertyIds()
Gets the ID's of all Properties stored in the Container. |
Item |
getItem(Object itemId)
Gets the Item with the given Item ID from the Container. |
Collection |
getItemIds()
Gets the ID's of all Items stored in the Container. |
Class |
getType(Object propertyId)
Gets the data type of all Properties identified by the given Property ID. |
boolean |
isFirstId(Object itemId)
Tests if the Item corresponding to the given Item ID is the first Item in the Container. |
boolean |
isLastId(Object itemId)
Tests if the Item corresponding to the given Item ID is the last Item in the Container. |
Object |
lastItemId()
Gets the ID of the last Item in the Container.. |
Object |
nextItemId(Object itemId)
Gets the ID of the Item following the Item that corresponds to itemId. |
Object |
prevItemId(Object itemId)
Gets the ID of the Item preceding the Item that corresponds to itemId. |
boolean |
removeAllItems()
Removes all items from the underlying container and from the ordering. |
boolean |
removeContainerProperty(Object propertyId)
Removes the specified Property from the underlying container and from the ordering. |
boolean |
removeItem(Object itemId)
Removes an Item specified by the itemId from the underlying container and from the ordering. |
void |
removeListener(Container.ItemSetChangeListener listener)
Removes the Item set change listener from the object. |
void |
removeListener(Container.PropertySetChangeListener listener)
Removes a previously registered Property set change listener. |
int |
size()
Gets the number of Items in the Container. |
void |
updateOrderWrapper()
Updates the wrapper's internal ordering information to include all Items in the underlying container. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ContainerOrderedWrapper(Container toBeWrapped)
toBeWrapped - the container whose contents need to be ordered.| Method Detail |
|---|
public void updateOrderWrapper()
Note : If the contents of the wrapped container change without the wrapper's knowledge, this method needs to be called to update the ordering information of the Items.
public Object firstItemId()
Container.Ordered
firstItemId in interface Container.Orderedpublic boolean isFirstId(Object itemId)
Container.Ordered
isFirstId in interface Container.OrdereditemId - ID of an Item in the Container
true if the Item is first in the Container,
false if notpublic boolean isLastId(Object itemId)
Container.Ordered
isLastId in interface Container.Orderedtrue if the Item is last in the Container,
false if notpublic Object lastItemId()
Container.Ordered
lastItemId in interface Container.Orderedpublic Object nextItemId(Object itemId)
Container.OrdereditemId. If the given Item is the last or not found in
the Container, null is returned.
nextItemId in interface Container.OrdereditemId - ID of an Item in the Container
nullpublic Object prevItemId(Object itemId)
Container.OrdereditemId. If the given Item is the first or not found
in the Container, null is returned.
prevItemId in interface Container.OrdereditemId - ID of an Item in the Container
null
public boolean addContainerProperty(Object propertyId,
Class type,
Object defaultValue)
throws UnsupportedOperationException
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 not
UnsupportedOperationException
public Object addItem()
throws UnsupportedOperationException
addItem in interface Containernull if
the operation failed
UnsupportedOperationException - if the addItem is not supported.
public Item addItem(Object itemId)
throws UnsupportedOperationException
addItem in interface ContaineritemId - the ID of the Item to be created.
null if the operation failed
UnsupportedOperationException - if the addItem is not supported.
public boolean removeAllItems()
throws UnsupportedOperationException
removeAllItems in interface Containertrue if the operation succeeded, otherwise
false
UnsupportedOperationException - if the removeAllItems is not supported.
public boolean removeItem(Object itemId)
throws UnsupportedOperationException
removeItem in interface ContaineritemId - the ID of the Item to be removed.
true if the operation succeeded,
false if not
UnsupportedOperationException - if the removeItem is not supported.
public boolean removeContainerProperty(Object propertyId)
throws UnsupportedOperationException
Note : The Property will be removed from all the Items in the Container.
removeContainerProperty in interface ContainerpropertyId - the ID of the Property to remove.
true if the operation succeeded,
false if not
UnsupportedOperationException - if the removeContainerProperty is not supported.public boolean containsId(Object itemId)
Container
containsId in interface ContaineritemId - ID the of Item to be tested
public Item getItem(Object itemId)
Containernull is returned.
getItem in interface ContaineritemId - ID of the Item to retrieve
null if the Item is
not found in the Containerpublic Collection getItemIds()
Container
getItemIds in interface Container
public Property getContainerProperty(Object itemId,
Object propertyId)
Containernull is returned.
getContainerProperty in interface ContaineritemId - ID of the Item which contains the PropertypropertyId - ID of the Property to retrieve
nullpublic Collection getContainerPropertyIds()
Container
getContainerPropertyIds in interface Containerpublic Class getType(Object propertyId)
Container
getType in interface ContainerpropertyId - ID identifying the Properties
public int size()
Container
size in interface Containerpublic void addListener(Container.ItemSetChangeListener listener)
Container.ItemSetChangeNotifier
addListener in interface Container.ItemSetChangeNotifierlistener - listener to be addedpublic void removeListener(Container.ItemSetChangeListener listener)
Container.ItemSetChangeNotifier
removeListener in interface Container.ItemSetChangeNotifierlistener - listener to be removedpublic void addListener(Container.PropertySetChangeListener listener)
Container.PropertySetChangeNotifier
addListener in interface Container.PropertySetChangeNotifierlistener - The new Listener to be registeredpublic void removeListener(Container.PropertySetChangeListener listener)
Container.PropertySetChangeNotifier
removeListener in interface Container.PropertySetChangeNotifierlistener - Listener to be removed
public Item addItemAfter(Object previousItemId,
Object newItemId)
throws UnsupportedOperationException
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.
UnsupportedOperationExceptionContainer.Ordered.addItemAfter(Object,
Object)
public Object addItemAfter(Object previousItemId)
throws UnsupportedOperationException
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.
UnsupportedOperationExceptionContainer.Ordered.addItemAfter(Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||