Class IContainer
source code
object --+
|
IContainer
- Known Subclasses:
-
- ui.abstract_select.AbstractSelect
- , IHierarchical
- , IOrdered
- , IFilterable
- , ISimpleFilterable
- , util.abstract_container.AbstractContainer
- , util.hierarchical_container.HierarchicalContainer
- , util.abstract_container.BaseItemSetChangeEvent
- , util.abstract_container.BasePropertySetChangeEvent
- , util.container_hierarchical_wrapper.ContainerHierarchicalWrapper
- , util.container_hierarchical_wrapper.PiggybackListener
A specialized set of identified Items. Basically the IContainer is a
set of Item
s, but it imposes certain
constraints on its contents. These constraints state the following:
-
All Items in the IContainer must have the same number of Properties.
-
All Items in the IContainer must have the same Property ID's (see
Item.getItemPropertyIds
).
-
All Properties in the Items corresponding to the same Property ID
must have the same data type.
-
All Items within a container are uniquely identified by their
non-null IDs.
The IContainer can be visualized as a representation of a relational
database table. Each Item in the IContainer represents a row in the
table, and all cells in a column (identified by a Property ID) have the
same data type. Note that as with the cells in a database table, no
Property in a IContainer may be empty, though they may contain
None
values.
Note that though uniquely identified, the Items in a IContainer are
not necessarily IOrdered or IIndexed
indexed
.
Containers can derive Item ID's from the item properties or use other,
container specific or user specified identifiers.
If a container is filtered or sorted, most of the the methods of the container
interface and its subinterfaces (container size, containsId, iteration and indices etc.) relate to the
filtered and sorted view, not to the full container contents. See
individual method doc-strings for exceptions to this (adding and removing
items).
The IContainer interface is split to several subinterfaces so that a
class can implement only the ones it needs.
Author:
Vaadin Ltd.
Version:
1.1.2
|
getItem(self,
itemId)
Gets the Item with the given Item ID from
the IContainer. |
source code
|
|
|
|
|
getItemIds(self)
Gets the ID's of all visible (after filtering and sorting) Items
stored in the IContainer. |
source code
|
|
|
|
|
getType(self,
propertyId)
Gets the data type of all Properties identified by the given Property
ID. |
source code
|
|
|
|
|
|
|
addItem(self,
itemId=None)
Creates a new Item with the given ID in the IContainer. |
source code
|
|
|
|
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__init__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|
Inherited from object :
__class__
|
Gets the Item with the given Item ID from
the IContainer. If the IContainer does not contain the requested Item,
None is returned.
Containers should not return Items that are filtered out.
- Parameters:
itemId - ID of the Item to retrieve
- Returns:
- the
Item with the given ID or
None if the Item is not found in the IContainer
|
Gets the ID's of all Properties stored in the IContainer. The ID's
cannot be modified through the returned collection.
- Returns:
- unmodifiable collection of Property IDs
|
Gets the ID's of all visible (after filtering and sorting) Items
stored in the IContainer. The ID's cannot be modified through the
returned collection.
If the container is IOrdered, the collection returned by this method should
follow that order. If the container is ISortable, the items should be in the sorted order.
Calling this method for large lazy containers can be an expensive
operation and should be avoided when practical.
- Returns:
- unmodifiable collection of Item IDs
|
getContainerProperty(self,
itemId,
propertyId)
| source code
|
Gets the Property identified by the given itemId and propertyId from
the IContainer. If the IContainer does not contain the item or it is
filtered out, or the IContainer does not have the Property,
None is returned.
- Parameters:
itemId - ID of the visible Item which contains the Property
propertyId - ID of the Property to retrieve
- Returns:
- Property with the given ID or
None
|
Gets the data type of all Properties identified by the given Property
ID.
- Parameters:
propertyId - ID identifying the Properties
- Returns:
- data type of the Properties
|
Gets the number of visible Items in the IContainer.
Filtering can hide items so that they will not be visible through the
container API.
- Returns:
- number of Items in the IContainer
|
Tests if the IContainer contains the specified Item.
Filtering can hide items so that they will not be visible through the
container API, and this method should respect visibility of items (i.e.
only indicate visible items as being in the container) if feasible for
the container.
- Parameters:
itemId - ID the of Item to be tested
- Returns:
- boolean indicating if the IContainer holds the specified Item
|
Creates a new Item with the given ID in the IContainer. Creates a new
Item into the IContainer, and assign it an automatic ID if itemId is
None .
The new Item is returned, and it is ready to have its Properties
modified. Returns None if the operation fails or the
IContainer already contains a Item with the given ID.
- Parameters:
itemId - ID of the Item to be created
- Returns:
- Created new Item, or
None in case of a failure
- Raises:
NotImplementedError - if adding an item with an explicit item ID is not supported by the
container
|
Removes the Item identified by ItemId from the
IContainer.
Containers that support filtering should also allow removing an item
that is currently filtered out.
This functionality is optional.
- Parameters:
itemId - ID of the Item to remove
- Returns:
True if the operation succeeded, False
if not
- Raises:
NotImplementedError - if the container does not support removing individual items
|
addContainerProperty(self,
propertyId,
typ,
defaultValue)
| source code
|
Adds a new Property to all Items in the IContainer. The Property ID,
data type and default value of the new Property are given as
parameters.
This functionality is optional.
- Parameters:
propertyId - ID of the Property
typ - Data type of the new Property
defaultValue - The value all created Properties are initialized to
- Returns:
True if the operation succeeded, False
if not
- Raises:
NotImplementedError - if the container does not support explicitly adding container
properties
|
Removes a Property specified by the given Property ID from the
IContainer. Note that the Property will be removed from all Items in the
IContainer.
This functionality is optional.
- Parameters:
propertyId - ID of the Property to remove
- Returns:
True if the operation succeeded, False
if not
- Raises:
NotImplementedError - if the container does not support removing container properties
|
Removes all Items from the IContainer.
Note that Property ID and type information is preserved. This
functionality is optional.
- Returns:
True if the operation succeeded, False
if not
- Raises:
NotImplementedError - if the container does not support removing all items
|