Caplin Trader 5.1.0

Class: module:br-presenter/property/Properties

module:br-presenter/property/Properties(pProperties)

A class used to hold collections of properties, and providing utility methods for performing operations over those collections.

Constructor

new module:br-presenter/property/Properties(pProperties)

Constructs a new Properties instance containing the given list of module:br-presenter/property/Property objects.

Parameters:
Name Type Description
pProperties Array

(optional) The initial set of properties.

Methods

add(vProperties)

Add the given properties to this collection.

The single argument passed to add() can be any of the following types:

Parameters:
Name Type Description
vProperties Object

The new properties to add.

addChangeListener(fCallback, bNotifyImmediately)

Convenience method that allows a change listener to be added to added for objects that do not themselves implement module:br-presenter/property/PropertyListener.

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

Parameters:
Name Type Description
fCallback function

The call-back that will be invoked each time the property changes.

bNotifyImmediately boolean

(optional) Whether to invoke the listener immediately for the current value.

addListener()

Add a listener to all properties

addUpdateListener(fCallback, bNotifyImmediately)

Convenience method that allows an update listener to be added to added for objects that do not themselves implement module:br-presenter/property/PropertyListener.

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

Parameters:
Name Type Description
fCallback function

The call-back that will be invoked each time the property is updated.

bNotifyImmediately boolean

(optional) Whether to invoke the listener immediately for the current value.

getProperties()

Returns array of properties in the collection.

getSize()

Returns the size of the collection.

removeAllListeners()

Removes all the listeners attached to the properties.

setValue(vValue)

Invoke setValue() on all writable properties within the collection.

Parameters:
Name Type Description
vValue Object

The value that all property instances will be set to.

snapshot()

Returns a snapshot of the current collection that can be restored at a later date.