Class sap.ui.vk.NodeHierarchyModule: sap/ui/vk/NodeHierarchy


Provides the ability to explore a Scene object's node structure.

The objects of this class should not be created directly, and should only be created via a call to sap.ui.vk.Scene#getDefaultNodeHierarchy.

Experimental API:Since 1.32.0 This class is experimental and might be modified or removed in future versions.

Constructor Summary
new sap.ui.vk.NodeHierarchy(scene)Constructor for a new NodeHierarchy.
Method Summary
sap.ui.vk.NodeHierarchy.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.vk.NodeHierarchy with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.vk.NodeHierarchy.getMetadata()Returns a metadata object for class sap.ui.vk.NodeHierarchy.
createLayerProxy(layerId)Creates a layer proxy object.
createNodeProxy(nodeId)Creates a node proxy object.
destroyLayerProxy(layerProxy)Destroys the layer proxy object.
destroyNodeProxy(nodeProxy)Destroys the node proxy object.
enumerateAncestors(nodeId, callback, passNodeId?)Enumerates the ancestor nodes of a particular node in the Scene object.
enumerateChildren(nodeId?, callback, stepIntoClosedNodes?, passNodeId?)Enumerates the child nodes of a particular node in the Scene object.
findNodesById(query)Searches for VE IDs, and returns a list of IDs of nodes with VE IDs matching the search.
findNodesByMetadata(query)Finds nodes in a scene via metadata information.
findNodesByName(query)Finds nodes in a scene via node name.
getAncestors(nodeId)Returns a list of IDs belonging to the ancestors of a particular node.
getChildren(nodeId, stepIntoClosedNodes?)Returns a list of IDs belonging to the children of a particular node.
getGraphicsCore()Gets the GraphicsCore object this Scene object belongs to.
getLayers()Returns a list of layer IDs.
getScene()Gets the Scene object the node hierarchy belongs to.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.vk.NodeHierarchy(scene)
Constructor for a new NodeHierarchy.
Parameters:
{sap.ui.vk.Scene}scene The Scene object the node hierarchy belongs to.
Method Detail
sap.ui.vk.NodeHierarchy.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.vk.NodeHierarchy 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.base.EventProvider.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.vk.NodeHierarchy.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.vk.NodeHierarchy.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
createLayerProxy(layerId): sap.ui.vk.LayerProxy
Creates a layer proxy object.

The layer proxy object must be destroyed with the destroyLayerProxy method.

Parameters:
{string}layerId The layer ID for which to create a proxy object.
Returns:
{sap.ui.vk.LayerProxy} The proxy object.
createNodeProxy(nodeId): sap.ui.vk.NodeProxy
Creates a node proxy object.

The node proxy object must be destroyed with the destroyNodeProxy method.

Parameters:
{string}nodeId The node ID for which to create a proxy object.
Returns:
{sap.ui.vk.NodeProxy} The proxy object.
destroyLayerProxy(layerProxy): sap.ui.vk.LayerHierarchy
Destroys the layer proxy object.
Parameters:
{sap.ui.vk.LayerProxy}layerProxy The layer proxy object.
Returns:
{sap.ui.vk.LayerHierarchy}this to allow method chaining.
destroyNodeProxy(nodeProxy): sap.ui.vk.NodeHierarchy
Destroys the node proxy object.
Parameters:
{sap.ui.vk.NodeProxy}nodeProxy The node proxy object.
Returns:
{sap.ui.vk.NodeHierarchy}this to allow method chaining.
enumerateAncestors(nodeId, callback, passNodeId?): sap.ui.vk.NodeHierarchy
Enumerates the ancestor nodes of a particular node in the Scene object.

This method enumerates the ancestor nodes of a particular node, and then calls the callback function, to which it passes the ancestor nodes to one by one.
The BaseNodeProxy objects passed to callback are temporary objects, they are reset after each call to the callback function.
The ancestor nodes are enumerated starting from the top level node, and progresses down the node hierarchy.

