A wrapper class for adding external hierarchy to containers not
implementing the
com.itmill.toolkit.data.Container.Hierarchical
interface.
If the wrapped container is changed directly (that is, not through
the wrapper), the hierarchy information must be updated with the
updateHierarchicalWrapper()
method.
3.0
Inheritance Path. java.lang.Object-> com.itmill.toolkit.data.util.ContainerHierarchicalWrapper
Parameters
toBeWrapped
the container that needs to be accessed hierarchically
Constructs a new hierarchical wrapper for an existing Container. Works even if the to-be-wrapped container already implements the Container.Hierarchical interface.
Parameters
propertyId
ID of the new Property
type
Data type of the new Property
defaultValue
The value all created Properties are initialized to
true
if the operation succeeded,
false
if not
Adds a new Property to all Items in the Container.
Parameters
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 hierarchy.
Parameters
the added Item or
null
if the operation failed
Adds a new Item by its ID to the underlying container and to the hierarchy.
Parameters
listener
listener to be added
Adds a Item set change listener for the object.
Parameters
listener
The new Listener to be registered
Registers a new Property set change listener for this Container.
Parameters
itemId
ID of the Item in the container whose child capability is to be tested
true
if the specified Item exists in the
Container and it can have children,
false
if
it's not found from the container or it can't have children.
Tests if the Item with given ID can have any children. If the
Container also implements the
Managed
interface, the
items created with
newItem
can have children by
default.
Parameters
itemId
ID of the Item whose children the caller is interested in
An unmodifiable collection containing the IDs of all other Items that are children in the container hierarchy
Gets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.
Parameters
itemId
ID of the Item whose parent the caller wishes to find out.
the ID of the parent Item. Will be
null
if the
specified Item is a root element.
Gets the ID of the parent Item of the specified Item.
Parameters
itemId
ID of the Item whose leaf status is to be tested
true
if the specified Item is a leaf,
false
if not
Tests if the Item specified with
itemId
has any child
Items, that is, is it a leaf Item. The
getChildren(java.lang.Object)
method always returns
null
for leaf Items.
Note that being a leaf does not imply whether or not an Item is allowed to have children.
.
Parameters
itemId
ID of the Item whose root status is to be tested
true
if the specified Item is a root,
false
if not
Tests if the Item specified with
itemId
is a root
Item. The hierarchical container can have more than one root and must
have at least one unless it is empty. The
getParent(java.lang.Object)
method always returns
null
for root Items.
Parameters
true
if the operation succeeded,
false
if not
Removes all items from the underlying container and from the hierarcy.
Parameters
propertyId
ID of the Property to remove
true
if the operation succeeded,
false
if not
Removes the specified Property from the underlying container and from the hierarchy. Note that the Property will be removed from all Items in the Container.
Parameters
true
if the operation succeeded,
false
if not
Removes an Item specified by
itemId
from the underlying
container and from the hierarcy.
Parameters
listener
listener to be removed
Removes a Item set change listener from the object.
Parameters
listener
Listener to be removed
Removes a previously registered Property set change listener.
Parameters
An unmodifiable collection containing IDs of all root elements of the container
Gets the IDs of all Items in the container that don't have a parent.
Such items are called
root
Items. The returned
collection is unmodifiable.
Parameters
itemId
ID of the Item in the container whose child capability is to be set
childrenAllowed
boolean value specifying if the Item can have children or not
true
if the operation succeeded,
false
if not
Sets the given Item's capability to have children. If the Item
identified with
itemId
already has children and
areChildrenAllowed
is false this method fails and
false
is returned; the children must be first explicitly
removed with
setParent(java.lang.Object, java.lang.Object)
or
removeItem(java.lang.Object)
.
Parameters
itemId
ID of the item to be set as the child of the Item
identified with
newParentId
newParentId
ID of the Item that's to be the new parent
of the Item identified with
itemId
true
if the operation succeeded,
false
if not
Sets the parent of an Item. The new parent item must exist and be
able to have children.
(
canHaveChildren(newParentId) == true
). It is also
possible to detach a node from the hierarchy (and thus make it root)
by setting the parent
null
.