com.sas.prompts.groups
Interface PromptGroupInterface

All Superinterfaces:
com.sas.util.xmlpersist.PersistenceInterface, com.sas.util.ResourceReferencesInterface, com.sas.models.VersionInterface
All Known Implementing Classes:
ModalChoiceGroup, ModalGroup, PromptGroup, TransparentGroup

public interface PromptGroupInterface
extends com.sas.models.VersionInterface, com.sas.util.xmlpersist.PersistenceInterface, com.sas.util.ResourceReferencesInterface

Defines a hierarchical group of prompts. Each group contains prompt definitions and subgroups. Prompt names are only allowed to be used once per group. Implementations of this interface should store prompt definitions and subgroups together in an ordered manner.


Field Summary
static long PROMPT_GROUP_VALIDATION_ERROR_DISALLOWED_PROMPT_DEFINITION
          Validation error code indicating that a prompt is not valid in the containing group type
static long PROMPT_GROUP_VALIDATION_ERROR_DUPLICATE_MODAL_CHOICE_VALUE
          Validation error code indicating that two ModalChoiceGroups in a ModalGroup have the same value
static long PROMPT_GROUP_VALIDATION_ERROR_NOT_VALID_SUBGROUP
          Validation error code indicating that a subgroup is not valid in the containing group type
static long PROMPT_GROUP_VALIDATION_NO_ERRORS
          Validation error code indicating no errors
 
Method Summary
 void addPromptDefinition(PromptDefinitionInterface promptDefinition)
          Adds the specified prompt to the group being called at the end of the list of prompts and groups.
 void addPromptDefinition(PromptDefinitionInterface promptDefinition, int index)
          Adds the specified prompt to the group being called at the specified index.
 void addPromptDefinitions(java.util.List<PromptDefinitionInterface> promptDefinitions)
          Adds the specified prompts to the group being called at the end of the list of prompts and groups.
 void addPromptSubgroup(PromptGroupInterface promptSubgroup)
          Adds the specified group to the called group as a child.
 void addPromptSubgroup(PromptGroupInterface promptSubgroup, int index)
          Adds the specified group to the called group as a child.
 boolean containsSubgroup(PromptGroupInterface subGroupCandidate, boolean recursive)
          Returns true if the specified subGroupCandidate argument is identified as a subgroup of this group.
 PromptGroupInterface findPromptSubgroup(PromptDefinitionInterface promptDefinition)
          Finds the specified PromptDefinition in the hierarchy of PromptGroups and returns the group directly containing the definition.
 PromptDefinitionInterface getPromptDefinition(java.lang.String promptName, boolean recursive)
          Returns the first prompt definition found in the group with the specified name or null if a definition cannot be found.
 java.util.List<PromptDefinitionInterface> getPromptDefinitions(boolean recursive)
          Returns a List of all prompt definitions in this group.
 java.util.List<?> getPromptDefinitionsAndSubgroups()
          Returns a List of all prompt definitions and subgroups in this group, this is not recursive.
 java.util.List<?> getPromptDefinitionsAndSubgroups(java.util.List list, boolean recursive, boolean includeDefinitions, boolean includeSubgroups)
          Returns a List containing all of the PromptDefinitions and Prompts in the group and optionally the subgroups of the group.
 java.lang.String getPromptGroupDescription(java.util.Locale locale)
          Returns the description for the group in the specified Locale.
 com.sas.util.LocalizableString getPromptGroupDescriptions()
          Returns a LocalizableString containing a copy of the localized descriptions for the group.
 java.lang.String getPromptGroupLabel(java.util.Locale locale)
          Returns the label for the group in the specified Locale.
 com.sas.util.LocalizableString getPromptGroupLabels()
          Returns a LocalizableString containing a copy of the localized labels for the group.
 java.util.List<PromptGroupInterface> getPromptSubgroups(boolean recursive)
          Returns a List of all prompt groups contained in this prompt group.
 boolean hasPromptDefinition(PromptDefinitionInterface promptDefinition)
          Returns whether the prompt definition is found in the group.
 int indexOfPromptDefinitionOrSubgroup(java.lang.Object promptDefintionOrSubGroup)
          Returns the index of the PromptDefintionInterface or PromptGroupInterface that is passed in.
 boolean isPromptGroupHidden()
          Returns whether the prompt group should be displayed to the user at runtime.
 void removeAll()
          Removes all prompts and groups contained within the group.
 void removeAllPromptDefinitions(boolean recursive)
          Removes all prompts from the group.
 void removeAllPromptSubgroups()
          Removes all groups contained within the group.
 void removePromptDefinition(PromptDefinitionInterface promptDefinition)
          Removes the specified prompt from the group.
 void removePromptSubgroup(PromptGroupInterface promptSubgroup)
          Removes the specified group from the called group.
 boolean replacePromptDefintion(PromptDefinitionInterface promptDefinition, PromptDefinitionInterface newPromptDefinition, boolean recursive)
          Replaces the specified prompt with the other specified prompt.
 boolean replacePromptSubgroup(PromptGroupInterface promptSubgroup, PromptGroupInterface newPromptSubgroup, boolean recursive)
          Replaces the specified group with the other specified group.
 void setPromptGroupDescription(java.lang.String description, java.util.Locale locale)
          Sets the description for the group in the specified Locale.
 void setPromptGroupDescriptions(com.sas.util.LocalizableString descriptions)
          Returns a LocalizableString containing a copy of the localized descriptions for the group.
 void setPromptGroupHidden(boolean hidden)
          Sets whether the prompt group should be hidden from the user at runtime.
 void setPromptGroupLabel(java.lang.String label, java.util.Locale locale)
          Sets the label for the group in the specified Locale.
 void setPromptGroupLabels(com.sas.util.LocalizableString labels)
          Returns a LocalizableString containing a copy of the localized labels for the group.
 

