|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.prompts.PromptValues
public class PromptValues
PromptValues is the default implementation of the PromptValuesInterface. It fully implements the interface with a Map-based storage or the prompt values. The purpose of the PromptValues object is to hold the current values of the prompts in a PromptGroup.
PromptValuesInterface
,
PromptGroupInterface
,
PromptGroup
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
_SAS_INTERNAL_ORDER_UNIMPORTANT
This flag is used for user info set on the prompt values object. |
static java.lang.String |
PROMPT_VALUES_XML_WRITE_ALL_DEFINITIONS
|
static java.lang.String |
RB_KEY
|
static java.lang.String |
UNSET
|
Constructor Summary | |
---|---|
PromptValues()
Constructs a PromptValues object which is associated with an empty PromptGroup. |
|
PromptValues(java.util.List promptDefinitions,
com.sas.prompts.PromptUserContextInterface userContext)
Constructs a PromptValues object which is associated with a new PromptGroup containing the specified PromptDefinitions. |
|
PromptValues(PromptGroupInterface promptGroup)
Constructs a PromptValues object which is associated with the specified PromptGroup. |
|
PromptValues(PromptGroupInterface promptGroup,
com.sas.prompts.PromptUserContextInterface userContext)
Constructs a PromptValues object which is associated with the specified PromptGroup. |
Method Summary | |
---|---|
void |
acceptPromptValuesVisitor(PromptValuesVisitorInterface visitor)
Accept method for visitor object (see visitor pattern) which passes the visitor on to any delegate PromptValues objects. |
void |
addPromptValueChangeListener(PromptValueChangeListener listener)
Adds a listener which is notified when a prompt value changes. |
void |
addPromptValuesDelegate(PromptValuesInterface promptValues)
Adds a PromptValuesInterface as a delegate to this PromptValues. |
void |
clearPromptValue(PromptDefinitionInterface promptDefinition)
Clears a prompt value which has previously been set. |
void |
clearPromptValuesDelegates()
Removes all delegates from this PromptValues. |
void |
consumeAttributes(com.sas.util.xmlpersist.AttributesProvider provider)
Internal persistence method |
void |
consumeRelatedObjects(com.sas.util.xmlpersist.RelatedObjectListsHolder roHolder)
Internal persistence method |
PromptValuesInterface |
findPromptValuesForPromptDefinition(PromptDefinitionInterface promptDefinition)
Recursively finds the PromptValues object which holds the PromptGroup which contains the specified PromptDefinition. |
protected void |
getAllWritableValues(java.util.List allDefinitionReferences)
Internal persistence method |
java.lang.String |
getDefinitionElementName()
Internal persistence method |
com.sas.util.MutableUserInfoInterface |
getMutableUserInfo()
Returns a MutableUserInfoInterface implementation which can be used by creators and consumers of PromptValues to store custom information on the PromptValues object. |
PromptDefinitionInterface |
getPromptDefinition(java.lang.String promptName,
boolean recursive)
Returns the PromptDefinition of the given name from the PromptGroup held by the PromptValues object. |
PromptGroupInterface |
getPromptGroup()
Returns the prompt group associated with this PromptValues object which defines the prompts and constraints. |
com.sas.prompts.PromptUserContextInterface |
getPromptUserContext()
Returns the user context used to store sticky default values. |
java.lang.Object |
getPromptValue(PromptDefinitionInterface promptDefinition)
Returns the current value of the prompt if there is one. |
java.util.Date |
getPromptValueAsDate(PromptDefinitionInterface promptDefinition)
Return a prompt value as a Date. |
double |
getPromptValueAsDouble(PromptDefinitionInterface promptDefinition)
Return a prompt value as a double. |
int |
getPromptValueAsInt(PromptDefinitionInterface promptDefinition)
Return a prompt value as an int. |
java.util.List |
getPromptValueAsList(PromptDefinitionInterface promptDefinition)
Return a prompt value as a List. |
java.lang.String |
getPromptValueAsString(PromptDefinitionInterface promptDefinition)
Return a prompt value as a String. |
java.lang.String |
getPromptValueAsString(PromptDefinitionInterface promptDefinition,
java.util.Locale locale)
Returns a localized string representation of the specified prompt value. |
PromptValueChangeListener[] |
getPromptValueChangeListeners()
Returns an array of all the PromptValueChangeListener s added to this PromptValues with addPromptValuesChangeListener(). |
java.util.Map |
getPromptValues()
Returns a Map of all the prompt definitions to their values. |
java.util.Map |
getPromptValues(PromptGroupInterface promptGroup,
boolean recursive,
boolean includeDefaultAndStickyValues)
TBD This method is not implemented and always returns null. |
java.util.List |
getPromptValuesDelegates()
Returns a list of delegates for the PromptValues. |
protected java.util.List |
getWritableCombinations()
Internal persistence method |
protected java.util.List |
getWritableValues()
Internal persistence method |
void |
init(java.util.Map options)
When called, this method will check all the definitions that have a value provider that implement the ValueProviderInitializationInterface and will call initialize method on each value provider with the options passed in. |
boolean |
isAllPromptValuesValid()
Returns whether the current value of all prompts are valid. |
boolean |
isAllRequiredPromptsValid()
Returns whether the current value of all required prompts are valid. |
boolean |
isPromptValueAvailable(PromptDefinitionInterface promptDefinition)
Returns true is the prompt has either a value set, a sticky value or a default value, false otherwise. |
boolean |
isPromptValueMissing(PromptDefinitionInterface promptDefinition)
Returns whether the specified prompt value is a missing value. |
boolean |
isPromptValueSet(PromptDefinitionInterface promptDefinition)
Returns whether the prompt value is set. |
boolean |
isPromptValueValid(PromptDefinitionInterface promptDefinition)
Returns whether the current value of the specified prompt is valid. |
void |
removePromptValueChangeListener(PromptValueChangeListener listener)
Removes a listener previously added with addPromptValueChangeListener. |
void |
removePromptValuesDelegate(PromptValuesInterface promptValues)
Removes a PromptValuesInterface as a delegate from this PromptValues. |
void |
setInitParameter(java.lang.String key,
java.lang.Object value)
When called, this method will check all the definitions that have a value provider that implement the ValueProviderInitializationInterface and will call initialize method on each value provider with the key-value pair passed in. |
void |
setPromptGroup(PromptGroupInterface promptGroup,
boolean clearValuesNotInGroup)
Sets the PromptGroup associated with this PromptValues object. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
java.util.Date value)
Sets the prompt value to a date value. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
double value)
Sets the prompt value to a double value. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
int value)
Sets the prompt value to an integer value. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
java.util.List value)
Sets the prompt value to a collection of values. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
java.lang.Object value)
Sets the prompt value. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
java.lang.Object value,
java.util.Locale inputLocale)
Sets the value for the prompt. |
void |
setPromptValue(PromptDefinitionInterface promptDefinition,
java.lang.String value)
Sets the prompt value to a String value. |
void |
setPromptValues(java.util.Map definitionToValueMap,
java.util.Locale inputLocale)
Sets one or more of prompt values at the same time. |
protected void |
writeDefinition(org.w3c.dom.Element element,
com.sas.util.xmlpersist.PromptsWritingContext writingContext)
Internal persistence method |
Field Detail |
---|
public static final java.lang.String RB_KEY
public static final java.lang.String PROMPT_VALUES_XML_WRITE_ALL_DEFINITIONS
public static final java.lang.String _SAS_INTERNAL_ORDER_UNIMPORTANT
public static final java.lang.String UNSET
Constructor Detail |
---|
public PromptValues()
public PromptValues(PromptGroupInterface promptGroup)
promptGroup
- The PromptGroup to associate with this PromptValues.public PromptValues(PromptGroupInterface promptGroup, com.sas.prompts.PromptUserContextInterface userContext)
promptGroup
- The PromptGroup to associate with this PromptValues.userContext
- May be null. This parameter is currently not used.public PromptValues(java.util.List promptDefinitions, com.sas.prompts.PromptUserContextInterface userContext)
promptDefinitions
- A List of PromptDefinitions to create a PromptGroup with.userContext
- May be null. This parameter is currently not used.Method Detail |
---|
public void init(java.util.Map options)
init
in interface PromptValuesInterface
options
- a map of options, see the ValueProviderInitializationInterface for more detailspublic void setInitParameter(java.lang.String key, java.lang.Object value)
setInitParameter
in interface PromptValuesInterface
key
- value
- public PromptGroupInterface getPromptGroup()
getPromptGroup
in interface PromptValuesInterface
PromptValuesInterface.getPromptGroup()
public void setPromptGroup(PromptGroupInterface promptGroup, boolean clearValuesNotInGroup)
setPromptGroup
in interface PromptValuesInterface
promptGroup
- The PromptGroup associated with this PromptValues objectclearValuesNotInGroup
- Whether to clear the value
of all PromptDefinitions previously set on the PromptValues which are not in the new PromptGroup.getPromptGroup()
public com.sas.prompts.PromptUserContextInterface getPromptUserContext()
public java.lang.Object getPromptValue(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
getPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to return the value of.
PromptValueNotFoundException
PromptValuesInterface.getPromptValue(PromptDefinitionInterface)
public int getPromptValueAsInt(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
getPromptValueAsInt
in interface PromptValuesInterface
promptDefinition
- The definition to return the value of
PromptValueNotFoundException
public double getPromptValueAsDouble(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
getPromptValueAsDouble
in interface PromptValuesInterface
promptDefinition
- The definition to return the value of
PromptValueNotFoundException
public java.lang.String getPromptValueAsString(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
getPromptValueAsString
in interface PromptValuesInterface
promptDefinition
- The definition to return the value of
PromptValueNotFoundException
public java.util.Date getPromptValueAsDate(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
getPromptValueAsDate
in interface PromptValuesInterface
promptDefinition
- The definition to return the value of
PromptValueNotFoundException
public java.util.List getPromptValueAsList(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
getPromptValueAsList
in interface PromptValuesInterface
promptDefinition
- The definition to return the value of
PromptValueNotFoundException
public boolean isPromptValueMissing(PromptDefinitionInterface promptDefinition) throws PromptValueNotFoundException
promptDefinition
- The definition to check for a missing value
PromptValueNotFoundException
public void setPromptValue(PromptDefinitionInterface promptDefinition, java.util.List value) throws InvalidPromptValueException
setPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt
InvalidPromptValueException
PromptValuesInterface.setPromptValue(PromptDefinitionInterface, List)
public void setPromptValue(PromptDefinitionInterface promptDefinition, java.lang.String value) throws InvalidPromptValueException
setPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt
InvalidPromptValueException
PromptValuesInterface.setPromptValue(PromptDefinitionInterface, String)
public void setPromptValue(PromptDefinitionInterface promptDefinition, java.util.Date value) throws InvalidPromptValueException
setPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt
InvalidPromptValueException
PromptValuesInterface.setPromptValue(PromptDefinitionInterface, Date)
public void setPromptValue(PromptDefinitionInterface promptDefinition, double value) throws InvalidPromptValueException
setPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt
InvalidPromptValueException
PromptValuesInterface.setPromptValue(PromptDefinitionInterface, double)
public void setPromptValue(PromptDefinitionInterface promptDefinition, int value) throws InvalidPromptValueException
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt
InvalidPromptValueException
com.sas.prompts.PromptValuesInterface#setPromptValue(PromptDefinitionInterface, int)
public void setPromptValue(PromptDefinitionInterface promptDefinition, java.lang.Object value) throws InvalidPromptValueException
setPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt
InvalidPromptValueException
PromptValuesInterface.setPromptValue(PromptDefinitionInterface, Object)
public void setPromptValue(PromptDefinitionInterface promptDefinition, java.lang.Object value, java.util.Locale inputLocale) throws InvalidPromptValueException
clearPromptValue(PromptDefinitionInterface)
method will get called.
If the prompt definition is the definition associated with the ModalGroupInterface, then all prompt definitions
on each ModalChoiceGroupInterface will get their value cleared. If the value for the prompt is invalid, an
InvalidPromptValueException
will be thrown. #setPromptValueValid(PromptDefinitionInterface, boolean, Map)
will get called with a true paramter
if the value is valid, false otherwise. A PromptValudChangeEvent will be thrown after the value has been set.
setPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to set the value ofvalue
- The new value of the prompt, null to clear the value for the promptinputLocale
- The locale that the prompt value was input in
InvalidPromptValueException
- Will be thrown if the value for the prompt is invalid for any reason
java.lang.IllegalArgumentException
- Will be thrown if the prompt values object that contains the given prompt definition cannot be found.PromptValuesInterface.setPromptValue(PromptDefinitionInterface, Object, Locale)
public java.lang.String getPromptValueAsString(PromptDefinitionInterface promptDefinition, java.util.Locale locale) throws PromptValueNotFoundException
getPromptValueAsString
in interface PromptValuesInterface
promptDefinition
- The prompt to return the value oflocale
- The locale to format the value to
PromptValueNotFoundException
PromptValuesInterface.getPromptValueAsString(PromptDefinitionInterface, Locale)
public boolean isPromptValueSet(PromptDefinitionInterface promptDefinition)
isPromptValueSet
in interface PromptValuesInterface
promptDefinition
- The prompt to check for a value
clearPromptValue
public boolean isPromptValueAvailable(PromptDefinitionInterface promptDefinition)
isPromptValueAvailable
in interface PromptValuesInterface
promptDefinition
- The prompt to query whether its value is available
PromptValuesInterface.isPromptValueAvailable(PromptDefinitionInterface)
public void clearPromptValue(PromptDefinitionInterface promptDefinition)
clearPromptValue
in interface PromptValuesInterface
promptDefinition
- The prompt to clear the value ofPromptValuesInterface.clearPromptValue(PromptDefinitionInterface)
public java.util.Map getPromptValues(PromptGroupInterface promptGroup, boolean recursive, boolean includeDefaultAndStickyValues)
getPromptValues
in interface PromptValuesInterface
promptGroup
- PromptGroupInterfacerecursive
- booleanincludeDefaultAndStickyValues
- boolean
PromptValuesInterface.getPromptValues(PromptGroupInterface, boolean, boolean)
public java.util.Map getPromptValues()
getPromptValues
in interface PromptValuesInterface
PromptValuesInterface.getPromptValues()
public void setPromptValues(java.util.Map definitionToValueMap, java.util.Locale inputLocale) throws InvalidPromptValueException
setPromptValues
in interface PromptValuesInterface
definitionToValueMap
- A Map containing the PromptDefinitionInterface and values of the prompts to set the value of.inputLocale
- The locale that the values were entered in.
InvalidPromptValueException
PromptValuesInterface.setPromptValues(Map, Locale)
public com.sas.util.MutableUserInfoInterface getMutableUserInfo()
getMutableUserInfo
in interface PromptValuesInterface
com.sas.prompts.definitions.PromptDefinitionInterface#getMutableUserInfo()
public void addPromptValueChangeListener(PromptValueChangeListener listener)
addPromptValueChangeListener
in interface PromptValuesInterface
listener
- This listener to receive the eventPromptValuesInterface.addPromptValueChangeListener(PromptValueChangeListener)
public void removePromptValueChangeListener(PromptValueChangeListener listener)
removePromptValueChangeListener
in interface PromptValuesInterface
listener
- The listener which will no longer receive the eventPromptValuesInterface.removePromptValueChangeListener(PromptValueChangeListener)
public PromptValueChangeListener[] getPromptValueChangeListeners()
PromptValueChangeListener
s added to this PromptValues with addPromptValuesChangeListener().
getPromptValueChangeListeners
in interface PromptValuesInterface
PromptValueChangeListener
s added or an empty array if no listeners have been addedpublic boolean isPromptValueValid(PromptDefinitionInterface promptDefinition)
isPromptValueValid
in interface PromptValuesInterface
The
- prompt whose value should be checked for validity
PromptValuesInterface.isPromptValueValid(PromptDefinitionInterface)
public boolean isAllPromptValuesValid()
isAllPromptValuesValid
in interface PromptValuesInterface
PromptValuesInterface.isAllPromptValuesValid()
public boolean isAllRequiredPromptsValid()
isAllRequiredPromptsValid
in interface PromptValuesInterface
PromptValuesInterface.isAllRequiredPromptsValid()
public PromptDefinitionInterface getPromptDefinition(java.lang.String promptName, boolean recursive)
getPromptDefinition
in interface PromptValuesInterface
promptName
- The name of the prompt to return the PromptDefinition for.recursive
- Whether to search subgroups for the specified prompt.
com.sas.prompts.PromptValuesInterface#getPromptDefinition(String)
public void clearPromptValuesDelegates()
clearPromptValuesDelegates
in interface PromptValuesInterface
public void addPromptValuesDelegate(PromptValuesInterface promptValues)
addPromptValuesDelegate
in interface PromptValuesInterface
promptValues
- The delegate to also use to store and retrieve values from.PromptValuesInterface.addPromptValuesDelegate(PromptValuesInterface)
public void removePromptValuesDelegate(PromptValuesInterface promptValues)
removePromptValuesDelegate
in interface PromptValuesInterface
promptValues
- The delegate to no longer store and retrieve values fromcom.sas.prompts.PromptValuesInterface#removePromptValuesDelegate(PromptValues)
public java.util.List getPromptValuesDelegates()
getPromptValuesDelegates
in interface PromptValuesInterface
PromptValuesInterface.getPromptValuesDelegates()
public PromptValuesInterface findPromptValuesForPromptDefinition(PromptDefinitionInterface promptDefinition)
findPromptValuesForPromptDefinition
in interface PromptValuesInterface
promptDefinition
- The PromptDefinitionInterface to find the PromptValues for.
PromptValuesInterface.findPromptValuesForPromptDefinition(PromptDefinitionInterface)
public void acceptPromptValuesVisitor(PromptValuesVisitorInterface visitor)
acceptPromptValuesVisitor
in interface PromptValuesInterface
visitor
- PromptValuesVisitorInterfacePromptValuesInterface.acceptPromptValuesVisitor(PromptValuesVisitorInterface)
public java.lang.String getDefinitionElementName()
getDefinitionElementName
in interface com.sas.util.xmlpersist.PersistenceInterface
getDefinitionElementName
in class com.sas.util.xmlpersist.impl.BaseAbstractPersistence
public void consumeRelatedObjects(com.sas.util.xmlpersist.RelatedObjectListsHolder roHolder) throws org.xml.sax.SAXException
consumeRelatedObjects
in interface com.sas.util.xmlpersist.PersistenceInterface
consumeRelatedObjects
in class com.sas.util.xmlpersist.impl.BaseAbstractPersistence
org.xml.sax.SAXException
public void consumeAttributes(com.sas.util.xmlpersist.AttributesProvider provider)
consumeAttributes
in interface com.sas.util.xmlpersist.PersistenceInterface
consumeAttributes
in class com.sas.util.xmlpersist.impl.BaseAbstractPersistence
protected void writeDefinition(org.w3c.dom.Element element, com.sas.util.xmlpersist.PromptsWritingContext writingContext) throws java.util.prefs.BackingStoreException
writeDefinition
in class com.sas.util.xmlpersist.impl.BaseAbstractPersistence
java.util.prefs.BackingStoreException
protected java.util.List getWritableValues()
protected void getAllWritableValues(java.util.List allDefinitionReferences)
protected java.util.List getWritableCombinations()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |