Class ContainerOrderedWrapper

A wrapper class for adding external ordering to containers not implementing the com.itmill.toolkit.data.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.

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.data.util.ContainerOrderedWrapper

ContainerOrderedWrapper(Container)

Parameters

toBeWrapped

the container whose contents need to be ordered

Constructs a new ordered wrapper for an existing Container. Works even if the to-be-wrapped container already implements the Container.Ordered interface.

addContainerProperty(Object, Class, Object)

Parameters

propertyId

ID of the new Property

type

Data type of the new Property

defaultValue

The value all created Properties are initialized to

return

true if the operation succeeded, false if not

Adds a new Property to all Items in the Container.

addItem()

Parameters

return

the autogenerated ID of the new Item or null if the operation failed

Creates a new Item into the Container, assigns it an automatic ID, and adds it to the ordering.

addItem(Object)

Parameters

return

the added Item or null if the operation failed

Adds a new Item by its ID to the underlying container and to the ordering.

addItemAfter(Object)

Parameters

previousItemId

Id of the previous item in ordered container.

return

Returns item id the the created new item or null if the operation fails.

Description copied from interface: addItemAfter

Add new item after the given item.

Adding an item after null item adds the item as first item of the ordered container.

addItemAfter(Object, Object)

Parameters

previousItemId

Id of the previous item in ordered container.

newItemId

Id of the new item to be added.

return

Returns new item or null if the operation fails.

Description copied from interface: addItemAfter

Add new item after the given item.

Adding an item after null item adds the item as first item of the ordered container.

addListener(Container.ItemSetChangeListener)

Parameters

listener

listener to be added

Description copied from interface: addListener

Adds a Item set change listener for the object.

addListener(Container.PropertySetChangeListener)

Parameters

listener

The new Listener to be registered

Description copied from interface: addListener

Registers a new Property set change listener for this Container.

firstItemId()

Parameters

return

ID of the first Item in the Container

Description copied from interface: firstItemId

Gets the ID of the first Item in the Container.

isFirstId(Object)

Parameters

itemId

ID of an Item in the Container

return

true if the Item is first in the Container, false if not

Description copied from interface: isFirstId

Tests if the Item corresponding to the given Item ID is the first Item in the Container.

isLastId(Object)

Parameters

return

true if the Item is last in the Container, false if not

Description copied from interface: isLastId

Tests if the Item corresponding to the given Item ID is the last Item in the Container.

lastItemId()

Parameters

return

ID of the last Item in the Container

Description copied from interface: lastItemId

Gets the ID of the last Item in the Container..

nextItemId(Object)

Parameters

itemId

ID of an Item in the Container

return

ID of the next Item or null

Description copied from interface: nextItemId

Gets the ID of the Item following the Item that corresponds to itemId . If the given Item is the last or not found in the Container, null is returned.

prevItemId(Object)

Parameters

itemId

ID of an Item in the Container

return

ID of the previous Item or null

Description copied from interface: prevItemId

Gets the ID of the Item preceding the Item that corresponds to itemId . If the given Item is the first or not found in the Container, null is returned.

removeAllItems()

Parameters

return

true if the operation succeeded, false if not

Removes all items from the underlying container and from the ordering.

removeContainerProperty(Object)

Parameters

propertyId

ID of the Property to remove

return

true if the operation succeeded, false if not

Removes the specified Property from the underlying container and from the ordering. Note that the Property will be removed from all Items in the Container.

removeItem(Object)

Parameters

return

true if the operation succeeded, false if not

Removes an Item specified by itemId from the underlying container and from the ordering.

removeListener(Container.ItemSetChangeListener)

Parameters

listener

listener to be removed

Description copied from interface: removeListener

Removes a Item set change listener from the object.

removeListener(Container.PropertySetChangeListener)

Parameters

listener

Listener to be removed

Description copied from interface: removeListener

Removes a previously registered Property set change listener.

updateOrderWrapper()

Updates the wrapper's internal ordering information to include all Items in the underlying container. 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.