Class sap.ui.commons.TreeNodeModule: sap/ui/commons/TreeNode

extends Element

Tree node element

Deprecated API:Since version 1.38.

Constructor Summary
new sap.ui.commons.TreeNode(sId?, mSettings?)Constructor for a new TreeNode.
Event Summary
selected(oControlEvent)Node is selected
toggleOpenState(oControlEvent)Node state has changed.
Method Summary
sap.ui.commons.TreeNode.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.TreeNode with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.TreeNode.getMetadata()Returns a metadata object for class sap.ui.commons.TreeNode.
addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy.
addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy.
addNode(oNode)Adds some node to the aggregation nodes.
attachSelected(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the selected event of this sap.ui.commons.TreeNode.
attachToggleOpenState(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the toggleOpenState event of this sap.ui.commons.TreeNode.
collapse(bCollapseChildren, bDisableCollapseFinishedHandler)Collapses the node.
destroyNodes()Destroys all the nodes in the aggregation nodes.
detachSelected(fnFunction, oListener)Detaches event handler fnFunction from the selected event of this sap.ui.commons.TreeNode.
detachToggleOpenState(fnFunction, oListener)Detaches event handler fnFunction from the toggleOpenState event of this sap.ui.commons.TreeNode.
expand(bExpandChildren, bDisableExpandFinishedHandler)Expands the node.
fireSelected(mArguments?)Fires event selected to attached listeners.
fireToggleOpenState(mArguments?)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.
getHasExpander()Gets current value of property hasExpander.
getIcon()Gets current value of property icon.
getIsSelected()Gets current value of property isSelected.
getNodes()Gets content of aggregation nodes.
getSelectable()Gets current value of property selectable.
getText()Gets current value of property text.
indexOfNode(oNode)Checks for the provided sap.ui.commons.TreeNode in the aggregation nodes.
insertNode(oNode, iIndex)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.
removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy.
removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy.
removeNode(vNode)Removes a node from the aggregation nodes.
select(bSuppressEvent, bDeselectOtherNodes)Select the node, and if any, deselects the previously selected node
setExpanded(bExpanded)Sets a new value for property expanded.
setHasExpander(bHasExpander)Sets a new value for property hasExpander.
setIcon(sIcon)Sets a new value for property icon.
setIsSelected(bIsSelected)Redefinition of Setter for property isSelected for validation purpose

Default value is empty/undefined

setSelectable(bSelectable)Redefinition of Setter for property selectable for validation purpose.
setText(sText)Sets a new value for property text.
Constructor Detail
new sap.ui.commons.TreeNode(sId?, mSettings?)
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 for a general description of the syntax of the settings object.

The supported settings are:

  • Properties
  • Aggregations
    • nodes : sap.ui.commons.TreeNode[] (default)
  • Events
    • toggleOpenState : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • selected : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.ui.core.Element can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Deprecated:
Since version 1.38.
Event Detail
selected(oControlEvent)
Node is selected
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
toggleOpenState(oControlEvent)
Node state has changed.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{boolean}oControlEvent.getParameters.opened Node has been opened if true
Method Detail
sap.ui.commons.TreeNode.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.commons.TreeNode.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.TreeNode.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.TreeNode
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
{string|sap.ui.core.Control}vAriaDescribedBy the ariaDescribedBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.TreeNode
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
{string|sap.ui.core.Control}vAriaLabelledBy the ariaLabelledBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
addNode(oNode): sap.ui.commons.TreeNode
Adds some node to the aggregation nodes.
Parameters:
{sap.ui.commons.TreeNode}oNode the node to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
attachSelected(oData?, fnFunction, oListener?): sap.ui.commons.TreeNode
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

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.commons.TreeNode itself
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
attachToggleOpenState(oData?, fnFunction, oListener?): sap.ui.commons.TreeNode
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.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.commons.TreeNode itself
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
collapse(bCollapseChildren, bDisableCollapseFinishedHandler)
Collapses the node.
Parameters:
{boolean}bCollapseChildren Propagates collapse to node's children
{boolean}bDisableCollapseFinishedHandler Disables the collapse finished handler
destroyNodes(): sap.ui.commons.TreeNode
Destroys all the nodes in the aggregation nodes.
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
detachSelected(fnFunction, oListener): sap.ui.commons.TreeNode
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.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
detachToggleOpenState(fnFunction, oListener): sap.ui.commons.TreeNode
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.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
expand(bExpandChildren, bDisableExpandFinishedHandler)
Expands the node.
Parameters:
{boolean}bExpandChildren Propagates expand to node's children
{boolean}bDisableExpandFinishedHandler Disables the expand finished handler
fireSelected(mArguments?): sap.ui.commons.TreeNode
Fires event selected to attached listeners.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
fireToggleOpenState(mArguments?): sap.ui.commons.TreeNode
Fires event toggleOpenState to attached listeners.

Expects the following event parameters:

  • opened of type booleanNode has been opened if true
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
getAriaDescribedBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
{sap.ui.core.Control[]}
getAriaLabelledBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
{sap.ui.core.Control[]}
getExpanded(): boolean
Gets current value of property expanded.

Node is expanded

Default value is true.

Returns:
{boolean} Value of property expanded
getHasExpander(): boolean
Gets current value of property hasExpander.

Should the node has an expander.

Default value is false.

Returns:
{boolean} Value of property hasExpander
getIcon(): sap.ui.core.URI
Gets current value of property icon.

Icon to display in front of the node

Returns:
{sap.ui.core.URI} Value of property icon
getIsSelected(): boolean
Gets current value of property isSelected.

Node is selected

Default value is false.

Returns:
{boolean} Value of property isSelected
Gets content of aggregation nodes.

Subnodes for the current node

Returns:
{sap.ui.commons.TreeNode[]}
getSelectable(): boolean
Gets current value of property selectable.

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

Default value is true.

Returns:
{boolean} Value of property selectable
getText(): string
Gets current value of property text.

Node text

Returns:
{string} Value of property text
indexOfNode(oNode): int
Checks for the provided sap.ui.commons.TreeNode in the aggregation nodes. and returns its index if found or -1 otherwise.
Parameters:
{sap.ui.commons.TreeNode}oNode The node whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertNode(oNode, iIndex): sap.ui.commons.TreeNode
Inserts a node into the aggregation nodes.
Parameters:
{sap.ui.commons.TreeNode}oNode the node to insert; if empty, nothing is inserted
{int}iIndex 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
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
removeAllAriaDescribedBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAllNodes(): sap.ui.commons.TreeNode[]
Removes all the controls from the aggregation nodes.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.ui.commons.TreeNode[]} An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.Control
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaDescribedBy The ariaDescribedByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.Control
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaLabelledBy The ariaLabelledByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaLabelledBy or null
removeNode(vNode): sap.ui.commons.TreeNode
Removes a node from the aggregation nodes.
Parameters:
{int|string|sap.ui.commons.TreeNode}vNode The nodeto remove or its index or id
Returns:
{sap.ui.commons.TreeNode} The removed node or null
select(bSuppressEvent, bDeselectOtherNodes)
Select the node, and if any, deselects the previously selected node
Parameters:
{boolean}bSuppressEvent
{boolean}bDeselectOtherNodes
setExpanded(bExpanded): sap.ui.commons.TreeNode
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.

Parameters:
{boolean}bExpanded New value for property expanded
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
setHasExpander(bHasExpander): sap.ui.commons.TreeNode
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.

Parameters:
{boolean}bHasExpander New value for property hasExpander
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
setIcon(sIcon): sap.ui.commons.TreeNode
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.

Parameters:
{sap.ui.core.URI}sIcon New value for property icon
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining
setIsSelected(bIsSelected): sap.ui.commons.TreeNode
Redefinition of Setter for property isSelected for validation purpose

Default value is empty/undefined

Parameters:
{boolean}bIsSelected new value for property isSelected
Returns:
{sap.ui.commons.TreeNode}this to allow method chaining
setSelectable(bSelectable): sap.ui.commons.TreeNode
Redefinition of Setter for property selectable for validation purpose.

Default value is true

Parameters:
{boolean}bSelectable new value for property selectable
Returns:
{sap.ui.commons.TreeNode}this to allow method chaining
setText(sText): sap.ui.commons.TreeNode
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.

Parameters:
{string}sText New value for property text
Returns:
{sap.ui.commons.TreeNode} Reference to this in order to allow method chaining