Class sap.ui.vk.ViewStateManagerModule: sap/ui/vk/ViewStateManager


Manages the visibility and selection states of nodes in the scene.

The objects of this class should not be created directly. They should be created with the sap.ui.vk.GraphicsCore.createViewStateManager method, and destroyed with the sap.ui.vk.GraphicsCore.destroyViewStateManager method.

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.ViewStateManager(nodeHierarchy)Constructor for a new ViewStateManager.
Event Summary
selectionChanged(oControlEvent)This event is fired when the nodes are selected/unselected.
visibilityChanged(oControlEvent)This event is fired when the visibility of the node changes.
Method Summary
sap.ui.vk.ViewStateManager.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.vk.ViewStateManager with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.vk.ViewStateManager.getMetadata()Returns a metadata object for class sap.ui.vk.ViewStateManager.
attachSelectionChanged(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the selectionChanged event of this sap.ui.vk.ViewStateManager.
attachVisibilityChanged(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the visibilityChanged event of this sap.ui.vk.ViewStateManager.
detachSelectionChanged(fnFunction, oListener)Detaches event handler fnFunction from the selectionChanged event of this sap.ui.vk.ViewStateManager.
detachVisibilityChanged(fnFunction, oListener)Detaches event handler fnFunction from the visibilityChanged event of this sap.ui.vk.ViewStateManager.
enumerateSelection(callback)Enumerates IDs of the selected nodes.
fireSelectionChanged(mArguments?)Fires event selectionChanged to attached listeners.
fireVisibilityChanged(mArguments?)Fires event visibilityChanged to attached listeners.
getNodeHierarchy()Gets the NodeHierarchy object associated with this ViewStateManager object.
getSelectionState(nodeIds)Gets the selection state of the node.
getVisibilityState(nodeIds)Gets the visibility state of nodes.
setSelectionState(nodeIds, selected, recursive)Sets the selection state of the nodes.
setVisibilityState(nodeIds, visible, recursive)Sets the visibility state of the nodes.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.vk.ViewStateManager(nodeHierarchy)
Constructor for a new ViewStateManager.

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:

  • Events
    • visibilityChanged : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    • selectionChanged : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

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

Parameters:
{sap.ui.vk.NodeHierarchy}nodeHierarchy The NodeHierarchy object.
Event Detail
selectionChanged(oControlEvent)
This event is fired when the nodes are selected/unselected.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string[]}oControlEvent.getParameters.selected IDs of newly selected nodes.
{string[]}oControlEvent.getParameters.unselected IDs of newly unselected nodes.
visibilityChanged(oControlEvent)
This event is fired when the visibility of the node changes.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string[]}oControlEvent.getParameters.visible IDs of newly shown nodes.
{string[]}oControlEvent.getParameters.hidden IDs of newly hidden nodes.
Method Detail
sap.ui.vk.ViewStateManager.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.vk.ViewStateManager 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.ManagedObject.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.ViewStateManager.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.vk.ViewStateManager.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
attachSelectionChanged(oData?, fnFunction, oListener?): sap.ui.vk.ViewStateManager
Attaches event handler fnFunction to the selectionChanged event of this sap.ui.vk.ViewStateManager.

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.vk.ViewStateManager itself.

This event is fired when the nodes are selected/unselected.

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.vk.ViewStateManager itself
Returns:
{sap.ui.vk.ViewStateManager} Reference to this in order to allow method chaining
attachVisibilityChanged(oData?, fnFunction, oListener?): sap.ui.vk.ViewStateManager
Attaches event handler fnFunction to the visibilityChanged event of this sap.ui.vk.ViewStateManager.

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.vk.ViewStateManager itself.

This event is fired when the visibility of the node changes.

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.vk.ViewStateManager itself
Returns:
{sap.ui.vk.ViewStateManager} Reference to this in order to allow method chaining
detachSelectionChanged(fnFunction, oListener): sap.ui.vk.ViewStateManager
Detaches event handler fnFunction from the selectionChanged event of this sap.ui.vk.ViewStateManager.

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.vk.ViewStateManager} Reference to this in order to allow method chaining
detachVisibilityChanged(fnFunction, oListener): sap.ui.vk.ViewStateManager
Detaches event handler fnFunction from the visibilityChanged event of this sap.ui.vk.ViewStateManager.

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.vk.ViewStateManager} Reference to this in order to allow method chaining
enumerateSelection(callback): sap.ui.vk.ViewStateManager
Enumerates IDs of the selected nodes.
Parameters:
{function}callback A function to call when the selected nodes are enumerated. The function takes one parameter of type string.
Returns:
{sap.ui.vk.ViewStateManager}this to allow method chaining.
fireSelectionChanged(mArguments?): sap.ui.vk.ViewStateManager
Fires event selectionChanged to attached listeners.

Expects the following event parameters:

  • selected of type string[]IDs of newly selected nodes.
  • unselected of type string[]IDs of newly unselected nodes.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.vk.ViewStateManager} Reference to this in order to allow method chaining
fireVisibilityChanged(mArguments?): sap.ui.vk.ViewStateManager
Fires event visibilityChanged to attached listeners.

Expects the following event parameters:

  • visible of type string[]IDs of newly shown nodes.
  • hidden of type string[]IDs of newly hidden nodes.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.ui.vk.ViewStateManager} Reference to this in order to allow method chaining
getNodeHierarchy(): sap.ui.vk.NodeHierarchy
Gets the NodeHierarchy object associated with this ViewStateManager object.
Returns:
{sap.ui.vk.NodeHierarchy} The node hierarchy associated with this ViewStateManager object.
getSelectionState(nodeIds): boolean|boolean[]
Gets the selection state of the node.

If a single node ID is passed to the method then a single selection state is returned.
If an array of node IDs is passed to the method then an array of selection states is returned.

Parameters:
{string|string[]}nodeIds The node ID or the array of node IDs.
Returns:
{boolean|boolean[]} A single value or an array of values where the value is true if the node is selected, false otherwise.
getVisibilityState(nodeIds): boolean|boolean[]
Gets the visibility state of nodes.

If a single node ID is passed to the method then a single visibility state is returned.
If an array of node IDs is passed to the method then an array of visibility states is returned.

Parameters:
{string|string[]}nodeIds The node ID or the array of node IDs.
Returns:
{boolean|boolean[]} A single value or an array of values where the value is true if the node is visible, false otherwise.
setSelectionState(nodeIds, selected, recursive): sap.ui.vk.ViewStateManager
Sets the selection state of the nodes.
Parameters:
{string|string[]}nodeIds The node ID or the array of node IDs.
{boolean}selected The new selection state of the nodes.
{boolean}recursive The flags indicates if the change needs to propagate recursively to child nodes.
Returns:
{sap.ui.vk.ViewStateManager}this to allow method chaining.
setVisibilityState(nodeIds, visible, recursive): sap.ui.vk.ViewStateManager
Sets the visibility state of the nodes.
Parameters:
{string|string[]}nodeIds The node ID or the array of node IDs.
{boolean}visible The new visibility state of the nodes.
{boolean}recursive The flags indicates if the change needs to propagate recursively to child nodes.
Returns:
{sap.ui.vk.ViewStateManager}this to allow method chaining.