- Goals
- User guide
- Classlib developers guide
- Developer guide
- Tester guide
- Porting guide
- Blogs
- Project development
- Glossary
- Proposals
- FAQ
- Papers & presentations
- References
- Research
Specifying property screens
The "dialog" between the Configure tool and the user is organized into sequences of questions called screens. Each screen is a described by a "screen" element in the configuration script. Here is a typical example:
<screen title="Main JNode Build Settings"> <item property="jnode.virt.platform"> The JNode build can generate config files for use with various virtualization products. </item> <item property="expert.mode"> Some JNode build settings should only be used by experts. </item> </screen>
When the Configure tool processes a screen, it first outputs the screen's "title" and then iterates over the "item" elements in the screen. For each item, the tool outputs the multi-line content of the item, followed by a prompt formed from the designated property's description, type and default value. The user can enter a value, or just hit ENTER to accept the default. If the value entered by the user is acceptable, the Configure tool moves to the next item in the screen. If not, the prompt is repeated.
Conditional Screens
The screen mechanism allows you to structure the property capture dialog(s) independently of the property files. But the real power of this mechanism is that screens can be made conditional on properties captured by other screens. For example:
<screen title="Virtualization Platform Settings" guardProp="jnode.virt.platform" valueIsNot="none"> <item property="jnode.vm.size"> You can specify the memory size for the virtual PC. We recommended a memory size of least 512 Mbytes. </item> <item property="jnode.virtual.disk"> Select a disk image to be mounted as a virtual hard drive. </item> </screen>
This screen is controlled by the state of a guard property; viz the "guardProp" attribute. In this case, the "valueIsNot" attribute says that property needs to be set to some value other than "none" for the screen to be acted on. (There is also a "valueIs" attribute with an analogous meaning.)
The Configuration tool uses an algorithm equivalent to the following one to decide which screen to process next:
- The tool builds a work-list of the screens in the script. The screens are added to the list in the order that they are encountered by the script file parser.
- To find the next screen, the tool iterates over the work list entries, looking for the screen one that satisfies one of the following criteria:
- a screen with no guard property, or
- a screen with whose guard property has been set, and
- has a "valueIs" attribute whose value equals the guard property's value, or
- has a "valueIsNot" atttibute whose value does not equal the guard property's value.
- The selected screen is then removed from the work-list and processed as described previously.
- To select the next screen, the tool goes back to step 2), repeating until either the work-list is empty, or none of the remaining screens satisfy the criteria.
- Printer-friendly version
- Login to post comments