Watchlist API interfaces and classes
This Watchlist API consists of four interfaces, and four implementation classes for the StreamLink.
API Documentation
Interfaces
Interface overview
WatchlistService
The WatchlistService object, retrieved from the Service Registry, is the object to use for:
-
creating watchlists,
-
disposing of watchlists,
-
monitoring the status of the data connection to the Caplin Platform, via the event WatchlistServiceEvents.STATUS_CHANGED.
Register listeners for the Watchlist Service events WatchlistServiceEvents.ADDED and WatchlistServiceEvents.REMOVED to maintain your own array of the user’s Watchlist objects.
Watchlist
Watchlist objects are never constructed directly but are retrieved via five sources:
-
Directly from the WatchlistService.getById method. This approach is used by the Webcentric layout manager when de-serialising a GUI layout from XML.
-
As the first function parameter of the event handler for the WatchlistServiceEvents.ADDED event
-
As the first function parameter of the event handler for the WatchlistServiceEvents.REMOVED event
-
As the first function parameter of the success callback for the WatchlistService.create method
-
As the first function parameter of the error callback for the WatchlistService.dispose method
A Watchlist object allows direct access to its metadata, but working with its contents requires working, either directly or indirectly, with subscriptions:
-
To retrieve the subjects monitored by a watchlist, subscribe to the RTTP subject name returned by Watchlist.getSubject
-
To insert, append or remove subjects from the watchlist, request a WatchlistContentsManager instance for the watchlist using Watchlist.getContentsManager.
Register a listener for the Watchlist event WatchlistEvents.PROPERTY_CHANGED to respond to a change in a watchlist’s name.
WatchlistContentsManager
An instance of the WatchlistContentsManager class is used to manipulate the contents of a watchlist. You acquire an instance by calling Watchlist.getContentsManager. When you have finished manipulating the watchlist, call WatchlistContentsManager.destroy.
The WatchlistContentsManager class exists as a means for Watchlist objects to manage the subscription to their container on Transformer. A watchlist object will keep its subscription open while at least one issued WatchlistContentsManager remains active.
WatchlistGridDataProvider
The WatchlistGridDataProvider class links a grid component to an existing Transformer-hosted watchlist. This class provides data to the grid via a subscription to the watchlist’s container on Transformer, and translates local row addition and removal events into commands to Transformer’s Watchlist Service.
You will rarely need to instantiate this class explicitly; the Webcentric layout manager will instantiate the class in the course of deserialising the XML layout configuration for a watchlist grid.