MenuTree component. MenuTree can be used to select an item (or multiple items) from a hierarchical set of items.
3.0
Inheritance Path. java.lang.Object-> com.itmill.toolkit.ui.AbstractComponent -> com.itmill.toolkit.ui.AbstractField -> com.itmill.toolkit.ui.Select -> com.itmill.toolkit.ui.Tree
Adds an action handler.
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.
areChildrenAllowed(java.lang.Object)
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
True iff the collapse operation succeeded
Collapse items recursively Collapse all the children recursively starting from an item. Operation succeeds only if all expandable items are collapsed.
Parameters
True iff the expand operation succeeded
Expand items recursively Expands all the children recursively starting from an item. Operation succeeds only if all expandable items are expanded.
Exceptions
UnsupportedOperationException
if invoked.
focus()
Focusing to this component is not supported.
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
getChildren(java.lang.Object)
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.
getParent(java.lang.Object)
Gets the ID of the parent Item of the specified Item.
getTag()
getVisibleItemIds()
Parameters
itemId
ID of the Item whose leaf status is to be tested
true
if the specified Item is a leaf,
false
if not
hasChildren(java.lang.Object)
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
isRoot(java.lang.Object)
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
Value of property selectable.
Getter for property selectable.
The tree is selectable by default.
Removes an action handler.
Parameters
listener
Listener to be removed.
Remove collapse listener
Parameters
listener
Listener to be removed.
Remove expand listener
Parameters
An unmodifiable collection containing IDs of all root elements of the container
rootItemIds()
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
areChildrenAllowed
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)
.
This operation is optional. If it is not implemented, the method
always returns
false
.
Tree does not support lazy options loading mode. Setting this true will throw UnsupportedOperationException.
Exceptions
UnsupportedOperationException
if set to true.
setNewItemsAllowed(boolean)
Adding new items is not supported.
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
.
This operation is optional.