Field Detail

PROMPT_GROUP_VALIDATION_NO_ERRORS

static final long PROMPT_GROUP_VALIDATION_NO_ERRORS
Validation error code indicating no errors

See Also:
Constant Field Values

PROMPT_GROUP_VALIDATION_ERROR_NOT_VALID_SUBGROUP

static final long PROMPT_GROUP_VALIDATION_ERROR_NOT_VALID_SUBGROUP
Validation error code indicating that a subgroup is not valid in the containing group type

See Also:
Constant Field Values

PROMPT_GROUP_VALIDATION_ERROR_DISALLOWED_PROMPT_DEFINITION

static final long PROMPT_GROUP_VALIDATION_ERROR_DISALLOWED_PROMPT_DEFINITION
Validation error code indicating that a prompt is not valid in the containing group type

See Also:
Constant Field Values

PROMPT_GROUP_VALIDATION_ERROR_DUPLICATE_MODAL_CHOICE_VALUE

static final long PROMPT_GROUP_VALIDATION_ERROR_DUPLICATE_MODAL_CHOICE_VALUE
Validation error code indicating that two ModalChoiceGroups in a ModalGroup have the same value

See Also:
Constant Field Values
Method Detail

getPromptDefinition

PromptDefinitionInterface getPromptDefinition(java.lang.String promptName,
                                              boolean recursive)
Returns the first prompt definition found in the group with the specified name or null if a definition cannot be found.

Parameters:
promptName - The name of the prompt definition to search for
recursive - boolean
Returns:
the first prompt definition found in the group with the specified name or null if no prompt definition with the given name can be found.

hasPromptDefinition

boolean hasPromptDefinition(PromptDefinitionInterface promptDefinition)
Returns whether the prompt definition is found in the group.

Parameters:
promptDefinition - The prompt definition to search for
Returns:
whether the prompt definition is found in the group.

getPromptDefinitionsAndSubgroups

java.util.List<?> getPromptDefinitionsAndSubgroups(java.util.List list,
                                                   boolean recursive,
                                                   boolean includeDefinitions,
                                                   boolean includeSubgroups)
Returns a List containing all of the PromptDefinitions and Prompts in the group and optionally the subgroups of the group.

