Class Tree

MenuTree component. MenuTree can be used to select an item (or multiple items) from a hierarchical set of items.

Tree()

Create new empty tree

Tree(String)

Create new empty tree with caption.

Tree(String, Container)

Create new tree with caption and connect it to a Container.

addActionHandler(Action.Handler)

Adds an action handler.

addListener(Tree.CollapseListener)

Parameters

listener

Listener to be added.

Add collapse listener

addListener(Tree.ExpandListener)

Parameters

listener

Listener to be added.

Add expand listener

areChildrenAllowed(Object)

Parameters

itemId

ID of the Item in the container whose child capability is to be tested

return

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.

Description copied from interface: areChildrenAllowed

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.

changeVariables(Object, Map)

collapseItem(Object)

Parameters

return

True iff the collapse operation succeeded

Collapse an item.

collapseItemsRecursively(Object)

Parameters

return

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.

expandItem(Object)

Parameters

return

True iff the expand operation succeeded

Expand an item.

expandItemsRecursively(Object)

Parameters

return

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.

focus()

Exceptions

UnsupportedOperationException

if invoked.

See Also
focus()

Focusing to this component is not supported.

getChildren(Object)

Parameters

itemId

ID of the Item whose children the caller is interested in

return

An unmodifiable collection containing the IDs of all other Items that are children in the container hierarchy

Description copied from interface: getChildren

Gets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.

getParent(Object)

Parameters

itemId

ID of the Item whose parent the caller wishes to find out.

return

the ID of the parent Item. Will be null if the specified Item is a root element.

Description copied from interface: getParent

Gets the ID of the parent Item of the specified Item.

getTag()

See Also
getTag()

getVisibleItemIds()

hasChildren(Object)

Parameters

itemId

ID of the Item whose leaf status is to be tested

return

true if the specified Item is a leaf, false if not

Description copied from interface: hasChildren

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.

.

isExpanded(Object)

Parameters

return

true iff the item is expanded

Check is an item is expanded

isRoot(Object)

Parameters

itemId

ID of the Item whose root status is to be tested

return

true if the specified Item is a root, false if not

Description copied from interface: isRoot

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.

isSelectable()

Parameters

return

Value of property selectable.

Getter for property selectable.

The tree is selectable by default.

removeActionHandler(Action.Handler)

Removes an action handler.

removeListener(Tree.CollapseListener)

Parameters

listener

Listener to be removed.

Remove collapse listener

removeListener(Tree.ExpandListener)

Parameters

listener

Listener to be removed.

Remove expand listener

rootItemIds()

Parameters

return

An unmodifiable collection containing IDs of all root elements of the container

See Also
rootItemIds()
Description copied from interface: 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.

setChildrenAllowed(Object, boolean)

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

return

true if the operation succeeded, false if not

Description copied from interface: setChildrenAllowed

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 .

setContainerDataSource(Container)

setLazyLoading(boolean)

Tree does not support lazy options loading mode. Setting this true will throw UnsupportedOperationException.

setNewItemsAllowed(boolean)

Exceptions

UnsupportedOperationException

if set to true.

Adding new items is not supported.

setParent(Object, 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

return

true if the operation succeeded, false if not

Description copied from interface: setParent

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.

setSelectable(boolean)

Parameters

selectable

New value of property selectable.

Setter for property selectable.

The tree is selectable by default.