public abstract class PropertiesQuestion extends CompositeQuestion
question
which consists of many key-value pairs. The
values are altered by the user, the key is immutable. The output of this
question is a Properties object. The key in the properties object is always
the internal name, not the internationalized name. If internationalized
key names are supplied, they are used only for presentation.
The presentation info is store here instead of in a renderer class because
multiple clients need to render this question.Modifier and Type | Class and Description |
---|---|
static class |
PropertiesQuestion.BooleanConstraints
Constraints allowing a value to be either a boolean or Yes/No response.
|
static class |
PropertiesQuestion.FilenameConstraints
Constrains the response to filenames or paths, and allows chooser
widgets to be rendered for the user when appropriate.
|
static class |
PropertiesQuestion.FloatConstraints
Constraints specifying a floating point type.
|
static class |
PropertiesQuestion.IntConstraints |
static class |
PropertiesQuestion.StringConstraints
Value restrictions for string type responses.
|
static class |
PropertiesQuestion.ValueConstraints |
Modifier and Type | Field and Description |
---|---|
protected java.util.Properties |
value
The current (default or latest) response to this question.
|
Modifier | Constructor and Description |
---|---|
protected |
PropertiesQuestion(Interview interview,
java.lang.String tag)
Create a question with a nominated tag.
|
protected |
PropertiesQuestion(Interview interview,
java.lang.String tag,
java.util.Properties props)
Create a question with a nominated tag.
|
protected |
PropertiesQuestion(Interview interview,
java.lang.String tag,
java.lang.String[] keys)
Create a question with a nominated tag.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear any response to this question, resetting the value
back to its initial state.
|
void |
createGroup(java.lang.String name)
Create a new group.
|
java.lang.String |
getConstraintKeyFromRow(java.lang.Object[] values)
Calculates constraint key for table row.
|
PropertiesQuestion.ValueConstraints |
getConstraints(java.lang.String key) |
java.util.Properties |
getDefaultValue()
Get the default response for this question.
|
java.lang.String[][] |
getGroup(java.lang.String group)
Get the keys which are registered with the given group.
|
java.lang.String |
getGroupDisplayName(java.lang.String group)
Get the display (localized) name of the group.
|
java.lang.String[] |
getGroups()
Get the names of the groups being used by the current set of values.
|
java.lang.String[][] |
getInvalidKeys()
Get the keys which are currently invalid and blocking the question
(getNext() returning null).
|
java.lang.String |
getKeyHeaderName()
Get the header string for the column in the table that contains the
key names.
|
java.util.Enumeration |
getKeys()
Get the set of keys currently used this question.
|
java.lang.String |
getStringValue()
Get the response to this question as a string.
|
java.lang.String[][] |
getUngrouped() |
java.util.Properties |
getValue()
Get the current (default or latest) response to this question.
|
java.lang.String |
getValueHeaderName()
Get the header string for the column in the table that contains the
value names.
|
java.util.Properties |
getValueOnPath()
Verify this question is on the current path, and if it is,
return the current value.
|
boolean |
isEntryVisible(java.lang.String key)
Determine if the given property is visible to the user.
|
boolean |
isReadOnlyValue(java.lang.String key)
Determine if a value is read-only.
|
boolean |
isValueAlwaysValid()
Check if the question always has a valid response.
|
boolean |
isValueValid()
Check if the question currently has a valid response.
|
java.lang.String |
isValueValid(java.lang.String key)
Convenience method for finding out the status of a particular value.
|
protected void |
load(java.util.Map data)
Load the value for this question from a dictionary, using
the tag as the key.
|
protected static java.util.Properties |
load(java.lang.String s) |
protected void |
save(java.util.Map data)
Save the value for this question in a dictionary, using
the tag as the key.
|
void |
setConstraints(java.lang.String key,
PropertiesQuestion.ValueConstraints c)
Apply constraints to a value.
|
void |
setDefaultValue(java.util.Properties props)
Set the default response for this question,
used by the clear method.
|
void |
setGroup(java.lang.String group,
java.lang.String key)
Set the presentation group to which the key(s) should belong.
|
void |
setGroup(java.lang.String group,
java.lang.String[] keys) |
protected void |
setKeys(java.lang.String[] keys,
boolean localize)
Set the keys to be shown in the properties table.
|
protected void |
setProperties(java.util.Properties props)
The current value will be set to all false;
|
void |
setValue(java.util.Properties props)
Private because we need to maintain internal consistency, especially with
the i18n info.
|
void |
setValue(java.lang.String newValue)
Set the current value.
|
void |
setValue(java.lang.String key,
java.lang.String v)
Set a specific property within this question.
|
void |
updateProperties(java.lang.String[][] props)
Update the given properties.
|
void |
updateProperty(java.lang.String key,
java.lang.String val)
Update the given property.
|
addMarker, equals, export, getChecklistItems, getHelpID, getImage, getInterview, getKey, getNext, getResourceString, getResourceString, getSummary, getTag, getText, getTextArgs, hashCode, hasMarker, isEnabled, isHidden, reload, removeMarker, setImage, setImage, setSummary, setText
protected java.util.Properties value
protected PropertiesQuestion(Interview interview, java.lang.String tag)
interview
- The interview containing this question.tag
- A unique tag to identify this specific question.protected PropertiesQuestion(Interview interview, java.lang.String tag, java.util.Properties props)
interview
- The interview containing this question.tag
- A unique tag to identify this specific question.props
- The literal keys and values. A shallow copy of this is used.java.lang.NullPointerException
- if choices is nullprotected PropertiesQuestion(Interview interview, java.lang.String tag, java.lang.String[] keys)
interview
- The interview containing this question.tag
- A unique tag to identify this specific question.keys
- Internal name of the keysjava.lang.NullPointerException
- if choices is nullprotected void setProperties(java.util.Properties props)
props
- The set of names for the choices for this question.java.lang.NullPointerException
- if choices is nullgetValue()
protected void setKeys(java.lang.String[] keys, boolean localize)
keys
- The set of names of the choices for this question.localize
- if false, the choices will be used directly
as the display choices; otherwise the choices will be used
to construct keys to get localized values from the interview's
resource bundle.java.lang.NullPointerException
- if choices is nullgetKeys()
public java.util.Enumeration getKeys()
setKeys(java.lang.String[], boolean)
public java.util.Properties getDefaultValue()
setDefaultValue(java.util.Properties)
public void setDefaultValue(java.util.Properties props)
props
- the default response for this question.getDefaultValue()
public java.util.Properties getValue()
java.lang.IllegalStateException
- if no choices have been set, defining
the set of responses to this questionsetValue(java.lang.String)
public java.util.Properties getValueOnPath() throws Interview.NotOnPathFault
Interview.NotOnPathFault
- if this question is not on the
current pathgetValue()
public java.lang.String getStringValue()
Question
getStringValue
in class Question
Question.setValue(String)
public void setValue(java.lang.String newValue)
setValue
in class Question
newValue
- Value represented as a single string. May not be null. May be
an empty string.getValue()
public void setValue(java.lang.String key, java.lang.String v) throws Interview.Fault
setValue
in class CompositeQuestion
key
- the key of the property to set, must not be nullv
- the new value for the property, must not be nullInterview.Fault
- if the key does not already exist
in the question's value.java.lang.NullPointerException
- if either parameter is nullInterview.Fault
- if the specified key does not exist in the questionQuestion.getStringValue()
public boolean isValueValid()
Question
isValueValid
in class Question
public boolean isValueAlwaysValid()
Question
isValueAlwaysValid
in class Question
public void clear()
protected void load(java.util.Map data)
protected static java.util.Properties load(java.lang.String s)
protected void save(java.util.Map data)
public boolean isReadOnlyValue(java.lang.String key)
public boolean isEntryVisible(java.lang.String key)
public java.lang.String[][] getInvalidKeys()
public final java.lang.String isValueValid(java.lang.String key)
key
- The key to query. Must not be null.getInvalidKeys()
public void setValue(java.util.Properties props)
public void updateProperties(java.lang.String[][] props)
props
- Properties to update, keys in first index, values in the second.java.lang.IllegalArgumentException
- If a property in props
does not
exist.public void updateProperty(java.lang.String key, java.lang.String val)
key
- Property to update.val
- Value for the property.java.lang.IllegalArgumentException
- If the property does not exist.public void createGroup(java.lang.String name)
java.lang.IllegalStateException
- If the group requested already exists.public void setGroup(java.lang.String group, java.lang.String key)
group
- internal name for the group. Internationalized version
must be available in the resource bundle as tag+group.key
- Which keys to add to the group.java.lang.IllegalArgumentException
- If an attempt is made to add to a group which
does not exist.java.lang.IllegalStateException
- If an attempt is made to group a key which is not
present.createGroup(java.lang.String)
public void setGroup(java.lang.String group, java.lang.String[] keys)
public java.lang.String[] getGroups()
setGroup(String,String)
,
setGroup(String,String[])
public java.lang.String[][] getGroup(java.lang.String group)
group
- Group name to query. Null returns the groupless keys.getGroups()
,
setGroup(java.lang.String, java.lang.String)
public java.lang.String[][] getUngrouped()
getGroup(java.lang.String)
,
setGroup(java.lang.String, java.lang.String)
public java.lang.String getGroupDisplayName(java.lang.String group)
jck.qTable.basic.group
and
jck.qTable.advanced.group
.group
- The internal group name, as is used in the rest of this API.public java.lang.String getKeyHeaderName()
public java.lang.String getValueHeaderName()
public void setConstraints(java.lang.String key, PropertiesQuestion.ValueConstraints c)
java.lang.IllegalArgumentException
- If the key supplied does not
exist in the current data.PropertiesQuestion.ValueConstraints
,
PropertiesQuestion.IntConstraints
,
PropertiesQuestion.FloatConstraints
,
PropertiesQuestion.BooleanConstraints
public java.lang.String getConstraintKeyFromRow(java.lang.Object[] values)
values
- Array of table row datapublic PropertiesQuestion.ValueConstraints getConstraints(java.lang.String key)
key
- The key for the value to get constraints for.Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.