com.sas.prompts.definitions
Class PromptDefinition

com.sas.prompts.definitions.PromptDefinition
All Implemented Interfaces:
com.sas.models.VersionInterface, com.sas.prompts.definitions.HintableDefinitionInterface, com.sas.prompts.definitions.HintableDefinitionV2Interface, com.sas.prompts.definitions.MutableHintableDefinitionInterface, com.sas.prompts.definitions.MutableHintableDefinitionV2Interface, com.sas.prompts.definitions.MutablePromptDefinitionInterface, com.sas.prompts.definitions.MutablePromptDefinitionV2Interface, com.sas.prompts.definitions.MutablePromptDefinitionV3Interface, PromptDefinitionInterface, com.sas.prompts.definitions.PromptDefinitionV2Interface, com.sas.prompts.definitions.PromptDefinitionV3Interface, com.sas.prompts.IdentifiablePromptInterface, com.sas.prompts.MutableIdentifiablePromptInterface, com.sas.prompts.MutablePromptHelpInterface, com.sas.prompts.PromptHelpInterface, com.sas.PublicClonable, com.sas.storage.editableproperties.LocalizableProperties, com.sas.storage.editableproperties.MultiLocaleProperties, com.sas.uiconfig.ContextEnabledObject, com.sas.util.AttributeConfigurationInterface, com.sas.util.AttributeDescription, com.sas.util.log.ComponentLogFactoryInterface, com.sas.util.macrovar.MacroVariableOptionInterface, com.sas.util.macrovar.MutableMacroVariableOptionInterface, com.sas.util.ResourceReferencesInterface, com.sas.util.xmlpersist.PersistenceInterface, java.io.Externalizable, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
BaseDefinitionRange, BaseFileDefinition, ColorDefinition, DataSourceColumnDefinition, DataSourceDefinition, DateDefinition, DoubleDefinition, IntegerDefinition, SASLibraryDefinition, TextDefinition

public abstract class PromptDefinition
implements com.sas.prompts.definitions.MutablePromptDefinitionV3Interface, java.lang.Cloneable, com.sas.PublicClonable, com.sas.storage.editableproperties.MultiLocaleProperties, com.sas.uiconfig.ContextEnabledObject

Base class for implementing the PromptDefinitionInterface. It provides basic functionality common to all subclasses.

See Also:
Serialized Form

Field Summary
static java.lang.String RB_KEY
           
 
Fields inherited from interface com.sas.prompts.definitions.PromptDefinitionInterface
PROMPT_VALIDATION_ERROR_ABOVE_MAXIMUM, PROMPT_VALIDATION_ERROR_ABOVE_MAXIMUM_DECIMAL_PLACES, PROMPT_VALIDATION_ERROR_ABOVE_MAXIMUM_LENGTH, PROMPT_VALIDATION_ERROR_ABOVE_MAXIMUM_LINES, PROMPT_VALIDATION_ERROR_ABOVE_MAXIMUM_VALUE_COUNT, PROMPT_VALIDATION_ERROR_BELOW_MINIMUM, PROMPT_VALIDATION_ERROR_BELOW_MINIMUM_LENGTH, PROMPT_VALIDATION_ERROR_BELOW_MINIMUM_VALUE_COUNT, PROMPT_VALIDATION_ERROR_DATA_SOURCE_COLUMN_TYPE_NOT_ALLOWED, PROMPT_VALIDATION_ERROR_DATA_SOURCE_CONTAINS_NO_DATA_ITEMS, PROMPT_VALIDATION_ERROR_DATA_SOURCE_NOT_AVAILABLE, PROMPT_VALIDATION_ERROR_DATA_SOURCE_TYPE_NOT_ALLOWED, PROMPT_VALIDATION_ERROR_EMPTY_STATIC_LIST_AND_REQUIRED_WITH_NO_ADDITIONAL_VALUES_ALLOWED, PROMPT_VALIDATION_ERROR_ERROR_LOADING_SHARED_PROMPT, PROMPT_VALIDATION_ERROR_FILE_TYPE_NOT_ALLOWED, PROMPT_VALIDATION_ERROR_FROM_SCRIPT, PROMPT_VALIDATION_ERROR_INCORRECT_RELATIVE_DATE_VALUE, PROMPT_VALIDATION_ERROR_INPUT_DOES_NOT_MATCH_PATTERN, PROMPT_VALIDATION_ERROR_INVALID_INPUT_PATTERN, PROMPT_VALIDATION_ERROR_LOWER_RANGE_VALUE_ABOVE_MAXIMUM, PROMPT_VALIDATION_ERROR_LOWER_RANGE_VALUE_ABOVE_MAXIMUM_LENGTH, PROMPT_VALIDATION_ERROR_LOWER_RANGE_VALUE_ABOVE_UPPER_RANGE_VALUE, PROMPT_VALIDATION_ERROR_LOWER_RANGE_VALUE_BELOW_MINIMUM, PROMPT_VALIDATION_ERROR_LOWER_RANGE_VALUE_BELOW_MINIMUM_LENGTH, PROMPT_VALIDATION_ERROR_MASKED_HIDDEN_REQUIRED, PROMPT_VALIDATION_ERROR_MAX_DECIMAL_PLACES_ABOVE_MAX_PERCISION, PROMPT_VALIDATION_ERROR_MAXIMUM_LENGTH_BELOW_ZERO, PROMPT_VALIDATION_ERROR_MIN_DECIMAL_PLACES_ABOVE_MAX_PERCISION, PROMPT_VALIDATION_ERROR_MINIMUM_ABOVE_MAXIMUM, PROMPT_VALIDATION_ERROR_MINIMUM_ABOVE_MAXIMUM_DECIMAL_PLACES, PROMPT_VALIDATION_ERROR_MINIMUM_ABOVE_MAXIMUM_LENGTH, PROMPT_VALIDATION_ERROR_MINIMUM_ABOVE_MAXIMUM_VALUE_COUNT, PROMPT_VALIDATION_ERROR_MINIMUM_LENGTH_ABOVE_MAXIMUM_LENGTH, PROMPT_VALIDATION_ERROR_MINIMUM_LENGTH_BELOW_ZERO, PROMPT_VALIDATION_ERROR_MORE_THAN_ONE_SPECIAL_VALUE_SPECIFIED, PROMPT_VALIDATION_ERROR_MULTIPLE_DATA_SOURCES_NOT_ALLOWED, PROMPT_VALIDATION_ERROR_NO_DATA_SOURCE, PROMPT_VALIDATION_ERROR_NON_EDITABLE_REQUIRED_WITH_NO_DEFAULT_NOT_ALLOWED, PROMPT_VALIDATION_ERROR_NOT_VALID_OBJECT, PROMPT_VALIDATION_ERROR_ONLY_DIRECTORIES_ALLOWED, PROMPT_VALIDATION_ERROR_ONLY_FILES_ALLOWED, PROMPT_VALIDATION_ERROR_PERIOD_ENDS_200_YEARS_AHEAD, PROMPT_VALIDATION_ERROR_PERIOD_STARTS_200_YEARS_AGO, PROMPT_VALIDATION_ERROR_SPECIAL_VALUE_MIXED_WITH_OTHER_VALUES, PROMPT_VALIDATION_ERROR_STATIC_VALUE_INVALID, PROMPT_VALIDATION_ERROR_UPPER_RANGE_VALUE_ABOVE_MAXIMUM, PROMPT_VALIDATION_ERROR_UPPER_RANGE_VALUE_ABOVE_MAXIMUM_LENGTH, PROMPT_VALIDATION_ERROR_UPPER_RANGE_VALUE_BELOW_MINIMUM, PROMPT_VALIDATION_ERROR_UPPER_RANGE_VALUE_BELOW_MINIMUM_LENGTH, PROMPT_VALIDATION_NO_ERRORS
 
Constructor Summary
PromptDefinition()
          Constructor
PromptDefinition(java.lang.String promptName)
          Constructor
 
Method Summary
 void addUserInfo(java.lang.String key, java.lang.String value)
          Adds an entry to the user information map.
 void clearDefaultValue()
          Clears the default value if one has been set.
 void configureAttributes(java.util.Map<java.lang.String,?> options, java.util.Map<java.lang.String,?> context)
           
 com.sas.uiconfig.ApplicationContext getApplicationContext()
           
 java.util.List<?> getAttributeDescriptors(java.util.Locale myLocale)
           
protected  java.util.Map<java.lang.String,java.lang.String> getConstraints(java.util.Locale locale)
           
 java.lang.String getCustomErrorMessage(java.util.Locale locale)
          Returns a formatted custom error message for the desired locale.
 com.sas.util.LocalizableString getCustomErrorMessages()
          Returns a LocalizableString which contains all custom error messages for the prompt.
 java.lang.Object getDefaultValue()
          Returns the default value.
 java.util.List<com.sas.prompts.AttributeDependencyInterface> getDependentPromptsForAttributes()
          Returns a List of objects which implement AttributeDependencyInterface or an empty list.
 java.lang.String getHint(java.util.Locale locale)
          Returns the hint used to tell the user how to enter the value for the prompt.
 com.sas.prompts.HintPlacement getHintPlacement()
          Returns the hint label placement used to tell the user where to place hint label.
 com.sas.util.LocalizableString getHints()
          Returns all the hints current set on the prompt definition.
 java.lang.String getInlineHint(java.util.Locale locale)
          Returns the inline hint which should be displayed for the prompt when no value is set for the prompt.
 com.sas.util.LocalizableString getInlineHints()
          Returns a LocalizableString which contains all inline hints for the prompt.
 com.sas.prompts.LabelPlacement getLabelPlacement()
           
 com.sas.storage.editableproperties.PropertyList getLocalizableProperties()
          Returns a list of properties that may be localized for the implementing object.
 com.sas.util.MutableUserInfoInterface getMutableUserInfo()
          Returns an instance of MutableUserInfoInterface that maps String values to other String values which can be used by creators and consumers of prompts.
abstract  com.sas.datatypes.DataTypeInterface getPromptDataType()
          Returns the data type of the prompt.
 java.lang.String getPromptDescription(java.util.Locale locale)
          Returns the description of the prompt definition.
 com.sas.util.LocalizableString getPromptDescriptions()
          Returns a LocalizableString containing the localized descriptions for the prompt.
 PromptHelp getPromptHelp()
          Returns the help of the prompt definition.
 java.lang.String getPromptID()
          Returns a unique identifier for the prompt.
 java.lang.String getPromptLabel(java.util.Locale locale)
          Returns the label for the prompt.
 com.sas.util.LocalizableString getPromptLabels()
          Returns a LocalizableString containing all of the prompt labels set for this prompt definition.
 java.lang.String getPromptName()
          Returns the name of the prompt.
 java.util.Collection<ValidationEntry> getPromptValueValidationErrors(java.lang.Object value, java.util.Locale locale)
          Returns an empty Collection to indicate that there are no validation errors.
 com.sas.prompts.script.ScriptHolder getScript(com.sas.prompts.script.PromptAction promptAction)
          Returns the ScriptHolder instance, if any, whose action matches the PromptAction parameter (which may not be null).
 java.util.Collection<com.sas.prompts.script.ScriptHolder> getScripts()
          Returns an unmodifiable collection of the scripts or an empty collection.
 com.sas.uiconfig.UIConfigurationInterface getUIConfiguration()
          Returns a UI configuration object with options indicating how the prompt designer would like the prompting UI to look and behave.
 com.sas.util.UserInfoInterface getUserInfo()
          Returns an instance of UserInfoInterface that maps String values to other String values which can be used by creators and consumers of prompts.
protected  java.util.List<com.sas.util.xmlpersist.PersistenceInterface> getUserInfoAsText(com.sas.util.MutableUserInfoInterface uii)
          Helper method for persistence, but now calls PromptUtil.getUserInfoAsText(uii)
 java.lang.String getVersion()
           
 boolean isDefaultValueSet()
          Returns whether the default value is set.
 boolean isDisplayDefaultValueAsBlank()
          Returns whether the prompt value should be displayed as an empty field when the current value is the same as the default value.
 boolean isFixed()
          Returns true if the prompt defintion has a fixed value.
 boolean isHidden()
          Returns whether the prompt is hidden at runtime.
 boolean isPromptValueValid(java.lang.Object value)
          Deprecated. 
 boolean isPromptValueValid(java.lang.Object value, java.util.Locale locale)
          Returns whether the value passed in is valid for this prompt definition.
abstract  boolean isRequired()
          Returns whether the prompt value is required to be set before the user can continue with the operation being prompted for.
 boolean isValueClearedForNonSelectedModalChoiceGroup()
          Returns whether the value for this prompt gets cleared when the prompt is contained within a ModalChoiceGroupInterface, otherwise this parameter is ignored.
 void removeScript(com.sas.prompts.script.PromptAction promptAction)
          Removes the ScriptHolder whose action matches this PromptAction.
 void removeUserInfo(java.lang.String key)
          Removes an entry from the user information map.
 void setAdditionalCascadeDependencies(java.util.Collection<PromptDefinitionInterface> dependencies)
          Sets a collection of PromptDefinitionInterfaces that this prompt depends on.
 void setApplicationContext(com.sas.uiconfig.ApplicationContext applicationContext)
           
 void setCustomErrorMessage(java.lang.String errorMessage, java.util.Locale locale)
          Locale may not be null.
 void setCustomErrorMessages(com.sas.util.LocalizableString customErrorMessages)
           
 void setDefaultValue(java.lang.Object defaultValue)
          Sets the default value for the prompt definition.
 void setDependentPromptsForAttributes(java.util.List<com.sas.prompts.AttributeDependencyInterface> dependencies)
          Sets a List of objects which implement AttributeDependencyInterface.
 void setDisplayDefaultValueAsBlank(boolean isBlank)
          Sets whether the prompt value should be displayed as an empty field when the current value is the same as the default value.
 void setFixed(boolean fixed)
          Sets the prompt to have its value fixed or not.
 void setHidden(boolean hidden)
          Sets whether the prompt is hidden at runtime.
 void setHint(java.lang.String hint, java.util.Locale locale)
          Sets the hint used to tell the user how to enter the value for the prompt.
 void setHintPlacement(com.sas.prompts.HintPlacement hintPlacement)
          Sets the hint label placemnet used to place the hint label in the UI
 void setHints(com.sas.util.LocalizableString hints)
          Sets a LocalizableString containing the localized hints for the prompt.
 void setInlineHint(java.lang.String inlineHint, java.util.Locale locale)
          Sets the inline hint to be displayed when the prompt has no value.
 void setInlineHints(com.sas.util.LocalizableString inlineHint)
          Sets a LocalizableString containing the localized inline hints for the prompt.
 void setLabelPlacement(com.sas.prompts.LabelPlacement labelPlacement)
           
 void setLocalizableProperties(com.sas.storage.editableproperties.PropertyMap map)
          Sets localized properties into the implementing object.
 void setPromptDescription(java.lang.String promptDescription, java.util.Locale locale)
          Sets the description of the prompt definition.
 void setPromptDescriptions(com.sas.util.LocalizableString descriptions)
          Sets a LocalizableString containing the localized descriptions for the prompt.
 void setPromptHelp(PromptHelp promptHelp)
          Sets the prompt help of the prompt definition.
 void setPromptLabel(java.lang.String promptLabel, java.util.Locale locale)
          Sets the label for the prompt.
 void setPromptLabels(com.sas.util.LocalizableString labels)
          Sets a LocalizableString containing the localized labels for the prompt.
 void setPromptName(java.lang.String promptName)
          Sets the name of the prompt
 void setScript(com.sas.prompts.script.ScriptHolder scriptHolder)
          Sets the ScriptHolder into the collection.
 void setUIConfiguration(com.sas.uiconfig.UIConfigurationInterface uiConfig)
          Set a UI configuration object with options indicating how the prompt designer would like the prompting UI to look and behave.
 void setUserInfo(com.sas.util.UserInfoInterface userInfo)
          Sets an instance of UserInfoInterface which maps String keys to String values which can be used by creators and consumers of prompts.
 void setValueClearedForNonSelectedModalChoiceGroup(boolean value)
          Sets whether the value for this prompt gets cleared when the prompt is contained within a ModalChoiceGroupInterface, otherwise this parameter is ignored.
 java.lang.String toString()
          Returns subclass name plus getPromptName().
 java.util.Collection<ValidationEntry> validateDefinition(java.util.Locale locale)
          This method is used to validate that the various attributes of the definition all contain valid values.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values
Constructor Detail

PromptDefinition

public PromptDefinition()
Constructor


PromptDefinition

public PromptDefinition(java.lang.String promptName)
Constructor

Parameters:
promptName -
Method Detail

getPromptID

public java.lang.String getPromptID()
Returns a unique identifier for the prompt.

Specified by:
getPromptID in interface com.sas.prompts.IdentifiablePromptInterface
Returns:
a unique identifier for the prompt.

getPromptName

public java.lang.String getPromptName()
Returns the name of the prompt. The name has application specific meaning, such as the parameter name in a store process prompt.

Specified by:
getPromptName in interface PromptDefinitionInterface
Returns:
the name of the prompt
See Also:
PromptDefinitionInterface.getPromptName()

setPromptName

public void setPromptName(java.lang.String promptName)
Sets the name of the prompt

Specified by:
setPromptName in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
promptName -
See Also:
getPromptName()

getPromptLabel

public java.lang.String getPromptLabel(java.util.Locale locale)
Returns the label for the prompt. This is presented to the user when the user is asked to supply the prompt value.

Specified by:
getPromptLabel in interface PromptDefinitionInterface
Parameters:
locale - The locale to get the label for
Returns:
String
See Also:
PromptDefinitionInterface.getPromptLabel(Locale)

setPromptLabel

public void setPromptLabel(java.lang.String promptLabel,
                           java.util.Locale locale)
Sets the label for the prompt. This is presented to the user when the user is asked to supply the prompt value.

Specified by:
setPromptLabel in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
promptLabel - the label for the prompt
locale - The locale to set the label for
See Also:
MutablePromptDefinitionInterface.setPromptLabel(String, Locale)

getPromptDescription

public java.lang.String getPromptDescription(java.util.Locale locale)
Returns the description of the prompt definition. This is displayed at runtime to help the user understand the meaning of the value being prompted for.

Specified by:
getPromptDescription in interface PromptDefinitionInterface
Parameters:
locale - The locale that the description is in.
Returns:
The description of the meaning of the value being prompted for.
See Also:
PromptDefinitionInterface.getPromptDescription(Locale)

setPromptDescription

public void setPromptDescription(java.lang.String promptDescription,
                                 java.util.Locale locale)
Sets the description of the prompt definition. This is displayed at runtime to help the user understand the meaning of the value being prompted for.

Specified by:
setPromptDescription in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
promptDescription - The description of the meaning of the value being prompted for.
locale - The locale that the description is in.
See Also:
MutablePromptDefinitionInterface.setPromptDescription(String, Locale)

getPromptLabels

public com.sas.util.LocalizableString getPromptLabels()
Returns a LocalizableString containing all of the prompt labels set for this prompt definition.

Specified by:
getPromptLabels in interface PromptDefinitionInterface
Returns:
a LocalizableString containing all of the prompt labels set for this prompt definition.

setPromptLabels

public void setPromptLabels(com.sas.util.LocalizableString labels)
Sets a LocalizableString containing the localized labels for the prompt. The LocalizableString passed in is cloned by the prompt.

