Package com.sun.interview
Class StringListQuestion
- java.lang.Object
-
- com.sun.interview.Question
-
- com.sun.interview.StringListQuestion
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
StringListQuestion(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 void
clear()
Clear any response to this question, resetting the value back to its initial state.protected static boolean
equal(java.lang.String[] s1, java.lang.String[] s2)
Compare two string arrays for equality.protected static boolean
equal(java.lang.String s1, java.lang.String s2)
Compare two strings for equality.java.lang.String[]
getDefaultValue()
Get the default response for this question.java.lang.String
getStringValue()
Get the response to this question as a string.java.lang.String[]
getValue()
Get the current (default or latest) response to this question.java.lang.String[]
getValueOnPath()
Verify this question is on the current path, and if it is, return the current value.boolean
isDuplicatesAllowed()
Check whether or not duplicates should be allowed in the list.boolean
isValueAlwaysValid()
Check if the question always has a valid response.boolean
isValueValid()
Check if the question currently has a valid response.protected void
load(java.util.Map data)
Load the value for this question from a dictionary, using the tag as the key.protected void
save(java.util.Map data)
Save the value for this question in a dictionary, using the tag as the key.void
setDefaultValue(java.lang.String[] v)
Set the default response for this question, used by the clear method.void
setDuplicatesAllowed(boolean b)
Specify whether or not duplicates should be allowed in the list.void
setValue(java.lang.String s)
Set the response to this question to the value represented by a string-valued argument.void
setValue(java.lang.String[] newValue)
Set the current value.protected static java.lang.String[]
split(java.lang.String s)
Split a string into a set of newline-separated strings.-
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
-
StringListQuestion
protected StringListQuestion(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
-
getDefaultValue
public java.lang.String[] getDefaultValue()
Get the default response for this question.- Returns:
- the default response for this question.
- See Also:
setDefaultValue(java.lang.String[])
,clear()
-
setDefaultValue
public void setDefaultValue(java.lang.String[] v)
Set the default response for this question, used by the clear method.- Parameters:
v
- the default response for this question.- See Also:
getDefaultValue()
,clear()
-
setDuplicatesAllowed
public void setDuplicatesAllowed(boolean b)
Specify whether or not duplicates should be allowed in the list. By default, duplicates are allowed.- Parameters:
b
- true if duplicates should be allowed, and false otherwise- See Also:
isDuplicatesAllowed()
-
isDuplicatesAllowed
public boolean isDuplicatesAllowed()
Check whether or not duplicates should be allowed in the list.- Returns:
- true if duplicates should be allowed, and false otherwise
- See Also:
setDuplicatesAllowed(boolean)
-
getValue
public java.lang.String[] getValue()
Get the current (default or latest) response to this question.- Returns:
- The current value.
- See Also:
setValue(java.lang.String)
-
getValueOnPath
public java.lang.String[] getValueOnPath() throws Interview.NotOnPathFault
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:
getValue()
-
getStringValue
public java.lang.String getStringValue()
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:
setValue(String)
-
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.
-
setValue
public void setValue(java.lang.String s)
Description copied from class:Question
Set the response to this question to the value represented by a string-valued argument. Subtypes of Question will typically have type-specific methods to set the value as well.- Specified by:
setValue
in classQuestion
- Parameters:
s
- A string containing a value value appropriate for the particular type of question whose value is being set.- See Also:
Question.getStringValue()
-
setValue
public void setValue(java.lang.String[] newValue)
Set the current value.- Parameters:
newValue
- The value to be set.- See Also:
getValue()
-
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 data)
Load the value for this question from a dictionary, using the tag as the key.
-
save
protected void save(java.util.Map data)
Save the value for this question in a dictionary, using the tag as the key.
-
equal
protected static boolean equal(java.lang.String[] s1, java.lang.String[] s2)
Compare two string arrays for equality.- Parameters:
s1
- the first array to be compared, or nulls2
- the other array to be compared, or null- Returns:
- true if both parameters are null, or if both are non-null and are element-wise equal.
- See Also:
equal(String, String)
-
equal
protected static boolean equal(java.lang.String s1, java.lang.String s2)
Compare two strings for equality.- Parameters:
s1
- the first string to be compared, or nulls2
- the other string to be compared, or null- Returns:
- true if both parameters are null, or if both are non-null and equal.
-
split
protected static java.lang.String[] split(java.lang.String s)
Split a string into a set of newline-separated strings.- Parameters:
s
- The string to be split, or null- Returns:
- an array of strings containing the newline-separated substrings of the argument.
-
-