Parameters:
definitions - A List to populate or null to have a new List created and returned
recursive - Whether to return prompts and groups recursively
includeDefinitions - Whether to include prompts in the returned list
includeSubgroups - Whether to include subgroups in the returned list
Returns:
a List containing all of the PromptDefinitions and Prompts in the group and optionally the subgroups of the group

getPromptDefinitionsAndSubgroups

java.util.List<?> getPromptDefinitionsAndSubgroups()
Returns a List of all prompt definitions and subgroups in this group, this is not recursive.

Returns:
a List of all prompt definitions and subgroups in this group, this is not recursive

getPromptDefinitions

java.util.List<PromptDefinitionInterface> getPromptDefinitions(boolean recursive)
Returns a List of all prompt definitions in this group. If true is passed in, all the definitions in all subgroups will also be returned.

Parameters:
recursive - boolean true if to include definitions in subgroups, false otherwise
Returns:
List a list of the definitions

getPromptSubgroups

java.util.List<PromptGroupInterface> getPromptSubgroups(boolean recursive)
Returns a List of all prompt groups contained in this prompt group. If the recursive flag is true, subgroups of the passed in group will also be searched for subgroups.

Parameters:
recursive - whether to search subgroups of the passed in group for subgroups.
Returns:
a List of all prompt groups contained in this prompt group.

addPromptDefinition

void addPromptDefinition(PromptDefinitionInterface promptDefinition)
Adds the specified prompt to the group being called at the end of the list of prompts and groups.

Parameters:
promptDefinition - The prompt to add to the group.

addPromptDefinition

void addPromptDefinition(PromptDefinitionInterface promptDefinition,
                         int index)
Adds the specified prompt to the group being called at the specified index.

Parameters:
promptDefinition - The prompt to add to the group.
index - The index to add the definition at.

addPromptDefinitions

void addPromptDefinitions(java.util.List<PromptDefinitionInterface> promptDefinitions)
Adds the specified prompts to the group being called at the end of the list of prompts and groups.

Parameters:
promptDefinition - The List of prompts to add to the group.

removePromptDefinition

void removePromptDefinition(PromptDefinitionInterface promptDefinition)
Removes the specified prompt from the group.

Parameters:
promptDefinition - The prompt to remove from the group.

removeAllPromptDefinitions

void removeAllPromptDefinitions(boolean recursive)
Removes all prompts from the group. If the recursive parameter is true, removeAllPromptDefinitions() is called on all groups contained within the group.

Parameters:
recursive - Whether to also remove prompts from all subgroups.

removeAllPromptSubgroups

void removeAllPromptSubgroups()
Removes all groups contained within the group.


removeAll

void removeAll()
Removes all prompts and groups contained within the group.


replacePromptDefintion

boolean replacePromptDefintion(PromptDefinitionInterface promptDefinition,
                               PromptDefinitionInterface newPromptDefinition,
                               boolean recursive)
Replaces the specified prompt with the other specified prompt. If recursive is true, subgroups are searched for the specified prompt to replace. If not, only the top level group is searched.

Parameters:
promptDefinition - The prompt to be replaced.
newPromptDefinition - The prompt to put in place of promptDefinition.
recursive - If recursive is true, subgroups are searched for the specified prompt to replace. If not, only the top level group is searched.
Returns:
whether the prompt was replaced

replacePromptSubgroup

boolean replacePromptSubgroup(PromptGroupInterface promptSubgroup,
                              PromptGroupInterface newPromptSubgroup,
                              boolean recursive)
Replaces the specified group with the other specified group. If recursive is true, subgroups are searched for the specified group to replace. If not, only the top level group is searched.

Parameters:
promptSubgroup - The group to be replaced.
newPromptSubgroup - The group to put in place of promptSubgroup.
recursive - If recursive is true, subgroups are searched for the specified group to replace. If not, only the top level group is searched.
Returns:
whether the group was replaced

addPromptSubgroup

void addPromptSubgroup(PromptGroupInterface promptSubgroup)
Adds the specified group to the called group as a child. The group will be added at the end of the list of prompts and groups.

Parameters:
promptSubgroup - The group to add.

addPromptSubgroup

void addPromptSubgroup(PromptGroupInterface promptSubgroup,
                       int index)