Specified by:
setPromptLabels in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
labels - a LocalizableString containing the localized labels for the prompt.

getPromptDescriptions

public com.sas.util.LocalizableString getPromptDescriptions()
Returns a LocalizableString containing the localized descriptions for the prompt.

Specified by:
getPromptDescriptions in interface PromptDefinitionInterface
Returns:
a LocalizableString containing the localized descriptions for the prompt.

setPromptDescriptions

public void setPromptDescriptions(com.sas.util.LocalizableString descriptions)
Sets a LocalizableString containing the localized descriptions for the prompt. The LocalizableString passed in is cloned by the prompt.

Specified by:
setPromptDescriptions in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
descriptions - a LocalizableString containing the localized descriptions for the prompt.

getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value. Method will throw an IllegalStateException if the default value has not been set.

Specified by:
getDefaultValue in interface PromptDefinitionInterface
Returns:
Object
See Also:
PromptDefinitionInterface.getDefaultValue()

setDefaultValue

public void setDefaultValue(java.lang.Object defaultValue)
Sets the default value for the prompt definition. The valid values for a prompt definition are documented in each subclass.

Specified by:
setDefaultValue in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
defaultValue - An appropriate value for the specific type of prompt definition.

clearDefaultValue

public void clearDefaultValue()
Clears the default value if one has been set.

Specified by:
clearDefaultValue in interface PromptDefinitionInterface
See Also:
isDefaultValueSet()

isDefaultValueSet

public boolean isDefaultValueSet()
Returns whether the default value is set.

Specified by:
isDefaultValueSet in interface PromptDefinitionInterface
Returns:
whether the default value is set.
See Also:
PromptDefinitionInterface.isDefaultValueSet()

getPromptHelp

public PromptHelp getPromptHelp()
Returns the help of the prompt definition. This is displayed at runtime to help the user understand the meaning of the value being prompted for.

Specified by:
getPromptHelp in interface com.sas.prompts.PromptHelpInterface
Returns:
The PromptHelp for the prompt defintion
See Also:
PromptHelp

setPromptHelp

public void setPromptHelp(PromptHelp promptHelp)
Sets the prompt help of the prompt definition. This is displayed at runtime to help the user understand the use of the prompt

Specified by:
setPromptHelp in interface com.sas.prompts.MutablePromptHelpInterface
Parameters:
promptHelp - The help set by the creator of the prompt
See Also:
PromptHelp

getPromptDataType

public abstract com.sas.datatypes.DataTypeInterface getPromptDataType()
Returns the data type of the prompt. This will vary by prompt subclass.

Specified by:
getPromptDataType in interface PromptDefinitionInterface
Returns:
the data type of the prompt.
See Also:
PromptDefinitionInterface.getPromptDataType()

isRequired

public abstract boolean isRequired()
Returns whether the prompt value is required to be set before the user can continue with the operation being prompted for.

Specified by:
isRequired in interface PromptDefinitionInterface
Returns:
whether the prompt value is required to be set.
See Also:
PromptDefinitionInterface.isRequired()

isHidden

public boolean isHidden()
Returns whether the prompt is hidden at runtime.

Specified by:
isHidden in interface PromptDefinitionInterface
Returns:
whether the prompt is hidden at runtime.
See Also:
PromptDefinitionInterface.isHidden()

setHidden

public void setHidden(boolean hidden)
Sets whether the prompt is hidden at runtime.

Specified by:
setHidden in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
hidden - boolean
See Also:
MutablePromptDefinitionInterface.setHidden(boolean)

isPromptValueValid

@Deprecated
public boolean isPromptValueValid(java.lang.Object value)
Deprecated. 

Returns whether the value passed in is valid for this prompt definition. Subclasses should override this method to validate the value.

Specified by:
isPromptValueValid in interface PromptDefinitionInterface
Parameters:
value - The value to check for validity
Returns:
whether the value passed in meets the constraints of the prompt
See Also:
PromptDefinitionInterface.isPromptValueValid(java.lang.Object)

isPromptValueValid

public boolean isPromptValueValid(java.lang.Object value,
                                  java.util.Locale locale)
Returns whether the value passed in is valid for this prompt definition. Subclasses should override this method to validate the value.

Specified by:
isPromptValueValid in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
boolean
See Also:
PromptDefinitionV2Interface.isPromptValueValid(java.lang.Object, java.util.Locale)

getPromptValueValidationErrors

public java.util.Collection<ValidationEntry> getPromptValueValidationErrors(java.lang.Object value,
                                                                            java.util.Locale locale)
Returns an empty Collection to indicate that there are no validation errors. Subclasses should override this method, call super, then add their own validation errors to the collection.

Specified by:
getPromptValueValidationErrors in interface PromptDefinitionInterface
Parameters:
value - The value to check for errors
locale - The locale to return the error messages in
Returns:
An non-null Collection.
See Also:
PromptDefinitionInterface.getPromptValueValidationErrors(Object, Locale)

validateDefinition

