Caplin Trader 4.0.3

Class: module:br/presenter/node/NodeList

module:br/presenter/node/NodeList

Summary

NodeList is a module:br/presenter/node/PresentationNode, that is itself a list of presentation nodes.

The NodeList class is useful when you have a list of nodes of the same type that all need to be rendered to screen. It supports the case where some or all of the nodes need to be rendered with different templates.

The contents of the NodeList class can be modified using the #updateList method, and this will cause the view to immediately update to reflect the contents of the new list. Node lists whose presentation nodes aren't all rendered with the same template can achieve this by having each of the nodes within the list implement the module:br/presenter/node/TemplateAware interface.

If fNodeClass is provided, then only instances of that class can be added to the node list; An module:br/Errors/CustomError will be thrown if this is violated.

Constructor

new module:br/presenter/node/NodeList(pPresentationNodes, fNodeClass)

Constructs a new instance of NodeList containing the given module:br/presenter/node/PresentationNode instances.
Parameters:
Name Type Description
pPresentationNodes Array The initial array 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

addChangeListener(oListener, sMethod, bNotifyImmediately)

Convenience method that allows listeners to be added for objects that do not themselves implement module:br/presenter/node/NodeListListener.

Listeners added using addChangeListener() will only be notified when module:br/presenter/node/NodeListListener#onNodeListChanged fires, and will not be notified if any of the other module:br/presenter/node/NodeListListener call-backs fire. The advantage to using this method is that objects can choose to listen to call-back events on multiple node lists.

Parameters:
Name Type Description
oListener Object The listener to be added.
sMethod String The name of the method on the listener that will be invoked each time the property changes.
bNotifyImmediately boolean (optional) Whether to invoke the listener immediately for the current value.

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.

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.

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.

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.

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.

updateList(pPresentationNodes)

Updates the node list with a new array 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
pPresentationNodes Array The new list of module:br/presenter/node/PresentationNode instances.

module:br/presenter/node/NodeList

Constructor

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

Deprecated:
  • This functionality is now provided by BladeRunnerJS, and this proxy class will be removed from CaplinTrader in a future release. Please update any references to this class in your code.
    See:

    Methods

    addChangeListener(oListener, sMethod, bNotifyImmediately)

    Convenience method that allows listeners to be added for objects that do not themselves implement module:br/presenter/node/NodeListListener.

    Listeners added using addChangeListener() will only be notified when module:br/presenter/node/NodeListListener#onNodeListChanged fires, and will not be notified if any of the other module:br/presenter/node/NodeListListener call-backs fire. The advantage to using this method is that objects can choose to listen to call-back events on multiple node lists.

    Parameters:
    Name Type Description
    oListener Object The listener to be added.
    sMethod String The name of the method on the listener that will be invoked each time the property changes.
    bNotifyImmediately boolean (optional) Whether to invoke the listener immediately for the current value.

    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.

    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.

    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.

    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.

    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.

    updateList(pPresentationNodes)

    Updates the node list with a new array 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
    pPresentationNodes Array The new list of module:br/presenter/node/PresentationNode instances.