Caplin Trader 4.7.1

Class: module:br/presenter/property/PropertyHelper

module:br/presenter/property/PropertyHelper

PropertyHelper is a utility that simplifies the attaching and removing of property listeners. Compared with adding and removing listeners on Property directly, using the equivalent PropertyHelper methods has a number of benefits:
  • It allows an observer's complete set of property listeners to be referred to using a single object reference.
  • It allows every property listener to be removed using a single operation, without affecting the listeners of other property observers.
  • It allows an observer's listeners for a single property to be removed.

Constructor

new module:br/presenter/property/PropertyHelper()

Methods

addChangeListener(oProperty, oScope, vHandler, bCallNowopt) → {module:br/presenter/property/PropertyHelper}

Adds a change listener to the supplied property. Can accept either a String method name or a function reference as the handler callback
Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/Property
oScope Object
vHandler function | String
bCallNow Boolean <optional>
Returns:
Type
module:br/presenter/property/PropertyHelper

addChangeNotification(oProperty, oScope, vHandler, bCallNowopt) → {module:br/presenter/property/PropertyHelper}

Adds a change listener to the supplied property. The function handler will be called with three arguments: the new value of the property, the previous value of the property and the property itself.

You can use this method in case you want to receive in your change handler the property's old value as well as the new one.

Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/Property
oScope Object
vHandler function | String
bCallNow Boolean <optional>
Returns:
Type
module:br/presenter/property/PropertyHelper

addUpdateListener(oProperty, oScope, vHandler, bCallNowopt) → {module:br/presenter/property/PropertyHelper}

Adds an update listener to the supplied property. Can accept either a String method name or a function reference as the handler callback
Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/Property
oScope Object
vHandler function | String
bCallNow Boolean <optional>
Returns:
Type
module:br/presenter/property/PropertyHelper

addValidationChangeListener(oProperty, oScope, vHandler, bCallNowopt)

Adds a listener for the validation state changing on the supplied editable property. Can accept either a String method name or a function reference as the handler callback. Note that as this method attaches multiple handlers, there is no return value; in order to remove listeners created by this method, use either #removeAllListeners or #clearProperty. The function used as the handler will be called with two arguments, a boolean value that shows the validation status (true for valid and false for error) and the property.
Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/EditableProperty
oScope Object
vHandler function | String
bCallNow Boolean <optional>

addValidationErrorListener(oProperty, oScope, vHandler, bCallNowopt) → {module:br/presenter/property/PropertyHelper}

Adds a listener for the validation error event to the supplied property. Can accept either a String method name or a function reference as the handler callback
Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/Property
oScope Object
vHandler function | String
bCallNow Boolean <optional>
Returns:
Type
module:br/presenter/property/PropertyHelper

addValidationSuccessListener(oProperty, oScope, vHandler, bCallNowopt) → {module:br/presenter/property/PropertyHelper}

Adds a listener for the validation success event to the supplied property. Can accept either a String method name or a function reference as the handler callback
Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/Property
oScope Object
vHandler function | String
bCallNow Boolean <optional>
Returns:
Type
module:br/presenter/property/PropertyHelper

clearProperty(oProperty, sTypeopt) → {module:br/presenter/property/PropertyHelper}

Removes any listener bound to the supplied property that was attached by this PropertyHelper
Parameters:
Name Type Attributes Description
oProperty module:br/presenter/property/Property
sType String <optional>
Returns:
Type
module:br/presenter/property/PropertyHelper

removeAllListeners()

Removes all listeners attached through this PropertyHelper

removeChangeListeners(oProperty) → {module:br/presenter/property/PropertyHelper}

Remove change handlers from the selected property that have been attached through this PropertyHelper
Parameters:
Name Type Description
oProperty module:br/presenter/property/Property
Returns:
Type
module:br/presenter/property/PropertyHelper

removeValidationSuccessListeners(oProperty) → {module:br/presenter/property/PropertyHelper}

Remove validation success handlers from the selected property that have been attached through this PropertyHelper
Parameters:
Name Type Description
oProperty module:br/presenter/property/Property
Returns:
Type
module:br/presenter/property/PropertyHelper