Class 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:
  • Constructor Details

    • ValidationMessages

      public ValidationMessages()
  • Method Details

    • 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 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

      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
    • setErrors

      protected void setErrors(List<String> errors)
      See Also:
    • 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
    • setWarnings

      protected void setWarnings(List<String> warnings)
      See Also:
    • 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
    • setInfos

      protected void setInfos(List<String> infos)
      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 constructed
      defaults - defaults for validation messages
      key - the variable name being added
      value - the value set on this object