Stock Picker subsystem

The Stock Picker subsystem supports the Stock Picker document which presents a list of stocks from which the user can select and then drag to the Stock Viewer to display the stock graphically. Using one of two stationery objects, the user can open an empty Stock Picker or one that contains a snapshot of stocks available from the Stock Server.

Users can also drag a stock name from the Stock Picker to other programs that accept stock data. Such a program needs to be able to accept drops of TModelScrapItem objects and extract from them a TAtomicModelOn<TStockData> object containing the stock.


To launch a Stock Picker document, the user opens one of two available component stationery objects. The Stock Picker uses a stationery template provided by the Presentation framework. It is instantiated twice: once to create a TPickerModel and TEmptyPickerPresenter, and a second time to create a TPickerModel and TStandardPickerPresenter. The only difference between the two presenter classes is that TStandardPickerPresenter downloads available stocks from the Stock Server when its HandleOpen function is called by the Presentation framework.

Opening a TGUIModelPresenterStationeryFor<TPickerModel, TEmptyPickerPresenter> produces an empty picker document. This can be used to collect the user's favorite stocks or just the stocks she owns. Opening a TGUIModelPresenterStationeryFor<TPickerModel, TStandardPickerPresenter> object produces a document containing a snapshot of the stocks available from the Stock Server.

The purpose of TPickerModel is to maintain a persistent collection of TStockData objects. It has functions for adding, removing, obtaining stocks, and providing a time stamp to indicate the version of the stock data it contains.

TPickerSelection is a whole-model, partial, or empty selection. The selection can export a TPickerModel object containing the selected stocks. Additionally, if a TPickerSelection object only specifies a single stock, that selection can export a TAtomicModelOn<TStockData> object containing this stock.

When a TPickerSelection object is used to add or remove stocks from a TPickerModel, it sends a notification when the operation is carried out. The notification is not sent during a call to any function that changes the model's data such as AdoptStock. If it did, calling OrphanStock and then AdoptStock would generate two notifications when only one is really necessary. (Sometimes two are necessary, but the Stock Picker only needs one.)

TPickerView is the main content view for a Stock Picker document. It displays a list of the model's stocks and is set up to receive notification when stocks are added to or removed from the model. It also derives from TDOMComponentView to take advantage of the drag and drop functionality provided by the Taligent Selection Tool documented sample.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker