Runtime Properties ("Parameters")¶
Runtime Properties extend the common technique of applet parameters and are part of the Property Framework. They can be used to define runtime settings and applet parameters without having to change the applet
tag in the embedding web site.
Runtime properties are identified by a name (e.g. title
) and have a value of a specific type (e.g. integer
, font
). Nevertheless their value must always be expressed as a simple string (as defined by the common applet specification). "Unknown" parameters (i.e. not registered by any loaded extension) in an applet
tag use the type string
per default.
They can be used in both library and applet extensions. Observe that applet properties overwrite existing properties from any library extension. Thus they can be used to change default settings for a single applet.
Setting Runtime Properties¶
Inside an extension's property file, a single mf:runtime-settings
block holds the runtime properties for the extension:
<mf:runtime-settings>
<mf:property name="NAME" type="TYPE" value="VALUE"/>
...
</mf:runtime-settings>
The following example (typical for an applet extension) registers the Graphics2D library extension and sets the compliance level to the version 2.1
:
<mf:runtime-settings>
<mf:property name="extensions" type="string" value="mf-lib_g2d"/>
<mf:property name="compliance-level" type="version" value="2.1"/>
</mf:runtime-settings>
Retrieving Runtime Properties¶
Inside a mathlet the method getParameter(String name)
can be used to retrieve a runtime property. It returns null
if a parameter with this name was not defined (neither by a property file, nor by an entry in the applet
tag).
Mathlet Runtime Properties¶
Runtime properties are used in the Mathlet Runtime for setting default values. The following properties are already defined by the Mathlet Runtime and can be used in an extension's property file:
Name | Type | Default Value | Description | |
lang | string | --- | language parameter |
---|---|---|---|---|---|---|---|---|
title | string | --- | mathlet title | |||||
appletWidth | integer | 600 | width of mathlet frame | |||||
appletHeight | integer | 600 | height of mathlet frame | |||||
embeddingMode | string | applet | embedding mode | |||||
buttonText | string | --- | embedded button text | |||||
extensions | string | --- | list of extension names | |||||
compliance-level | version | 2.0 | last compatible version | |||||
version.jvm.min | version | 1.4.2 | oldest compatible JVM | |||||
version.jvm.max | version | 1.6 | newest compatible JVM | |||||
useJMF | boolean | true | enable usage of JMF | |||||
useJavaHelp | boolean | true | enable usage of JavaHelp | |||||
useMumieTheme | boolean | true | enable usage of themes | |||||
homeworkMode | string | --- | homework mode | |||||
homeworkEditable | string | --- | editable flag for homework modes | |||||
inputDatasheet | string | --- | input datasheet | |||||
outputDatasheet | string | --- | output datasheet | |||||
correctorClass | string | --- | fully qualified corrector class | |||||
problemRef | integer | --- | problem reference on server | |||||
problemId | integer | --- | ||||||
urlPrefix | string | --- | ||||||
courseId | integer | --- | ||||||
worksheetId | integer | --- | ||||||
saveAnswersPath | string | --- |
Defining Own Parameters¶
In order to "reserve" a parameter's name for a specific function, it is possible (and even strongly encourage for library extensions) to register it in an extension:
<mf:parameters>
<mf:parameter name="NAME" type="TYPE" description="DESCRIPTION"/>
</mf:parameters>
These information will also be available through the common applet's
getParameterInfo()
method. The description may be empty.