Class
caplin.trading.presenter

TradeModelPropertyFactory

Class that can be used to provide instances of caplin.presenter.property.Property or caplin.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.

Constructor Summary

Attributes Name and Description
caplin.trading.presenter.TradeModelPropertyFactory(caplin.trading.trademodel.Trade oTradeModel)

Construct a new instance of TradeModelPropertyFactory, bound to the given caplin.trading.trademodel.Trade instance.

Method Summary

Attributes Name and Description
void destroy()

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

caplin.presenter.property.EditableProperty getEditableProperty(String sPath)

Returns a new caplin.presenter.property.EditableProperty instance bound to the specified part of the trade model.

caplin.presenter.property.Property getProperty(String sPath)

Returns a new caplin.presenter.property.Property instance bound to the specified part of the trade model.

caplin.trading.trademodel.Trade getTrade()

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

Object getTradeLegFactory(int nLegIndex, Function fTradeModelPropertyFactory)

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 #getProperty and #getEditableProperty.

Object getTradeLegFactoryById(int nLegId, Function fTradeModelPropertyFactory)

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 #getProperty and #getEditableProperty.

caplin.presenter.property.Property getTradeStateProperty()

Returns a new caplin.presenter.property.Property instance bound to the overall state of the trade.

void setTrade(caplin.trading.trademodel.Trade 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.

Constructor Detail

caplin.trading.presenter.TradeModelPropertyFactory(caplin.trading.trademodel.Trade oTradeModel)

Construct a new instance of TradeModelPropertyFactory, bound to the given caplin.trading.trademodel.Trade instance.

Parameters
caplin.trading.trademodel.Trade oTradeModel The trade model instance that all created properties will be bound to.

Method Detail

void destroy()

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

caplin.presenter.property.EditableProperty getEditableProperty(String sPath)

Returns a new caplin.presenter.property.EditableProperty instance bound to the specified part of the trade model.

Parameters
String sPath the path to the property on the Trade object.

caplin.presenter.property.Property getProperty(String sPath)

Returns a new caplin.presenter.property.Property instance bound to the specified part of the trade model.

Parameters
String sPath the path to the property on the Trade object

caplin.trading.trademodel.Trade getTrade()

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

Object getTradeLegFactory(int nLegIndex, Function fTradeModelPropertyFactory)

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 #getProperty and #getEditableProperty.

Parameters
int nLegIndex The index of the leg that will become the new root object.
Function fTradeModelPropertyFactory (optional) The TradeModelPropertyFactory constructor that should be used, uses caplin.trading.presenter.TradeModelPropertyFactory if not provided.
Deprecated
This method is deprecated. Use caplin.trading.presenter.TradeModelPropertyFactory#getTradeLegFactoryById
Returns
a new instance of caplin.trading.presenter.TradeModelPropertyFactory or a new instance of fTradeModelPropertyFactory if provided.

Object getTradeLegFactoryById(int nLegId, Function fTradeModelPropertyFactory)

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 #getProperty and #getEditableProperty.

Parameters
int nLegId The ID of the leg that will become the new root object.
Function fTradeModelPropertyFactory (optional) The TradeModelPropertyFactory constructor that should be used, uses caplin.trading.presenter.TradeModelPropertyFactory if not provided.
Returns
a new instance of caplin.trading.presenter.TradeModelPropertyFactory or a new instance of fTradeModelPropertyFactory if provided.

caplin.presenter.property.Property getTradeStateProperty()

Returns a new caplin.presenter.property.Property instance bound to the overall state of the trade.

void setTrade(caplin.trading.trademodel.Trade 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
caplin.trading.trademodel.Trade oModel The new trade model object that all properties will now be bound to.