Package com.sun.interview
Class FileQuestion
- java.lang.Object
-
- com.sun.interview.Question
-
- com.sun.interview.FileQuestion
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileQuestion(Interview interview, java.lang.String tag)Create a question with a nominated tag.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear any response to this question, resetting the value back to its initial state.protected static booleanequal(java.io.File f1, java.io.File f2)Determine if two filenames are equal.java.io.FilegetBaseDirectory()Get the default directory for files for a response to this question.java.io.FilegetDefaultValue()Get the default response for this question.FileFilter[]getFilters()Get the filters used to select valid files for a response to this question.java.lang.StringgetStringValue()Get the response to this question as a string.java.io.File[]getSuggestions()Get the suggested responses to this question, or null if none.java.io.FilegetValue()Get the current (default or latest) response to this question.java.io.FilegetValueOnPath()Verify this question is on the current path, and if it is, return the current value.booleanisBaseRelativeOnly()Determine whether all valid responses to this question should be relative to the base directory (i.e.booleanisValueAlwaysValid()Check if the question always has a valid response.booleanisValueValid()Check if the question currently has a valid response.protected voidload(java.util.Map<java.lang.String,java.lang.String> data)Load the value for this question from a dictionary, using the tag as the key.protected voidsave(java.util.Map<java.lang.String,java.lang.String> data)Save the value for this question in a dictionary, using the tag as the key.voidsetBaseDirectory(java.io.File dir)Set the default directory for files for a response to this question.voidsetBaseRelativeOnly(boolean b)Specify whether all valid responses to this question should be relative to the base directory (in or under it).voidsetDefaultValue(java.io.File v)Set the default response for this question, used by the clear method.voidsetFilter(FileFilter filter)Set a filter used to select valid files for a response to this question.voidsetFilters(FileFilter... filters)Set the filters used to select valid files for a response to this question.voidsetSuggestions(java.io.File... newSuggestions)Set the set of suggested responses.voidsetValue(java.io.File newValue)Set the current value.voidsetValue(java.lang.String path)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
-
-
-
-
Constructor Detail
-
FileQuestion
protected FileQuestion(Interview interview, java.lang.String tag)
Create a question with a nominated tag.- Parameters:
interview- The interview containing this question.tag- A unique tag to identify this specific question.
-
-
Method Detail
-
equal
protected static boolean equal(java.io.File f1, java.io.File f2)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
public java.io.File[] getSuggestions()
Get the suggested responses to this question, or null if none.- Returns:
- The suggestions.
- See Also:
setSuggestions(java.io.File...)
-
setSuggestions
public void setSuggestions(java.io.File... newSuggestions)
Set the set of suggested responses.- Parameters:
newSuggestions- The values to be set, or null if none- Throws:
java.lang.IllegalArgumentException- if any of the values in the array are null- See Also:
getSuggestions()
-
getDefaultValue
public java.io.File getDefaultValue()
Get the default response for this question.- Returns:
- the default response for this question.
- See Also:
setDefaultValue(java.io.File)
-
setDefaultValue
public void setDefaultValue(java.io.File v)
Set the default response for this question, used by the clear method.- Parameters:
v- the default response for this question.- See Also:
getDefaultValue()
-
getValue
public java.io.File getValue()
Get the current (default or latest) response to this question.- Returns:
- The current value.
- See Also:
setValue(java.lang.String)
-
setValue
public void setValue(java.lang.String path)
Set the response to this question to the value represented by a string-valued argument.- Specified by:
setValuein classQuestion- Parameters:
path- A string containing a value value appropriate for the particular type of question whose value is being set.- See Also:
getValue()
-
setValue
public void setValue(java.io.File newValue)
Set the current value.- Parameters:
newValue- The value to be set.- See Also:
getValue()
-
getValueOnPath
public java.io.File getValueOnPath() throws Interview.NotOnPathFaultVerify 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:
getValue()
-
getStringValue
public java.lang.String getStringValue()
Description copied from class:QuestionGet the response to this question as a string.- Specified by:
getStringValuein classQuestion- Returns:
- a string representing the current response to this question, or null.
- See Also:
Question.setValue(String)
-
isValueValid
public boolean isValueValid()
Description copied from class:QuestionCheck if the question currently has a valid response.- Specified by:
isValueValidin classQuestion- Returns:
- true if the question currently has a valid response, and false otherwise.
-
isValueAlwaysValid
public boolean isValueAlwaysValid()
Description copied from class:QuestionCheck if the question always has a valid response. This may be true, for example, for a choice question with a default response.- Specified by:
isValueAlwaysValidin classQuestion- Returns:
- true if the question always has a valid response, and false otherwise.
-
getFilters
public FileFilter[] getFilters()
Get the filters used to select valid files for a response to this question.- Returns:
- An array of filters
- See Also:
setFilter(com.sun.interview.FileFilter),setFilters(com.sun.interview.FileFilter...)
-
setFilters
public void setFilters(FileFilter... filters)
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:
getFilters(),setFilter(com.sun.interview.FileFilter)
-
setFilter
public void setFilter(FileFilter filter)
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:
getFilters(),setFilters(com.sun.interview.FileFilter...)
-
getBaseDirectory
public java.io.File 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(java.io.File),isBaseRelativeOnly()
-
setBaseDirectory
public void setBaseDirectory(java.io.File dir)
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:
getBaseDirectory()
-
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(boolean)
-
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
protected void load(java.util.Map<java.lang.String,java.lang.String> data)
Load the value for this question from a dictionary, using the tag as the key.
-
-