Caplin Trader 4.7.1

Class: module:br/presenter/node/MappedNodeList

module:br/presenter/node/MappedNodeList

MappedNodeList is a module:br/presenter/node/NodeList.

The MappedNodeList class is useful when you want to refer to items in a module:br/presenter/node/NodeList (which stores items in an array) using a name, rather than then ordinal position within the array. The mappings are only accessible via the PresentationNode representation of the list and not from the view i.e. can't refer to the mappings in templates.

The contents of the MappedNodeList class should only be modified using the #updateList method, and this will cause the view to immediately update to reflect the contents of the new Map.

If the optional second parameter to the constructor, fNodeClass, is provided, then the MappedNodeList will need all the nodes it is expected to contain to be instances of fNodeClass (i.e. subclasses are allowed), otherwise it throws a module:br/Errors/CustomError.

Constructor

new module:br/presenter/node/MappedNodeList(mPresentationNodes, fNodeClass)

Extends:
Parameters:
Name Type Description
mPresentationNodes Map The initial map of module:br/presenter/node/PresentationNode instances.
fNodeClass function (optional) The class/interface that all nodes in this list should be an instance of.

Extends

Methods

addListener(oListener, bNotifyImmediately)

Add a module:br/presenter/node/NodeListListener that will be notified each time the node list is updated.
Parameters:
Name Type Description
oListener module:br/presenter/node/NodeListListener The listener to be added.
bNotifyImmediately boolean Whether to invoke the listener immediately using the current node list.
Inherited From:

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.

Inherited From:

getPresentationNodesArray()

Returns the list of module:br/presenter/node/PresentationNode instances as an array.
Inherited From:

getPresentationNodesMap()

Returns the string-to-node mapping. Treat as immutable.

getTemplateForNode(oPresentationNode)

Returns the name of the template used to render the given presentation node.
Parameters:
Name Type Description
oPresentationNode module:br/presenter/node/PresentationNode The presentation node being queried.
Inherited From:

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.
Inherited From:
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.
Inherited From:
See:

removeAllListeners()

Remove all previously added module:br/presenter/node/NodeListListener instances.
Inherited From:

removeChildListeners()

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

removeListener(oListener)

Remove a previously added module:br/presenter/node/NodeListListener.
Parameters:
Name Type Description
oListener module:br/presenter/node/NodeListListener The listener being removed.
Inherited From:

updateList(mPresentationNodes)

Updates the node list with a new Map of module:br/presenter/node/PresentationNode instances.

Care must be taken to always invoke this method when the contents of the node list change. The array returned by #getPresentationNodesArray should be treated as being immutable.

Parameters:
Name Type Description
mPresentationNodes Array The new map of module:br/presenter/node/PresentationNode instances.