CAPDM Tutorial Applets |
Remote Control using JavaScriptJavaScript support is limited to showing version information for this applet. |
The applet can be invoked by embedding an APPLET tag into your HTML document (if you look at the source of this document you will see a working example you can copy). The table below details the basic parameters used and additional startup parameters that are specific to this applet.
<APPLET CODEBASE="../../../../classes" ALT="Yield Curve" CODE="applet.capdm.finance.yieldcurve.YieldCurveApp" NAME="YieldCurve" WIDTH="360" HEIGHT="400"> <PARAM NAME="DataFile" VALUE="data/capdm/finance/yieldcurve/yielddata.ser"> </APPLET>
| Basic Parameters | Use |
| CODEBASE="../../../../classes" | The CODEBASE of the applet must point at the top-level classes directory in order for the applet to be found. |
| CODE="applet.capdm.finance. yieldcurve.YieldCurveApp" |
This required attribute gives the name of the file that contains the applet's compiled Applet subclass. This file is relative to the base URI of the applet. |
| ALT="Yield Curve" | This optional attribute specifies any text that should be displayed if the browser understands the APPLET tag but can't run Java applets. |
| NAME="YieldCurve" | This optional attribute specifies a name for the applet instance, which makes it possible for applets on the same page to find (and communicate with) each other. If you intend to use JavaScript/Applet scripting then the applet must be named a shown. |
| WIDTH="360" HEIGHT="400" | These required attributes give the initial width and height (in pixels) of the applet display area, not counting any windows or dialogs that the applet brings up. |
| Applet Startup Parameters | Use |
| DataFile | Points to the Java serialised data file used by the applet to geneate graphs. |
For more information on the use of the APPLET tag and other attributes you can use but which are not listed above, visit the W3.org specification page at: APPLET tag in HTML 4.
This applet can be called into using Javascript 1.1 while running. Although JavaScript can call the Applet directly, some convenient JavaScript functions have been created which deal with the details of the communication. The following table lists the call Names which can be made, and gives examples of their use and results.
| API Call Name | Parameters | Use and Result |
| setValue(name,value) | 'name' can be one of "ChartType" or "Year". 'value' can be "Bar" or "Line" in the case of "ChartType", and between 0 and 238 for "Year" |
javascript:setValue("Year",70); Changes
the Year to Jan 1983 |
| showAbout() | none | javascript:showAbout(); Shows the version dialog
box of this applet. |
| reset() | none | javascript:reset(); resets the applet to initial
starting position |
| getValue() | none | javascript:getValue(); Gets the status of the
applet |
| getValue(name) | 'name' can be one of "ChartType" or "Year". | javascript:getValue("Year"); Gets the
current Year - might return "Jan. 1983". Other examples:javascript:getValue("ChartType"); might return "Line" |
| getValue(name,dp) | 'name' can be one of "ChartType" or "Year". 'dp' is the number of decimal places of accuracy required - ignored in this applet |
javascript:getValue("Year",2); Gets
the current Year - might return "Jan. 1983". Other examples:javascript:getValue("ChartType",0); might return
"Line" |