The Distributed Portfolio Manager (DPM) project provides an example of a Bean Works component that combines a number of different components and widgets into a real-life application. The DPM component uses the WebRunner MultiColumnListbox bean and the Bean Works-based Chart bean that are included in the Bean Tester. You can run a DPM component as an application or as an applet through the Bean Tester. You can easily launch a DPM component from the VisualAge WebRunner-->Samples program group.
The DPM component is designed on a scenario in which a customer can access their portfolio information by logging into their account through the web. The customer can buy and sell securities and deposit and withdraw cash from their account. The Portfolio Manager maintains a connection to a live stock quote server, updates the portfolio accordingly, and notifies the customer if the price of one of their securities changes significantly.
Note: Currently the Portfolio Manager is only a demonstration and therefore works only locally. Customer log-in is disabled, and the security price information is simulated.
The DPM component also lets the customer dynamically create different views based on risk type (options, bonds, cash, and so on) or security. The component updates these views periodically if the underlying security prices change:
The program features in the DPM project code include:
The Portfolio Manager project defines the following classes. Select any linked class name to see documented code. You can also look at the source code for any class in webrunner\BeanTools\samples\dpm:
Dpm is the controller class that binds the model and view and manages the interface.
DpmModel manages the data for the Portfolio Manager. Currently a DpmModel owns a Customer object and a PortfolioManager object. When this application works in a distributed environment, the model will no longer own these objects but will support the data for many Customer objects that exist within the network.
DpmView is the root view for the component. It displays the Portfolio data and allows the customer to interact with their securities. It also manages the pie chart views that show risk and security distributions.
DpmGUIHandler is owned by the controller and manages the user interface elements.
DpmSelection lets the customer select objects--for example, a security to buy or sell.
DpmResources contains resources used to build the component, including the model and view names and localized string resources.
Account is used to represent the account data for a single customer, and provides methods for creating and managing the account.
Customer is used to represent a single customer, and provides methods allowing access to customer data related to connection and verification.
PortManager stores a vector of Account objects that are associated with one or more customers.
PortRecord maintains a single item within a portfolio, including security symbol, basis, and number of shares.
Security maintains data on a single security, including symbol, type (for example, bond or option), and current price. SecurityInfo provides access to this data.
DialogProcessor is used to process dialogs used from within the component.
MessageDialog provides the dialog used to provide messages to the customer.
SecurityDialogProcessoris used to process the dialog that lets the customer perform a transaction with a particular security.
SecurityDialog implements the dialog that lets the customer perform a transaction with a particular security.
BuyCommand, CashTransactionCommand, SellCommand, and SetPriceCommand implement different commands that the customer executes when performing a transaction.
TickerTape implements the animated stock ticker shown in a Portfolio Manager window.
The project also defines a number of implementation classes used to support some of the classes listed above, including the Customer and PortManager classes.
Source code for the Portfolio Manager project is in WebRunner\BeanTools\samples\dpm. You can launch a Portfolio Manager component by typing run at the command prompt from this directory, or from the WebRunner Bean Tools-->Samples program group.
Next |
Copyright ©
Taligent, Inc. 1996 - 1997.
Copyright © IBM Corporation 1996 - 1997.
All Rights Reserved.