public java.util.Collection<ValidationEntry> validateDefinition(java.util.Locale locale)
This method is used to validate that the various attributes of the definition all contain valid values. It will usually return an empty collection but subclasses should override this method, call super, then add their appropriate validation errors. The one error that can be returned is if the prompt is defined to be hidden or fixed and required but does not have a default value.

Specified by:
validateDefinition in interface PromptDefinitionInterface
Parameters:
locale - Locale
Returns:
A Collection containing the set of ValidationEntry objects or an empty collection if no errors were found.
See Also:
PromptDefinitionInterface.validateDefinition(Locale)

getMutableUserInfo

public com.sas.util.MutableUserInfoInterface getMutableUserInfo()
Returns an instance of MutableUserInfoInterface that maps String values to other String values which can be used by creators and consumers of prompts.

Specified by:
getMutableUserInfo in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Returns:
an instance of MutableUserInfoInterface
See Also:
MutablePromptDefinitionInterface.getMutableUserInfo()

getUserInfo

public com.sas.util.UserInfoInterface getUserInfo()
Returns an instance of UserInfoInterface that maps String values to other String values which can be used by creators and consumers of prompts. This method returns a defensive copy (and never null).

Specified by:
getUserInfo in interface PromptDefinitionInterface
Returns:
an instance of UserInfoInterface
See Also:
PromptDefinitionInterface.getUserInfo()

setUserInfo

public void setUserInfo(com.sas.util.UserInfoInterface userInfo)
Sets an instance of UserInfoInterface which maps String keys to String values which can be used by creators and consumers of prompts. The supplied map is defensively copied into any existing user info map by iterating over its keys and casting keys and values to String.

If only a key is important, do not use null or "" for the value or else the key/value will not be correctly persisted. Instead use a blank string like com.sas.prompts.util.PromptConstants.USER_INFO_VALUE_BLANK.

Specified by:
setUserInfo in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
userInfo - Map
See Also:
com.sas.prompts.definitions.MutablePromptDefinitionInterface#setUserInfo(Map)

addUserInfo

public void addUserInfo(java.lang.String key,
                        java.lang.String value)
Adds an entry to the user information map.

If only a key is important, do not use null or "" for the value or else the key/value will not be correctly persisted. Instead use a blank string like com.sas.prompts.util.PromptConstants.USER_INFO_VALUE_BLANK.

Specified by:
addUserInfo in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
key -
value - a non-null, non-"" value

removeUserInfo

public void removeUserInfo(java.lang.String key)
Removes an entry from the user information map. If the key is not in the map, no action is taken.

Specified by:
removeUserInfo in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
key -

isFixed

public boolean isFixed()
Returns true if the prompt defintion has a fixed value. If the prompt is fixed, a user will not be able to edit the value for the prompt. The default value is false.

Specified by:
isFixed in interface PromptDefinitionInterface
Returns:
boolean true if the value is fixed, false otherwise.
See Also:
PromptDefinitionInterface.isFixed()

setFixed

public void setFixed(boolean fixed)
Sets the prompt to have its value fixed or not. A fixed prompt's value is not editable. The default value is false.

Specified by:
setFixed in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
fixed - boolean true to fix the value for the prompt, false otherwise
See Also:
MutablePromptDefinitionInterface.setFixed(boolean)

setAdditionalCascadeDependencies

public void setAdditionalCascadeDependencies(java.util.Collection<PromptDefinitionInterface> dependencies)
Sets a collection of PromptDefinitionInterfaces that this prompt depends on. This is used in addition to the prompt dependencies returns by getDependentPrompts().

Specified by:
setAdditionalCascadeDependencies in interface com.sas.prompts.definitions.MutablePromptDefinitionInterface
Parameters:
dependencies - a collection of PromptDefinitionInterfaces that this prompt depends on.

toString

public java.lang.String toString()
Returns subclass name plus getPromptName().

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getHint

public java.lang.String getHint(java.util.Locale locale)
Description copied from interface: HintableDefinitionInterface
Returns the hint used to tell the user how to enter the value for the prompt.

Specified by:
getHint in interface com.sas.prompts.definitions.HintableDefinitionInterface
Parameters:
locale - Locale
Returns:
String

setHint

public void setHint(java.lang.String hint,
                    java.util.Locale locale)
Description copied from interface: MutableHintableDefinitionInterface
Sets the hint used to tell the user how to enter the value for the prompt.

Specified by:
setHint in interface com.sas.prompts.definitions.MutableHintableDefinitionInterface
Parameters:
hint -
locale - Locale

getHints

public com.sas.util.LocalizableString getHints()
Returns all the hints current set on the prompt definition.

Specified by:
getHints in interface com.sas.prompts.definitions.HintableDefinitionInterface
Returns:
All the hints current set on the prompt definition.

setHints

public void setHints(com.sas.util.LocalizableString hints)
Sets a LocalizableString containing the localized hints for the prompt. The LocalizableString passed in is cloned by the prompt.

