Tree node element
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 |
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 |
Default Aggregation: nodes
Name | Cardinality | Type | Description |
---|---|---|---|
nodes (default) | 0..n | sap.ui.commons.TreeNode |
Subnodes for the current node |
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. |
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 When called, the context of the event handler (its Node is selected |
attachToggleOpenState |
Attaches event handler When called, the context of the event handler (its Node state has changed. |
collapse |
Collapses the node. |
destroyNodes |
Destroys all the nodes in the aggregation nodes. |
detachSelected |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
detachToggleOpenState |
Detaches event handler 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
|
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 |
getHasExpander |
Gets current value of property hasExpander. Should the node has an expander. Default value is |
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 |
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 |
getText |
Gets current value of property text. Node text |
indexOfNode |
Checks for the provided |
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 Default value is |
setHasExpander |
Sets a new value for property hasExpander. Should the node has an expander. When called with a value of Default value is |
setIcon |
Sets a new value for property icon. Icon to display in front of the node When called with a value of |
setIsSelected |
Redefinition of Setter for property Default value is empty/ |
setSelectable |
Redefinition of Setter for property Default value is |
setText |
Sets a new value for property text. Node text When called with a value of |
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 |
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 |
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 |
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 |
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 |
Collapses the node.
Param | Type | DefaultValue | Description |
---|---|---|---|
bCollapseChildren | boolean |
Propagates collapse to node's children |
|
bDisableCollapseFinishedHandler | boolean |
Disables the collapse finished handler |
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 |
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 |
Expands the node.
Param | Type | DefaultValue | Description |
---|---|---|---|
bExpandChildren | boolean |
Propagates expand to node's children |
|
bDisableExpandFinishedHandler | boolean |
Disables the expand finished handler |
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 |
Fires event selected to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
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 |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Gets current value of property hasExpander.
Should the node has an expander.
Default value is false
.
Gets current value of property selectable.
The node is selectable. If true, clicking on the node text triggers "selected" event
Default value is true
.
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 |
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 |
Removes all the controls from the aggregation nodes.
Additionally, it unregisters them from the hosting UIArea.
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 |
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 |
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 the node, and if any, deselects the previously selected node
Param | Type | DefaultValue | Description |
---|---|---|---|
bSuppressEvent | boolean |
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 |
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 |
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 |
Redefinition of Setter for property isSelected
for validation purpose
Default value is empty/undefined
Param | Type | DefaultValue | Description |
---|---|---|---|
bIsSelected | boolean |
new value for property |
Redefinition of Setter for property selectable
for validation purpose.
Default value is true
Param | Type | DefaultValue | Description |
---|---|---|---|
bSelectable | boolean |
new value for property |
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 |