Package com.sun.interview
Class PropertiesQuestion.FilenameConstraints
java.lang.Object
com.sun.interview.PropertiesQuestion.ValueConstraints
com.sun.interview.PropertiesQuestion.FilenameConstraints
- Enclosing class:
PropertiesQuestion
public static class PropertiesQuestion.FilenameConstraints
extends PropertiesQuestion.ValueConstraints
Constrains the response to filenames or paths, and allows chooser
widgets to be rendered for the user when appropriate.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected File[]
Current value set for the suggested response values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the default directory for files for a response to this question.Get the filters used to select valid files for a response to this question.File[]
boolean
Determine whether all valid responses to this question should be relative to the base directory (in or under it).Is the given value valid for this field? Since this constraint class has no particular typing, the default only check that the value is non-empty.void
setBaseDirectory
(File dir) Set the default directory for files for a response to this question.void
setBaseRelativeOnly
(boolean b) Specify whether all valid responses to this question should be relative to the base directory (i.e.void
setFilter
(FileFilter filter) Set a filter used to select valid files for a response to this question.void
setFilters
(FileFilter... filters) Set the filters used to select valid files for a response to this question.void
setSuggestions
(File... sugs) Supply some possible values that the user may want to select from.Methods inherited from class com.sun.interview.PropertiesQuestion.ValueConstraints
isReadOnly, isUnsetAllowed, isVisible, setReadOnly, setUnsetAllowed, setVisible
-
Field Details
-
suggestions
Current value set for the suggested response values.- See Also:
-
-
Constructor Details
-
FilenameConstraints
public FilenameConstraints() -
FilenameConstraints
- Parameters:
baseDir
- Base directory where selection should begin from.relativeOnly
- Force the result of this value to be relative to the base location. This is limited on some filesystem types of course, where relative paths from one place to another are not always possible.
-
-
Method Details
-
isValid
Description copied from class:PropertiesQuestion.ValueConstraints
Is the given value valid for this field? Since this constraint class has no particular typing, the default only check that the value is non-empty. You may override this method to do custom checking, or you may do your checking in getInvalidKeys() which by default defers to the associated constraint object (if any).- Overrides:
isValid
in classPropertiesQuestion.ValueConstraints
- Parameters:
v
- The value to check.- Returns:
- Null if the valid is valid, a localized reason string otherwise.
- See Also:
-
getFilters
Get the filters used to select valid files for a response to this question.- Returns:
- An array of filters
- See Also:
-
setFilters
Set the filters used to select valid files for a response to this question. The first element in the array is selected by default. Use this method, or setFilter(), not both.- Parameters:
filters
- An array of filters used to select valid files for a response to this question- See Also:
-
setFilter
Set a filter used to select valid files for a response to this question. Use this method, or setFilters(), not both.- Parameters:
filter
- a filter used to select valid files for a response to this question- See Also:
-
getBaseDirectory
Get the default directory for files for a response to this question.- Returns:
- the default directory in which files should be found/placed
- See Also:
-
setBaseDirectory
Set the default directory for files for a response to this question.- Parameters:
dir
- the default directory in which files should be found/placed- See Also:
-
isBaseRelativeOnly
public boolean isBaseRelativeOnly()Determine whether all valid responses to this question should be relative to the base directory (in or under it). False by default.- Returns:
- true if all valid responses to this question should be relative to the base directory
- See Also:
-
setBaseRelativeOnly
public void setBaseRelativeOnly(boolean b) Specify whether all valid responses to this question should be relative to the base directory (i.e. in or under it.)- Parameters:
b
- this parameter should be true if all valid responses to this question should be relative to the base directory
-
getSuggestions
-
setSuggestions
Supply some possible values that the user may want to select from. ThegetPath()
string will be used for presentation and persistent storage of the value.
-