Caplin Trader 4.8.0

Class: module:br/presenter/node/PresentationNode

module:br/presenter/node/PresentationNode

Base class of all complex objects (nodes) within a presentation model.

A module:br/presenter/PresentationModel is a tree of PresentationNode instances, with instances of module:br/presenter/property/Property and Function forming the leafs of the tree. Objects that do not extend PresentationNode are not considered to be part of the presentation model, and are not accessible within the view.

When a module:br/presenter/PresentationModel is created the _$setPath method is called which throws an exception if the model does not adhere to a tree structure. It also creates a "path" label on each node which identifies the node in standard object notation from the root node.

The structure is not strictly a tree because nodes are allowed to hold references back up to their direct ancestors. When any of the (recursive) search functions that find descendant nodes are called these "back links" are ignored, preventing infinite recursion.

Constructor

new module:br/presenter/node/PresentationNode()

Constructs a new instance of PresentationNode.

Methods

getPath()

Returns the path that would be required to bind this node from the view.

This method is used internally, but might also be useful in allowing the dynamic construction of views for arbitrary presentation models.

nodes(sNodeName, vProperties)

Returns all nested nodes matching the search criteria reachable from this node.

Care is taken not to search up the tree in cyclic presentation models (where some of the presentation nodes have back references to presentation nodes higher up in the tree).

Parameters:
Name Type Description
sNodeName String The name of nodes to match.
vProperties Object Only nodes having this array or map of properties will be matched.
See:

properties(sPropertyName, vValue)

Returns all nested properties matching the search criteria reachable from this node.

Care is taken not to search up the tree in cyclic presentation models (where some of the presentation nodes have back references to presentation nodes higher up in the tree).

Parameters:
Name Type Description
sPropertyName String The name of properties to match.
vValue Object The value of properties to match.
See:

removeAllListeners()

Deprecated:
  • This method has been replaced by #removeChildListeners which recurses the node tree. Removes all listeners attached to the properties contained by this PresentationNode.

    removeChildListeners()

    Removes all listeners attached to the properties contained by this PresentationNode, and any nodes it contains.