Package com.sun.interview
Class FileQuestion
java.lang.Object
com.sun.interview.Question
com.sun.interview.FileQuestion
A
question
to which the response is a filename.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
FileQuestion
(Interview interview, String tag) Create a question with a nominated tag. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear any response to this question, resetting the value back to its initial state.protected static boolean
Determine if two filenames are equal.Get the default directory for files for a response to this question.Get the default response for this question.Get the filters used to select valid files for a response to this question.Get the response to this question as a string.File[]
Get the suggested responses to this question, or null if none.getValue()
Get the current (default or latest) response to this question.Verify this question is on the current path, and if it is, return the current value.boolean
Determine whether all valid responses to this question should be relative to the base directory (i.e.boolean
Check if the question always has a valid response.boolean
Check if the question currently has a valid response.protected void
Load the value for this question from a dictionary, using the tag as the key.protected void
Save the value for this question in a dictionary, using the tag as the key.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 (in or under it).void
Set the default response for this question, used by the clear method.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... newSuggestions) Set the set of suggested responses.void
Set the current value.void
Set the response to this question to the value represented by a string-valued argument.Methods inherited from class com.sun.interview.Question
addMarker, equals, export, getChecklistItems, getHelpID, getImage, getInterview, getKey, getNext, getResourceString, getResourceString, getSummary, getTag, getText, getTextArgs, hashCode, hasMarker, isEnabled, isHidden, reload, removeMarker, setHelpID, setImage, setImage, setSummary, setText
-
Field Details
-
value
The current (default or latest) response to this question. -
suggestions
Suggested values for this question.
-
-
Constructor Details
-
FileQuestion
Create a question with a nominated tag.- Parameters:
interview
- The interview containing this question.tag
- A unique tag to identify this specific question.
-
-
Method Details
-
equal
Determine if two filenames are equal.- Parameters:
f1
- the first filename to be comparedf2
- the other filename to be compared- Returns:
- true if both filenames are null, or if both identify the same filename
-
getSuggestions
Get the suggested responses to this question, or null if none.- Returns:
- The suggestions.
- See Also:
-
setSuggestions
Set the set of suggested responses.- Parameters:
newSuggestions
- The values to be set, or null if none- Throws:
IllegalArgumentException
- if any of the values in the array are null- See Also:
-
getDefaultValue
Get the default response for this question.- Returns:
- the default response for this question.
- See Also:
-
setDefaultValue
Set the default response for this question, used by the clear method.- Parameters:
v
- the default response for this question.- See Also:
-
getValue
Get the current (default or latest) response to this question.- Returns:
- The current value.
- See Also:
-
setValue
Set the response to this question to the value represented by a string-valued argument. -
setValue
Set the current value.- Parameters:
newValue
- The value to be set.- See Also:
-
getValueOnPath
Verify this question is on the current path, and if it is, return the current value.- Returns:
- the current value of this question
- Throws:
Interview.NotOnPathFault
- if this question is not on the current path- See Also:
-
getStringValue
Description copied from class:Question
Get the response to this question as a string.- Specified by:
getStringValue
in classQuestion
- Returns:
- a string representing the current response to this question, or null.
- See Also:
-
isValueValid
public boolean isValueValid()Description copied from class:Question
Check if the question currently has a valid response.- Specified by:
isValueValid
in classQuestion
- Returns:
- true if the question currently has a valid response, and false otherwise.
-
isValueAlwaysValid
public boolean isValueAlwaysValid()Description copied from class:Question
Check if the question always has a valid response. This may be true, for example, for a choice question with a default response.- Specified by:
isValueAlwaysValid
in classQuestion
- Returns:
- true if the question always has a valid response, and false otherwise.
-
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.- 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.- 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 (i.e. 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 (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
-
clear
public void clear()Clear any response to this question, resetting the value back to its initial state. -
load
Load the value for this question from a dictionary, using the tag as the key. -
save
Save the value for this question in a dictionary, using the tag as the key.
-