The directory field is essentially the same as the file field except it the selection is limited to directories only, not single files.
<field type="dir" align="left" variable="existing.jboss.home"> <spec txt="" size="25" set="$INSTALL_PATH$FILE_SEPARATOR${jboss.version}" mustExist="false"/> </field>
The directory
field supports the following attributes for the <spec>
element:
Name | Required | Description | Value |
---|---|---|---|
| no | Specifies whether or not the selected path must be an existing directory. | true, false default: true |
| no | Specifies whether or not the selected directory should be created if it does not exist. (requires mustExist=false) | true, false default: false |
allowEmptyValue | no | If set true, no file has to be selected and the box can be left empty. | true, false default: false |
| no | File extension to be forced. This will be used as mask in the FileChooserDialog. | |
fileextdesc | no | The description of the file extension. This will be used in the file extension mask in the FileChooserDialog. There can be used a translation key, it is translated along with the UserInputPanel translations separately. |
The directory supports a <description> element that can be used to provide information about the purpose of the directory field.
See Fields documentation for more detail.
<field type="dir" align="left" variable="encrypted.dir"> <description id="encrypted.dir.info" txt="Which directory would you like to be encrypted?" /> <spec txt="" size="25" set="" mustExist="true"/> </field>
Messages for the directory field can be customized by creating a custom lang pack and overriding the following values (attribute values wrapped for readability):
<str id="UserInputPanel.dir.nodirectory.message" txt="You must select a valid directory."/> <str id="UserInputPanel.dir.nodirectory.caption" txt="No Directory Selected"/> <str id="UserInputPanel.dir.notdirectory.message" txt="The directory you have chosen either does not exist or is not valid."/> <str id="UserInputPanel.dir.notdirectory.caption" txt="Invalid Directory"/>
Note:
Mixing directory fields with other fields that have text in front of them can lead to formatting (layout) issues. Placing these types of elements on different panels can provide a much better user experience.