Caplin Trader 5.1.0

Class: module:ct-workbench/ui/WorkbenchDataEditor

module:ct-workbench/ui/WorkbenchDataEditor(oDataSubscriber, nAutoGenerateIntervalMillis)

new module:ct-workbench/ui/WorkbenchDataEditor(oDataSubscriber, nAutoGenerateIntervalMillis)

A WorkbenchDataEditor allows for manipulation of the subscriber data (for example, pricing) via a module:ct-services/messaging/Subscription. Generally for workbenches, this is achieved via a module:ct-services/testing/SubscriptionStub, for example:

	var oDataSubscriber = new caplin.services.testing.SubscriptionStub("GBPUSD");
	var oMessageService =
	{
		createSubscriber: function(sSubject)
		{
			return oDataSubscriber;
		}
	};
ServiceRegistry.registerService("caplin.message-service", oMessageService);

var oPriceDataEditor = new WorkbenchDataEditor(oDataSubscriber, 2000);
oPriceDataEditor.addFieldsByExample({"Bid":"1.1111", "Ask":"1.1112"});

The WorkbenchDataEditor also supports randomly generated updates of data, which is useful for testing price updates.

Extends:
Parameters:
Name Type Description
oDataSubscriber module:ct-services/messaging/Subscription

The data subscriber to add.

nAutoGenerateIntervalMillis int

The interval which will be used to generate data updates.

Extends

Methods

addDataGenerator(oDataGenerator)

Adds a data generator that will be used to generate updates for this class. Note that the generate method will be called at a rate of nAutoGenerateIntervalMillis (as specified in the constructor).

Parameters:
Name Type Description
oDataGenerator module:ct-workbench/model/DataGenerator

The generator to add.

getElement()

Overrides:
Implements:
Returns:

the top level element

getPresentationModel()

Returns the presentation model used for the QuckForm.

Inherited From:
Returns:

The presentation model for the QuickForm