Package org.kuali.rice.krad.uif.element
Class ValidationMessages
java.lang.Object
org.kuali.rice.krad.datadictionary.DictionaryBeanBase
org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
org.kuali.rice.krad.uif.element.ValidationMessages
- All Implemented Interfaces:
Serializable,Cloneable,Copyable,DictionaryBean,UifDictionaryBean
- Direct Known Subclasses:
FieldValidationMessages,GroupValidationMessages
Field that displays error, warning, and info messages for the keys that are
matched. By default, an ValidationMessages will match on id and bindingPath (if this
ValidationMessages is for an InputField), but can be set to match on
additionalKeys and nested components keys (of the its parentComponent).
In addition, there are a variety of options which can be toggled to effect
the display of these messages during both client and server side validation
display. See documentation on each get method for more details on the effect
of each option.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Field Summary
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
componentCode, namespaceCode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddNestedGroupKeys(Collection<String> keyList, Component component) Adds all group keys of this component (starting from this component itself) by calling getKeys on each of its nested group's ValidationMessages and adding them to the list.protected voidaddValidationDataSettingsValue(Map<String, Object> valueMap, Map<String, String> defaults, String key, Object value) Adds the value passed to the valueMap with the key specified, if the value does not match the value which already exists in defaults (to avoid having to write out extra data that can later be derived from the defaults in the js)voidgenerateMessages(View view, Object model, Component parent) Generates the messages based on the content in the messageMapAdditionalKeysToMatch is an additional list of keys outside of the default keys that will be matched when messages are returned after a form is submitted.The list of error messages found for the keys that were matched on this ValidationMessages This is generated and cannot be setgetInfos()The list of info messages found for the keys that were matched on this ValidationMessages This is generated and cannot be setGets all the keys associated to this ValidationMessages.getMessages(View view, String key, List<List<org.kuali.rice.krad.util.ErrorMessage>> lists) Gets all the messages from the list of lists passed in (which are lists of ErrorMessages associated to the key) and uses the configuration service to get the message String associated.The list of warning messages found for the keys that were matched on this ValidationMessages This is generated and cannot be setbooleanIf true, error, warning, and info messages will be displayed (provided they are also set to display).voidsetAdditionalKeysToMatch(String additionalKeysToMatch) Convenience setter for additional keys to match that takes a string argument and splits on comma to build the listvoidsetAdditionalKeysToMatch(List<String> additionalKeysToMatch) voidsetDisplayMessages(boolean displayMessages) protected voidprotected voidprotected voidsetWarnings(List<String> warnings) Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressionsMethods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
clone, copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCodeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
dataDictionaryPostProcessing, getComponentCode, getNamespaceCode
-
Constructor Details
-
ValidationMessages
public ValidationMessages()
-
-
Method Details
-
generateMessages
Generates the messages based on the content in the messageMap- Parameters:
view- the current Viewmodel- the current modelparent- the parent of this ValidationMessages
-
getMessages
protected List<String> getMessages(View view, String key, List<List<org.kuali.rice.krad.util.ErrorMessage>> lists) Gets all the messages from the list of lists passed in (which are lists of ErrorMessages associated to the key) and uses the configuration service to get the message String associated. This will also combine error messages per a field if that option is turned on. If displayFieldLabelWithMessages is turned on, it will also find the label by key passed in.- Parameters:
view-key-lists-- Returns:
- list of messages
-
getKeys
Gets all the keys associated to this ValidationMessages. This includes the id of the parent component, additional keys to match, and the bindingPath if this is a ValidationMessages for a DataBinding component. These are the keys that are used to match errors with their component and display them as part of its ValidationMessages.- Returns:
- list of keys
-
addNestedGroupKeys
Adds all group keys of this component (starting from this component itself) by calling getKeys on each of its nested group's ValidationMessages and adding them to the list.- Parameters:
keyList-component-
-
getAdditionalKeysToMatch
AdditionalKeysToMatch is an additional list of keys outside of the default keys that will be matched when messages are returned after a form is submitted. These keys are only used for displaying messages generated by the server and have no effect on client side validation error display.- Returns:
- the additionalKeysToMatch
-
setAdditionalKeysToMatch
Convenience setter for additional keys to match that takes a string argument and splits on comma to build the list- Parameters:
additionalKeysToMatch- String to parse
-
setAdditionalKeysToMatch
- Parameters:
additionalKeysToMatch- the additionalKeysToMatch to set
-
isDisplayMessages
public boolean isDisplayMessages()If true, error, warning, and info messages will be displayed (provided they are also set to display). Otherwise, no messages for this ValidationMessages container will be displayed (including ones set to display). This is a global display on/off switch for all messages.
Other areas of the screen react to a display flag being turned off at a certain level, if display is off for a field, the next level up will display that fields full message text, and if display is off at a section the next section up will display those messages nested in a sublist.
- Returns:
- the displayMessages
-
setDisplayMessages
public void setDisplayMessages(boolean displayMessages) - Parameters:
displayMessages- the displayMessages to set
-
getErrors
The list of error messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set- Returns:
- the errors
-
setErrors
- See Also:
-
getWarnings
The list of warning messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set- Returns:
- the warnings
-
setWarnings
- See Also:
-
getInfos
The list of info messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set- Returns:
- the infos
-
setInfos
- See Also:
-
addValidationDataSettingsValue
protected void addValidationDataSettingsValue(Map<String, Object> valueMap, Map<String, String> defaults, String key, Object value) Adds the value passed to the valueMap with the key specified, if the value does not match the value which already exists in defaults (to avoid having to write out extra data that can later be derived from the defaults in the js)- Parameters:
valueMap- the data map being constructeddefaults- defaults for validation messageskey- the variable name being addedvalue- the value set on this object
-