Caplin Trader 4.8.0

Class: module:caplin/trading/presenter/TradeModelPropertyFactory

module:caplin/trading/presenter/TradeModelPropertyFactory

Constructor

new module:caplin/trading/presenter/TradeModelPropertyFactory(oTradeModel)

Construct a new instance of TradeModelPropertyFactory, bound to the given module:caplin/trading/trademodel/Trade instance. Class that can be used to provide instances of module:br/presenter/property/Property or module:br/presenter/property/EditableProperty, but where the value of the property is bound to an underlying trade model object.

This class allows the trade model object that the created properties are bound to to be dynamically updated without any interruption in service.

Parameters:
Name Type Description
oTradeModel module:caplin/trading/trademodel/Trade The trade model instance that all created properties will be bound to.

Methods

destroy()

Removes all listeners, and performs any necessary clean-up when the properties created by this factory are no longer needed.

getEditableProperty(sPath)

Returns a new module:br/presenter/property/EditableProperty instance bound to the specified part of the trade model.
Parameters:
Name Type Description
sPath String the path to the property on the Trade object.

getProperty(sPath)

Returns a new module:br/presenter/property/Property instance bound to the specified part of the trade model.
Parameters:
Name Type Description
sPath String the path to the property on the Trade object

getTrade()

Returns the trade model instance that all properties created by this factory are bound to.

getTradeLegFactory(nLegIndex, FTradeModelPropertyFactoryopt)

Returns a new name-spaced instance of TradeModelPropertyFactory (or FTradeModelPropertyFactory if you pass it to the method) where the specified trade leg acts as the root element for any calls to module:caplin/trading/presenter/TradeModelPropertyFactory#getProperty and module:caplin/trading/presenter/TradeModelPropertyFactory#getEditableProperty.
Parameters:
Name Type Attributes Description
nLegIndex int The index of the leg that will become the new root object.
FTradeModelPropertyFactory function <optional>
The TradeModelPropertyFactory constructor that should be used, uses module:caplin/trading/presenter/TradeModelPropertyFactory if not provided.
Deprecated:
Returns:
a new instance of module:caplin/trading/presenter/TradeModelPropertyFactory or a new instance of FTradeModelPropertyFactory if provided.

getTradeLegFactoryById(nLegId, FTradeModelPropertyFactoryopt)

Returns a new name-spaced instance of TradeModelPropertyFactory (or FTradeModelPropertyFactory if you pass it to the method) where the specified trade leg acts as the root element for any calls to module:caplin/trading/presenter/TradeModelPropertyFactory#getProperty and module:caplin/trading/presenter/TradeModelPropertyFactory#getEditableProperty.
Parameters:
Name Type Attributes Description
nLegId int The ID of the leg that will become the new root object.
FTradeModelPropertyFactory function <optional>
The TradeModelPropertyFactory constructor that should be used, uses module:caplin/trading/presenter/TradeModelPropertyFactory if not provided.
Returns:
a new instance of module:caplin/trading/presenter/TradeModelPropertyFactory or a new instance of FTradeModelPropertyFactory if provided.

getTradeStateProperty()

Returns a new module:br/presenter/property/Property instance bound to the overall state of the trade.

setTrade(oModel)

Replaces the Trade object referenced by the TradeModelPropertyFactory and causes all pre-existing properties to also be updated so that they reference this new Trade.
Parameters:
Name Type Description
oModel module:caplin/trading/trademodel/Trade The new trade model object that all properties will now be bound to.