Parameters:
{string}nodeId The ID of a node whose ancestore nodes we want enumerated.
{function}callback A function to call when the ancestor nodes are enumerated. The function takes one parameter of type sap.ui.vk.BaseNodeProxy, or string if parameter passNodeId parameter is true.
{boolean}passNodeId? Indicates whether to pass the node IDs of the ancestore nodes, or the whole node proxy to the callback function.
If true, then only the node IDs of the ancestor nodes are passed to the callback function.
If false, then the node proxies of the ancestor nodes are passed to the callback function.
Returns:
{sap.ui.vk.NodeHierarchy}this to allow method chaining.
enumerateChildren(nodeId?, callback, stepIntoClosedNodes?, passNodeId?): sap.ui.vk.NodeHierarchy
Enumerates the child nodes of a particular node in the Scene object.

This method gets the child nodes of a particular node, and then calls the callback function to which it passes the child nodes to one by one.
The BaseNodeProxy objects passed to the callback fuction are temporary objects, which are reset after each call to the callback function.

Parameters:
{string}nodeId? The ID of a node whose child nodes we want enumerated.
When nodeId is specified, the child nodes of this node are enumerated.
When no nodeId is specified, only the top level nodes are enumerated.
{function}callback A function to call when the child nodes are enumerated. The function takes one parameter of type sap.ui.vk.BaseNodeProxy, or string if parameter passNodeId parameter is true.
{boolean}stepIntoClosedNodes? Indicates whether to enumerate the child nodes if the node is closed.
If true, the children of that closed node will be enumerated
If false, the children of that node will not be enumerated
{boolean}passNodeId? Indicates whether to pass the node IDs of the child nodes, or the whole node proxy to the callback function.
If true, then only the node IDs of the child nodes are passed to the callback function.
If false, then the node proxies created from the child node IDs are passed to the callback function.
Returns:
{sap.ui.vk.NodeHierarchy}this to allow method chaining.
findNodesById(query): string[]
Searches for VE IDs, and returns a list of IDs of nodes with VE IDs matching the search. The query is run specifically against VE ID structures, which are strictly related to VDS4 models.
Parameters:
{object}query JSON object containing the search parameters.
The following example shows what the structure of the query object should look like:
query = {
	source: string (if not specified, the query returns an empty array), 
type: string (if not specified, the query returns an empty array),
fields: field[] }

  • field.name
    A string containing the name of the VE ID. If no value is specified, then the query will return an empty array.
  • field.value
    A string representing the search keyword. If no value is specified, it defaults to empty string.
    The following example shows a string being passed in:
    value: "Box #14"
  • field.predicate
    Represents a search mode. The available search modes are "equals", "contains", and "startsWith".
    Using "equals" will search for IDs with names that exactly match the provided string.
    Using "contains" will search for IDs with names containing the provided string.
    Using "startsWith" will search for IDs with names starting with the provided string.
    If no value is specified, the search mode will default to "equals".

  • field.caseSensitive
    Indicates whether the search should be case sensitive or not.
    If true, the search will be case sensitive, and false indicates otherwise.
    If no value is specified, caseSensitive will default to false (that is, the search will be a case-insensitive search).
Returns:
{string[]} A list of IDs belonging to nodes that matched the VE IDs search criteria.
findNodesByMetadata(query): string[]
Finds nodes in a scene via metadata information.
Parameters:
{object}query JSON object containing the search parameters.
The following example shows what the structure of the query object should look like:
query = {
		category: string,
		key: string,
		value: string | string[],
		predicate: "equals" | "contains" | "startsWith",
		caseSensitive: true | false
	}

