{@link de.qfs.lib.option.Option Options} have a name and a value and are packed together in an {@link de.qfs.lib.option.OptionSet OptionSet}, which offers convenient access to their typed values. An OptionSet implements the {@link de.qfs.lib.config.Configurable Configurable} interface, so it is easy to save and restore Options.
To edit options, they can be arranged in a hierarchie of {@link de.qfs.lib.option.OptionGroup OptionGroups} and {@link de.qfs.lib.option.OptionEdit OptionEdits}.
The most convenient way to bring up a dialog to edit a set of Options is to create an {@link de.qfs.lib.option.OptionDialog OptionDialog} and call its {@link de.qfs.lib.option.OptionDialog#doModal doModal} method .
The type, layout and labels of the components used to edit a set of Options are determined by a set of resources, that must be set with {@link de.qfs.lib.option.Option#setResources Option.setResources}.
For the standard error messages and the button labels of an
OptionDialog, these resources must include the following values, which
are read by default from
/de/qfs/lib/resources/properties/qflib
in
qflib.jar
.
Resource name | Usage |
---|---|
option.error.empty.title |
Title for the Empty value message. |
option.error.empty.message |
Message for the Empty value message. |
option.error.notANumber.title |
Title for the Bad format message. |
option.error.notANumber.message |
Message for the Bad format message. |
option.error.negative.title |
Title for the Negative value message. |
option.error.negative.message |
Message for the Negative value message. |
option.dialog.ok.name |
Label for the OK button of an OptionDialog. |
option.dialog.ok.mnemonic |
Shortcut for the OK button of an OptionDialog. |
option.dialog.cancel.name |
Label for the Cancel button of an OptionDialog. |
option.dialog.cancel.mnemonic |
Shortcut for the Cancel button of an OptionDialog. |
The additional resource names must have the following format (name denotes the name of an Option and groupname the name of an OptionGroup):
Resource name | Usage |
---|---|
option.name.label |
The label for the Option (optional, default empty). |
option.name.mnemonic |
Keyboard accelerator (optional, default none). |
option.name.disabled |
If true, the OptionEdit will be disabled and remain so even if {@link de.qfs.lib.option.OptionEdit#setEnabled setEnabled(true)} is called (optional, default false). |
option.name.height |
Preferred width in characters for a TextOptionEdit or an EditorOptionEdit. |
option.name.height |
Preferred height in lines for a TextOptionEdit or an EditorOptionEdit. |
option.name.font |
The font for a TextOptionEdit or an EditorOptionEdit (optional, default is standard TextField font). | option.name.weight |
The weight (a double) to use for a TextOptionEdit or an EditorOptionEdit when placed in the {@link de.qfs.lib.gui.Grid Grid} of a PlainOptionGroup (optional, default 0). |
option.name.scroll |
If true a TextOptionEdit or EditorOptionEdit will get its own scroll pane (optional, default true). |
option.name.type |
The content type for the {@link javax.swing.JEditorPane JEditorPane} of an EditorOptionEdit (optional, default text/plain). |
option.name.numchoices |
The number of choices in a ChoiceOptionEdit. |
option.name.choicen.label |
The label for the nth choice of a ChoiceOptionEdit, where n is between 1 and numchoices. |
option.group.groupname.type |
The type of an OptionGroup. Supported types are
plain , radio , tab ,
nested and custom . |
option.name.disabled |
If true, the OptionGroup will be disabled and remain so even if {@link de.qfs.lib.option.OptionGroup#setEnabled setEnabled(true)} is called (optional, default false). |
option.group.groupname.members |
The members of an OptionGroup of type plain. A space separated list where name denotes an Option and group.groupname denotes an OptionGroup. |
option.group.groupname.columns |
The number of columns in which to place the members of the OptionGroup (optional, default 1). Used with plain and radio groups. |
option.group.groupname.frame |
Whether the group should have a framed border (optional, default false). |
option.group.groupname.title |
The title for a framed border of the group. Ignored if no frame is specified(optonal, default empty). |
option.group.groupname.option |
The name of the Option for a RadioOptionGroup or a NestedOptionGroup. |
option.group.groupname.numchoices |
The number of Buttons in a RadioOptionGroup. |
option.group.groupname.choicen.label |
The label for the nth button of a RadioOptionGroup, where n is between 1 and numchoices. |
option.group.groupname.numtabs |
The number of tabs in a TabbedOptionGroup. |
option.group.groupname.tabn.group |
The name of the OptionGroup to put on the nth tab, where n is between 1 and numtabs. |
option.group.groupname.tabn.title |
The title for the nth tab, where n is between 1 and numtabs. |
option.group.groupname.class |
The fully qualified name of the class for the custom OptionGroup. |