org.kuali.rice.krad.uif.element
Class ValidationMessages

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.DictionaryBeanBase
      extended by org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
          extended by org.kuali.rice.krad.uif.element.ValidationMessages
All Implemented Interfaces:
Serializable, Cloneable, Copyable, DictionaryBean, UifDictionaryBean
Direct Known Subclasses:
FieldValidationMessages, GroupValidationMessages

public class ValidationMessages
extends UifDictionaryBeanBase

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:
Serialized Form

Field Summary
 
Fields inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
componentCode, namespaceCode
 
Constructor Summary
ValidationMessages()
           
 
Method Summary
protected  void addNestedGroupKeys(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  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)
 void generateMessages(View view, Object model, Component parent)
          Generates the messages based on the content in the messageMap
 List<String> 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.
 List<String> getErrors()
          The list of error messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set
 List<String> getInfos()
          The list of info messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set
protected  List<String> getKeys(Component parent)
          Gets all the keys associated to this ValidationMessages.
protected  List<String> getMessages(View view, String key, List<List<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.
 List<String> getWarnings()
          The list of warning messages found for the keys that were matched on this ValidationMessages This is generated and cannot be set
 boolean isDisplayMessages()
          If true, error, warning, and info messages will be displayed (provided they are also set to display).
 void setAdditionalKeysToMatch(List<String> additionalKeysToMatch)
           
 void setAdditionalKeysToMatch(String additionalKeysToMatch)
          Convenience setter for additional keys to match that takes a string argument and splits on comma to build the list
 void setDisplayMessages(boolean displayMessages)
           
protected  void setErrors(List<String> errors)
          Sets errors
protected  void setInfos(List<String> infos)
          Sets infos
protected  void setWarnings(List<String> warnings)
          Sets warnings
 
Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, setExpressionGraph, setPropertyExpressions
 
Methods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
clone, copy, dataDictionaryPostProcessing, getComponentCode, getNamespaceCode, preventModification, setComponentCode, setNamespaceCode, unwrap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
dataDictionaryPostProcessing, getComponentCode, getNamespaceCode
 

Constructor Detail

ValidationMessages

public ValidationMessages()
Method Detail

generateMessages

public void generateMessages(View view,
                             Object model,
                             Component parent)
Generates the messages based on the content in the messageMap

Parameters:
view - the current View
model - the current model
parent - the parent of this ValidationMessages

getMessages

protected List<String> getMessages(View view,
                                   String key,
                                   List<List<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

protected List<String> getKeys(Component parent)
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 an ValidationMessages for an InputField. 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

protected void addNestedGroupKeys(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.

Parameters:
keyList -
component -

getAdditionalKeysToMatch

public List<String> 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

public void setAdditionalKeysToMatch(String additionalKeysToMatch)
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

public void setAdditionalKeysToMatch(List<String> additionalKeysToMatch)
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

public List<String> 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

getWarnings

public List<String> 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

getInfos

public List<String> 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

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 constructed
defaults - defaults for validation messages
key - the variable name being added
value - the value set on this object

setErrors

protected void setErrors(List<String> errors)
Sets errors

Parameters:
errors -

setWarnings

protected void setWarnings(List<String> warnings)
Sets warnings

Parameters:
warnings -

setInfos

protected void setInfos(List<String> infos)
Sets infos

Parameters:
infos -


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.