Adds the specified group to the called group as a child. The group will be added at the specified index of the list of prompts and groups.

Parameters:
promptSubgroup - The group to add.
index - The index to add the group at.

removePromptSubgroup

void removePromptSubgroup(PromptGroupInterface promptSubgroup)
Removes the specified group from the called group.

Parameters:
promptSubgroup - The group to remove.

indexOfPromptDefinitionOrSubgroup

int indexOfPromptDefinitionOrSubgroup(java.lang.Object promptDefintionOrSubGroup)
Returns the index of the PromptDefintionInterface or PromptGroupInterface that is passed in. This index is the index in the list that holds the prompt definitions and prompt subgroups. -1 should be returned if the object cannot be found.

Parameters:
promptDefintionOrSubGroup - needs to be either a prompt definition or prompt group
Returns:
int the index in the list

findPromptSubgroup

PromptGroupInterface findPromptSubgroup(PromptDefinitionInterface promptDefinition)
Finds the specified PromptDefinition in the hierarchy of PromptGroups and returns the group directly containing the definition. Returns null if the PromptDefinition is not found in any of the groups.

Parameters:
promptDefinition -
Returns:
PromptGroupInterface

getPromptGroupLabel

java.lang.String getPromptGroupLabel(java.util.Locale locale)
Returns the label for the group in the specified Locale. See the documentation for LocalizableString for more information about how Locales are handled when the label in the specified Locale is not found.

Parameters:
locale - The Locale to get the label for.
Returns:
The label for the group.

getPromptGroupDescription

java.lang.String getPromptGroupDescription(java.util.Locale locale)
Returns the description for the group in the specified Locale. See the documentation for LocalizableString for more information about how Locales are handled when the description in the specified Locale is not found.

Parameters:
locale - The Locale to get the description for.
Returns:
The description for the group.

setPromptGroupLabel

void setPromptGroupLabel(java.lang.String label,
                         java.util.Locale locale)
Sets the label for the group in the specified Locale.

Parameters:
label - The label for the group.
locale - The Locale to set the label for.

setPromptGroupDescription

void setPromptGroupDescription(java.lang.String description,
                               java.util.Locale locale)
Sets the description for the group in the specified Locale.

Parameters:
label - The description for the group.
locale - The Locale to set the description for.

getPromptGroupLabels

com.sas.util.LocalizableString getPromptGroupLabels()
Returns a LocalizableString containing a copy of the localized labels for the group.

Returns:
a LocalizableString containing a copy of the localized labels for the group.

getPromptGroupDescriptions

com.sas.util.LocalizableString getPromptGroupDescriptions()
Returns a LocalizableString containing a copy of the localized descriptions for the group.

Returns:
a LocalizableString containing a copy of the localized descriptions for the group.

setPromptGroupLabels

void setPromptGroupLabels(com.sas.util.LocalizableString labels)
Returns a LocalizableString containing a copy of the localized labels for the group.

Parameters:
labels - LocalizableString

setPromptGroupDescriptions

void setPromptGroupDescriptions(com.sas.util.LocalizableString descriptions)
Returns a LocalizableString containing a copy of the localized descriptions for the group.

Parameters:
descriptions - LocalizableString

isPromptGroupHidden

boolean isPromptGroupHidden()
Returns whether the prompt group should be displayed to the user at runtime.

Returns:
whether the prompt group should be displayed to the user at runtime.

setPromptGroupHidden

void setPromptGroupHidden(boolean hidden)
Sets whether the prompt group should be hidden from the user at runtime.

Parameters:
hidden - whether the prompt group should be hidden from the user at runtime.

containsSubgroup

boolean containsSubgroup(PromptGroupInterface subGroupCandidate,
                         boolean recursive)
Returns true if the specified subGroupCandidate argument is identified as a subgroup of this group. The test for subgroup status will be limited to immediate child subgroups if the recursive argument is false. The test for subgroup status will span all descendant groups when the recursive argument is true.

Parameters:
subGroupCandidate - PromptGroupInterface to be identified as a subgroup of this group or not.
Returns:
true if the specified subGroupCandidate argument is identified as a subgroup of this group.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.