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.

Synopsis

See Also
com.itmill.toolkit.data.Container
VERSION@

Since

3.0

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

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

Add a new Property to all Items in the list. The Property ID, data type and default value of the new Property are given as parameters.

addItem()

Parameters

return

ID of the newly created Item, or null in case of a failure

Create a new Item into the list, and assign it an automatic ID. The new ID is returned, or null if the operation fails. After a successful call you can use the <javadoc:link ref="METHOD-52-1" name=" getItem "> getItem method to fetch the Item.

addItem(Object)

Parameters

itemId

ID of the Item to be created

return

Created new Item, or null in case of a failure

Create a new Item with the given ID into the list. The new Item is returned, and it is ready to have its Properties modified. Returns null if the operation fails or the Container already contains a Item with the given ID.

addItemAfter(Object)

addItemAfter(Object, Object)

addItemAt(int)

Parameters

index

Index to add the new item.

return

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

See Also
addItemAt(int)
Description copied from interface: addItemAt

Add new item at given index.

The indexes of the item currently in the given position and all the following items are incremented.

addItemAt(int, Object)

Parameters

index

Index to add the new item.

newItemId

Id of the new item to be added.

return

Returns new item or null if the operation fails.

Description copied from interface: addItemAt

Add new item at given index.

The indexes of the item currently in the given position and all the following items are incremented.

addListener(Container.ItemSetChangeListener)

Parameters

listener

listener to be added

Adds a Item set change listener for the list.

addListener(Container.PropertySetChangeListener)

Parameters

listener

the new Listener to be registered

Registers a new Property set change listener for this list.

addListener(Property.ValueChangeListener)

Parameters

listener

the new Listener to be registered

Registers a new value change listener for this object.

compare(Object, Object)

See Also
java.util.Comparator.compare, #sort((java.lang.Object[], boolean[])

Compare two items for sorting.

containsId(Object)

Parameters

itemId

ID the of Item to be tested for

return

true if the operation succeeded, false if not

Tests if the list contains the specified Item

firstItemId()

Parameters

return

ID of the first Item in the list

Gets the ID of the first Item in the list.

getContainerProperty(Object, Object)

Parameters

itemId

ID of the Item which contains the requested Property

propertyId

ID of the Property to retrieve

return

Property with the given ID or null

Gets the Property identified by the given Item ID and Property ID from the lsit. If the list does not contain the Property, null is returned.

getContainerPropertyIds()

Parameters

return

unmodifiable collection of Property IDs

Gets the ID's of all Properties stored in the list. The ID's are returned as a unmodifiable collection.

getIdByIndex(int)

Parameters

index

Index of the requested ID in the container.

return

ID in the given index.

Get ID with the index. The following is true for the index: 0 <= index < size().

getItem(Object)

Parameters

itemId

ID of the Item to retrieve

return

the Item with the given ID or null if the Item is not found in the list

Gets the Item with the given Item ID from the list. If the list does not contain the requested Item, null is returned.

getItemIds()

Parameters

return

unmodifiable collection of Item IDs

Gets the ID's of all Items stored in the list. The ID's are returned as a unmodifiable collection.

getSortableContainerPropertyIds()

Parameters

return

The sortable field ids.

Description copied from interface: getSortableContainerPropertyIds

Get the container property IDs, which can be used to sort the item.

getType(Object)

Parameters

id

ID of the Property

return

Type of the requested Property

Gets the type of a Property stored in the list.

indexOfId(Object)

Parameters

itemId

ID of an Item in the collection

return

Index of the Item or -1 if the Item is not in the container.

Get the index of an id. The following is true for the index: 0 <= index < size().

isFirstId(Object)

Parameters

itemId

ID of an Item in the list

return

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

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

isLastId(Object)

Parameters

itemId

ID of an Item in the list

return

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

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

lastItemId()

Parameters

return

ID of the last Item in the list

Gets the ID of the last Item in the list.

nextItemId(Object)

Parameters

itemId

ID of an Item in the list

return

ID of the next Item or null

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 list, null is returned.

prevItemId(Object)

Parameters

itemId

ID of an Item in the list

return

ID of the previous Item or null

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 list, null is returned.

removeAllItems()

Parameters

return

true if the operation succeeded, false if not

Remove all Items from the list. Note that Property ID and type information is preserved.

removeContainerProperty(Object)

Parameters

propertyId

ID of the Property to remove

return

true if the operation succeeded, false if not

Remove a Property specified by the given Property ID from the list. Note that the Property will be removed from all Items in the list.

removeItem(Object)

Parameters

itemId

ID of the Item to remove

return

true if the operation succeeded, false if not

Remove the Item corresponding to the given Item ID from the list.

removeListener(Container.ItemSetChangeListener)

Parameters

listener

listener to be removed

Removes a Item set change listener from the object.

removeListener(Container.PropertySetChangeListener)

Parameters

listener

listener to be removed

Removes a previously registered Property set change listener.

removeListener(Property.ValueChangeListener)

Parameters

listener

listener to be removed

Removes a previously registered value change listener.

size()

Parameters

return

number of Items in the list

Gets the number of Items in the list.

sort(Object[], boolean[])

Parameters

propertyId

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 getSortableContainerPropertyIds()

ascending

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.

Description copied from interface: sort

Sort method. Sort the container items.