Specified by:
setHints in interface com.sas.prompts.definitions.MutableHintableDefinitionInterface
Parameters:
hints - a LocalizableString containing the localized hints for the prompt.

isDisplayDefaultValueAsBlank

public boolean isDisplayDefaultValueAsBlank()
Returns whether the prompt value should be displayed as an empty field when the current value is the same as the default value.

Specified by:
isDisplayDefaultValueAsBlank in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
whether the prompt value should be displayed as an empty field

setDisplayDefaultValueAsBlank

public void setDisplayDefaultValueAsBlank(boolean isBlank)
Sets whether the prompt value should be displayed as an empty field when the current value is the same as the default value.

Specified by:
setDisplayDefaultValueAsBlank in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface

isValueClearedForNonSelectedModalChoiceGroup

public boolean isValueClearedForNonSelectedModalChoiceGroup()
Description copied from interface: PromptDefinitionV2Interface
Returns whether the value for this prompt gets cleared when the prompt is contained within a ModalChoiceGroupInterface, otherwise this parameter is ignored. The default is true.

Specified by:
isValueClearedForNonSelectedModalChoiceGroup in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
true if the prompt has it's value cleared when contained within a ModalChoiceGroupInterface, false otherwise

setValueClearedForNonSelectedModalChoiceGroup

public void setValueClearedForNonSelectedModalChoiceGroup(boolean value)
Description copied from interface: MutablePromptDefinitionV2Interface
Sets whether the value for this prompt gets cleared when the prompt is contained within a ModalChoiceGroupInterface, otherwise this parameter is ignored. The default is true.

Specified by:
setValueClearedForNonSelectedModalChoiceGroup in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface
Parameters:
value - true to clear the value, false otherwise.

configureAttributes

public void configureAttributes(java.util.Map<java.lang.String,?> options,
                                java.util.Map<java.lang.String,?> context)
Specified by:
configureAttributes in interface com.sas.util.AttributeConfigurationInterface

getUserInfoAsText

protected final java.util.List<com.sas.util.xmlpersist.PersistenceInterface> getUserInfoAsText(com.sas.util.MutableUserInfoInterface uii)
Helper method for persistence, but now calls PromptUtil.getUserInfoAsText(uii)

Returns:
List

getLocalizableProperties

public com.sas.storage.editableproperties.PropertyList getLocalizableProperties()
Description copied from interface: LocalizableProperties
Returns a list of properties that may be localized for the implementing object. The returned PropertyListInterface includes default values for these properties.

Specified by:
getLocalizableProperties in interface com.sas.storage.editableproperties.LocalizableProperties
Returns:
property list

setLocalizableProperties

public void setLocalizableProperties(com.sas.storage.editableproperties.PropertyMap map)
Description copied from interface: LocalizableProperties
Sets localized properties into the implementing object. This method is used to set properties for the default locale.

Specified by:
setLocalizableProperties in interface com.sas.storage.editableproperties.LocalizableProperties
Parameters:
map - - map containing localized properties

getAttributeDescriptors

public java.util.List<?> getAttributeDescriptors(java.util.Locale myLocale)
Specified by:
getAttributeDescriptors in interface com.sas.util.AttributeDescription

getDependentPromptsForAttributes

public java.util.List<com.sas.prompts.AttributeDependencyInterface> getDependentPromptsForAttributes()
Returns a List of objects which implement AttributeDependencyInterface or an empty list.

Specified by:
getDependentPromptsForAttributes in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
a List of objects which implement AttributeDependencyInterface.

setDependentPromptsForAttributes

public void setDependentPromptsForAttributes(java.util.List<com.sas.prompts.AttributeDependencyInterface> dependencies)
Sets a List of objects which implement AttributeDependencyInterface.

Specified by:
setDependentPromptsForAttributes in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface
Parameters:
dependencies - a List of objects which implement AttributeDependencyInterface. Null may be passed in to indicate no dependencies.

getConstraints

protected java.util.Map<java.lang.String,java.lang.String> getConstraints(java.util.Locale locale)

getCustomErrorMessage

public java.lang.String getCustomErrorMessage(java.util.Locale locale)
Returns a formatted custom error message for the desired locale. If no error message was set, then this method returns an empty string (i.e. com.sas.util.xmlpersist.PersistConstants.EMPTY_STRING). If an error message was set, then locale may not be null.

Specified by:
getCustomErrorMessage in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
the error message with current values
See Also:
PromptDefinitionV2Interface.getCustomErrorMessage(java.util.Locale)

getCustomErrorMessages

public com.sas.util.LocalizableString getCustomErrorMessages()
Returns a LocalizableString which contains all custom error messages for the prompt.

Returns:
a LocalizableString which contains all custom error messages for the prompt.

setCustomErrorMessage

public void setCustomErrorMessage(java.lang.String errorMessage,
                                  @NotNull
                                  java.util.Locale locale)
Locale may not be null. If errorMessage is null, it will clear the existing message for the locale.

Specified by:
setCustomErrorMessage in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface
locale - a non-null locale
See Also:
com.sas.prompts.definitions.MutablePromptDefinitionV2Interface#setCustomErrorMessage(com.sas.util.LocalizableString)

setCustomErrorMessages

public void setCustomErrorMessages(com.sas.util.LocalizableString customErrorMessages)

getScript

public com.sas.prompts.script.ScriptHolder getScript(com.sas.prompts.script.PromptAction promptAction)
Description copied from interface: PromptDefinitionV2Interface
Returns the ScriptHolder instance, if any, whose action matches the PromptAction parameter (which may not be null).

Specified by:
getScript in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
the requested script holder or null

setScript

public void setScript(com.sas.prompts.script.ScriptHolder scriptHolder)
Description copied from interface: MutablePromptDefinitionV2Interface
Sets the ScriptHolder into the collection. Implementors may have rules about which ScriptHolder properties are acceptable.

Specified by:
setScript in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface

removeScript

public void removeScript(com.sas.prompts.script.PromptAction promptAction)
Description copied from interface: MutablePromptDefinitionV2Interface
Removes the ScriptHolder whose action matches this PromptAction.

Specified by:
removeScript in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface

getScripts

public java.util.Collection<com.sas.prompts.script.ScriptHolder> getScripts()
Description copied from interface: PromptDefinitionV2Interface
Returns an unmodifiable collection of the scripts or an empty collection.

Specified by:
getScripts in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
the scripts

getUIConfiguration

public com.sas.uiconfig.UIConfigurationInterface getUIConfiguration()
Returns a UI configuration object with options indicating how the prompt designer would like the prompting UI to look and behave.

Specified by:
getUIConfiguration in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
a UI configuration

setUIConfiguration

public void setUIConfiguration(com.sas.uiconfig.UIConfigurationInterface uiConfig)
Set a UI configuration object with options indicating how the prompt designer would like the prompting UI to look and behave.

Specified by:
setUIConfiguration in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface
Parameters:
uiConfig - a UI configuration

getInlineHint

public java.lang.String getInlineHint(java.util.Locale locale)
Returns the inline hint which should be displayed for the prompt when no value is set for the prompt.

Specified by:
getInlineHint in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Parameters:
locale - The locale to return the inline hint for
Returns:
the inline hint which should be displayed for the prompt when no value is set for the prompt

getInlineHints

public com.sas.util.LocalizableString getInlineHints()
Returns a LocalizableString which contains all inline hints for the prompt.

Specified by:
getInlineHints in interface com.sas.prompts.definitions.PromptDefinitionV2Interface
Returns:
a LocalizableString which contains all inline hints for the prompt.

setInlineHint

public void setInlineHint(java.lang.String inlineHint,
                          java.util.Locale locale)
Sets the inline hint to be displayed when the prompt has no value.

Specified by:
setInlineHint in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface
Parameters:
inlineHint - the inline hint to be displayed when the prompt has no value.
locale - The locale to set the inline hint for.

setInlineHints

public void setInlineHints(com.sas.util.LocalizableString inlineHint)
Sets a LocalizableString containing the localized inline hints for the prompt. The LocalizableString passed in is not copied and is afterwards "owned" by the prompt.

Specified by:
setInlineHints in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface
Parameters:
inlineHint - a LocalizableString containing the localized inline hints for the prompt

getLabelPlacement

public com.sas.prompts.LabelPlacement getLabelPlacement()
Specified by:
getLabelPlacement in interface com.sas.prompts.definitions.PromptDefinitionV2Interface

setLabelPlacement

public void setLabelPlacement(com.sas.prompts.LabelPlacement labelPlacement)
Specified by:
setLabelPlacement in interface com.sas.prompts.definitions.MutablePromptDefinitionV2Interface

getHintPlacement

public com.sas.prompts.HintPlacement getHintPlacement()
Description copied from interface: HintableDefinitionV2Interface
Returns the hint label placement used to tell the user where to place hint label.

Specified by:
getHintPlacement in interface com.sas.prompts.definitions.HintableDefinitionV2Interface
Returns:
the hint label Placement used to place hint label in the UI.

setHintPlacement

public void setHintPlacement(com.sas.prompts.HintPlacement hintPlacement)
Description copied from interface: MutableHintableDefinitionV2Interface
Sets the hint label placemnet used to place the hint label in the UI

Specified by:
setHintPlacement in interface com.sas.prompts.definitions.MutableHintableDefinitionV2Interface

getVersion

public java.lang.String getVersion()
Specified by:
getVersion in interface com.sas.models.VersionInterface
Overrides:
getVersion in class com.sas.util.xmlpersist.impl.BaseAbstractPersistence

getApplicationContext

public final com.sas.uiconfig.ApplicationContext getApplicationContext()
Specified by:
getApplicationContext in interface com.sas.uiconfig.ContextEnabledObject

setApplicationContext

public final void setApplicationContext(com.sas.uiconfig.ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface com.sas.uiconfig.ContextEnabledObject



Copyright © 2009 SAS Institute Inc. All Rights Reserved.