class sap.ui.commons.TreeNode

Control sample: sap.ui.commons.TreeNode
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/TreeNode
Application Component: CA-UI5-CTR

Tree node element


Constructor

Constructor for a new TreeNode.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.commons.TreeNode(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? object

initial settings for the new control


Properties

Name Type Default Value Description
expanded boolean true

Node is expanded

Visibility: public
hasExpander boolean false

Should the node has an expander.

Visibility: public
icon sap.ui.core.URI

Icon to display in front of the node

Visibility: public
isSelected boolean false

Node is selected

Visibility: public
selectable boolean true

The node is selectable. If true, clicking on the node text triggers "selected" event

Visibility: public
text string

Node text

Visibility: public

Aggregations

Default Aggregation: nodes

Name Cardinality Type Description
nodes (default) 0..n sap.ui.commons.TreeNode

Subnodes for the current node


Associations

Name Cardinality Type Description
ariaDescribedBy 0..n sap.ui.core.Control

Association to controls / ids which describe this control (see WAI-ARIA attribute aria-describedby).

ariaLabelledBy 0..n sap.ui.core.Control

Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).

selectedForNodes 0..n sap.ui.commons.TreeNode

When this node is collapsed and it has selected children, it looks as if it were selected itself. This association holds the references of the selected children.


Events Overview

Event Description
selected

Node is selected

toggleOpenState

Node state has changed.

selected

Node is selected

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

toggleOpenState

Node state has changed.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
opened boolean

Node has been opened if true


Methods Overview

Method Description
addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

addNode

Adds some node to the aggregation nodes.

attachSelected

Attaches event handler fnFunction to the selected event of this sap.ui.commons.TreeNode.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.TreeNode itself.

Node is selected

attachToggleOpenState

Attaches event handler fnFunction to the toggleOpenState event of this sap.ui.commons.TreeNode.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.TreeNode itself.

Node state has changed.

collapse

Collapses the node.

destroyNodes

Destroys all the nodes in the aggregation nodes.

detachSelected

Detaches event handler fnFunction from the selected event of this sap.ui.commons.TreeNode.

The passed function and listener object must match the ones used for event registration.

detachToggleOpenState

Detaches event handler fnFunction from the toggleOpenState event of this sap.ui.commons.TreeNode.

The passed function and listener object must match the ones used for event registration.

expand

Expands the node.

sap.ui.commons.TreeNode.extend

Creates a new subclass of class sap.ui.commons.TreeNode with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Element.extend.

fireSelected

Fires event selected to attached listeners.

fireToggleOpenState

Fires event toggleOpenState to attached listeners.

getAriaDescribedBy

Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getExpanded

Gets current value of property expanded.

Node is expanded

Default value is true.

getHasExpander

Gets current value of property hasExpander.

Should the node has an expander.

Default value is false.

getIcon

Gets current value of property icon.

Icon to display in front of the node

getIsSelected

Gets current value of property isSelected.

Node is selected

Default value is false.

sap.ui.commons.TreeNode.getMetadata

Returns a metadata object for class sap.ui.commons.TreeNode.

getNodes

Gets content of aggregation nodes.

Subnodes for the current node

getSelectable

Gets current value of property selectable.

The node is selectable. If true, clicking on the node text triggers "selected" event

Default value is true.

getText

Gets current value of property text.

Node text

indexOfNode

Checks for the provided sap.ui.commons.TreeNode in the aggregation nodes. and returns its index if found or -1 otherwise.

insertNode

Inserts a node into the aggregation nodes.

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllNodes

Removes all the controls from the aggregation nodes.

Additionally, it unregisters them from the hosting UIArea.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

removeNode

Removes a node from the aggregation nodes.

select

Select the node, and if any, deselects the previously selected node

setExpanded

Sets a new value for property expanded.

Node is expanded

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

setHasExpander

Sets a new value for property hasExpander.

Should the node has an expander.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

setIcon

Sets a new value for property icon.

Icon to display in front of the node

When called with a value of null or undefined, the default value of the property will be restored.

setIsSelected

Redefinition of Setter for property isSelected for validation purpose

Default value is empty/undefined

setSelectable

Redefinition of Setter for property selectable for validation purpose.

Default value is true

setText

Sets a new value for property text.

Node text

When called with a value of null or undefined, the default value of the property will be restored.

addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to add; if empty, nothing is inserted

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to add; if empty, nothing is inserted

addNode

Adds some node to the aggregation nodes.

Param Type DefaultValue Description
oNode sap.ui.commons.TreeNode

The node to add; if empty, nothing is inserted

attachSelected

Attaches event handler fnFunction to the selected event of this sap.ui.commons.TreeNode.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.TreeNode itself.

Node is selected

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.commons.TreeNode itself

attachToggleOpenState

Attaches event handler fnFunction to the toggleOpenState event of this sap.ui.commons.TreeNode.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.ui.commons.TreeNode itself.

Node state has changed.

Param Type DefaultValue Description
oData object

An application-specific payload object that will be passed to the event handler along with the event object when firing the event

fnFunction function(sap.ui.base.Event) : void

The function to be called when the event occurs

oListener object

Context object to call the event handler with. Defaults to this sap.ui.commons.TreeNode itself

collapse

Collapses the node.

Param Type DefaultValue Description
bCollapseChildren boolean

Propagates collapse to node's children

bDisableCollapseFinishedHandler boolean

Disables the collapse finished handler

destroyNodes

Destroys all the nodes in the aggregation nodes.

detachSelected

Detaches event handler fnFunction from the selected event of this sap.ui.commons.TreeNode.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

detachToggleOpenState

Detaches event handler fnFunction from the toggleOpenState event of this sap.ui.commons.TreeNode.

The passed function and listener object must match the ones used for event registration.

Param Type DefaultValue Description
fnFunction function(sap.ui.base.Event) : void

The function to be called, when the event occurs

oListener object

Context object on which the given function had to be called

expand

Expands the node.

Param Type DefaultValue Description
bExpandChildren boolean

Propagates expand to node's children

bDisableExpandFinishedHandler boolean

Disables the expand finished handler

sap.ui.commons.TreeNode.extend

Creates a new subclass of class sap.ui.commons.TreeNode with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Element.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireSelected

Fires event selected to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

fireToggleOpenState

Fires event toggleOpenState to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

opened boolean

Node has been opened if true

getAriaDescribedBy

Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.

getAriaLabelledBy

Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.

getExpanded

Gets current value of property expanded.

Node is expanded

Default value is true.

getHasExpander

Gets current value of property hasExpander.

Should the node has an expander.

Default value is false.

getIcon

Gets current value of property icon.

Icon to display in front of the node

getIsSelected

Gets current value of property isSelected.

Node is selected

Default value is false.

sap.ui.commons.TreeNode.getMetadata

Returns a metadata object for class sap.ui.commons.TreeNode.

getNodes

Gets content of aggregation nodes.

Subnodes for the current node

getSelectable

Gets current value of property selectable.

The node is selectable. If true, clicking on the node text triggers "selected" event

Default value is true.

getText

Gets current value of property text.

Node text

indexOfNode

Checks for the provided sap.ui.commons.TreeNode in the aggregation nodes. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oNode sap.ui.commons.TreeNode

The node whose index is looked for

insertNode

Inserts a node into the aggregation nodes.

Param Type DefaultValue Description
oNode sap.ui.commons.TreeNode

The node to insert; if empty, nothing is inserted

iIndex int

The 0-based index the node should be inserted at; for a negative value of iIndex, the node is inserted at position 0; for a value greater than the current size of the aggregation, the node is inserted at the last position

removeAllAriaDescribedBy

Removes all the controls in the association named ariaDescribedBy.

removeAllAriaLabelledBy

Removes all the controls in the association named ariaLabelledBy.

removeAllNodes

Removes all the controls from the aggregation nodes.

Additionally, it unregisters them from the hosting UIArea.

removeAriaDescribedBy

Removes an ariaDescribedBy from the association named ariaDescribedBy.

Param Type DefaultValue Description
vAriaDescribedBy int sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to be removed or its index or ID

removeAriaLabelledBy

Removes an ariaLabelledBy from the association named ariaLabelledBy.

Param Type DefaultValue Description
vAriaLabelledBy int sap.ui.core.ID sap.ui.core.Control

The ariaLabelledBy to be removed or its index or ID

removeNode

Removes a node from the aggregation nodes.

Param Type DefaultValue Description
vNode int string sap.ui.commons.TreeNode

The node to remove or its index or id

select

Select the node, and if any, deselects the previously selected node

Param Type DefaultValue Description
bSuppressEvent boolean

setExpanded

Sets a new value for property expanded.

Node is expanded

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Param Type DefaultValue Description
bExpanded boolean true

New value for property expanded

setHasExpander

Sets a new value for property hasExpander.

Should the node has an expander.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Param Type DefaultValue Description
bHasExpander boolean false

New value for property hasExpander

setIcon

Sets a new value for property icon.

Icon to display in front of the node

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sIcon sap.ui.core.URI

New value for property icon

setIsSelected

Redefinition of Setter for property isSelected for validation purpose

Default value is empty/undefined

Param Type DefaultValue Description
bIsSelected boolean

new value for property isSelected

setSelectable

Redefinition of Setter for property selectable for validation purpose.

Default value is true

Param Type DefaultValue Description
bSelectable boolean

new value for property selectable

setText

Sets a new value for property text.

Node text

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sText string

New value for property text