NOTE: query.predicate and query.caseSensitive refer to query.value.
  • query.category
    A string indicating the name of the metadata category.
    If no value is specified for query.category, all nodes in the scene will be returned in the search.

  • query.key
    A string indicating the key which belongs to the metadata category specified in query.category. You can only use query.key if query.category has been specified.
    If no value is specified for query.key, then all nodes grouped under the specified category will be returned in the search.

  • query.value
    A string or an array of strings containing the value or values associated with query.key. You can only use query.value in the search if query.key has been specified.
    If no value is specified for query.value, then all nodes containing the specified key will be returned, regardless of what the value of the key is.
    The following example shows a single string being passed in:
    value: "Box #14"
    The following example shows an array of strings being passed in:
    value: ["Box #3", "box #4", "BOX #5"]
  • query.predicate
    Represents a search mode. The available search modes are "equals", "contains", and "startsWith".
    Using "equals" will search for key values that exactly match the provided string or array of strings.
    Using "contains" will search for key values containing all or part of the provided string or array of strings.
    Using "startsWith" will search key values starting with the provided string or array of strings.
    If no value is specified, the search mode will default to "equals".

  • query.caseSensitive
    Indicates whether the search should be case sensitive or not.
    If true, the search will be case sensitive, and false indicates otherwise.
    If no value is specified, caseSensitive will default to false (that is, the search will be a case-insensitive search).
Returns:
{string[]} A list of IDs belonging to nodes that matched the search criteria.
findNodesByName(query): string[]
Finds nodes in a scene via node name.
Parameters:
{object}query JSON object containing the search parameters.
The following example shows what the structure of the query object should look like:
query = {
	value: string | string[],
	predicate: "equals" | "contains" | "startsWith",
	caseSensitive: true | false
}

  • query.value
    A string or an array of strings containing the name of a node or names of nodes. If no value is specified, then all nodes in the scene will be returned.
    The following example shows a single string being passed in:
    value: "Box #14"
    The following example shows an array of strings being passed in:
    value: ["Box #3", "box #4", "BOX #5"]
  • query.predicate
    Represents a search mode. The available search modes are "equals", "contains", and "startsWith".
    Using "equals" will search for nodes with names that exactly match the provided string or array of strings.
    Using "contains" will search for nodes with names containing all or part of the provided string or array of strings.
    Using "startsWith" will search for nodes with names starting with the provided string or array of strings.
    If no value is specified, the search mode will default to "equals".

  • query.caseSensitive
    Indicates whether the search should be case sensitive or not.
    If true, the search will be case sensitive, and false indicates otherwise.
    If no value is specified, caseSensitive will default to false (that is, the search will be a case-insensitive search).
Returns:
{string[]} A list of IDs belonging to nodes that matched the search criteria.
getAncestors(nodeId): array
Returns a list of IDs belonging to the ancestors of a particular node.
Parameters:
{string}nodeId The node ID of the node whose ancestors will be returned.
Returns:
{array} A list of IDs belonging to the ancestors of nodeId.
getChildren(nodeId, stepIntoClosedNodes?): array
Returns a list of IDs belonging to the children of a particular node.
Parameters:
{string}nodeId The node ID of the node whose children will be returned. If nodeId is not passed to the getChildren function, the IDs of the root nodes will be returned.
{boolean}stepIntoClosedNodes? Indicates whether to return only the child nodes of a closed node or not. If true, then the children of that closed node will be returned. If false, then the children of that closed node will not be returned.
Returns:
{array} A list of IDs belonging to the children of nodeId.
getGraphicsCore(): sap.ui.vk.GraphicsCore
Gets the GraphicsCore object this Scene object belongs to.
Returns:
{sap.ui.vk.GraphicsCore} The GraphicsCore object this Scene object belongs to.
getLayers(): string[]
Returns a list of layer IDs.
Returns:
{string[]} A list of layer IDs.
getScene(): sap.ui.vk.Scene
Gets the Scene object the node hierarchy belongs to.
Returns:
{sap.ui.vk.Scene} The Scene object the node hierarchy belongs to.