MappedNodeList
is a caplin.presenter.node.NodeList.
The MappedNodeList
class is useful when you want to refer to items in
a caplin.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 caplin.core.Error.
Attributes | Name and Description |
---|---|
|
caplin.presenter.node.MappedNodeList(Map mPresentationNodes, Function fNodeClass)
Constructs a new instance of |
Attributes | Name and Description |
---|---|
|
Object
getPresentationNodesMap()
Returns the string-to-node mapping. |
|
void
updateList(Array mPresentationNodes)
Updates the node list with a new Map of caplin.presenter.node.PresentationNode instances. |
►
caplin.presenter.node.MappedNodeList(Map mPresentationNodes, Function fNodeClass)
Constructs a new instance of MappedNodeList
.
Map | mPresentationNodes | The initial map of caplin.presenter.node.PresentationNode instances. |
Function | fNodeClass | (optional) The class/interface that all nodes in this list should be an instance of. |
►
Object
getPresentationNodesMap()
Returns the string-to-node mapping. Treat as immutable.
►
void
updateList(Array mPresentationNodes)
Updates the node list with a new Map of caplin.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.
Array | mPresentationNodes | The new map of caplin.presenter.node.PresentationNode instances. |