Enum FieldValidationStatus

  • All Implemented Interfaces:
    Serializable, Comparable<FieldValidationStatus>

    public enum FieldValidationStatus
    extends Enum<FieldValidationStatus>

    An enumeration class describing the possible validation status values of a form field.

    While a user edits a form, validation can be performed concurrently. So the user gets immediate feedback, which fields are valid and which are not. The status of a field as related to validation is defined using this enumeration. Possible states a field can be in are the following:

    • The field has already been visited and is valid.
    • The field has already been visited and is invalid.
    • The field has already been visited and is in warning state.
    • The field has not yet been visited and is valid.
    • The field has not yet been visited and is invalid. This could be the case for instance for mandatory fields that do not have an initial value.
    • The field has not yet been visited and is in warning state.

    The validation status is typically evaluated by objects that observe validation operations. Such objects can register at a FormController as FormControllerValidationListener. They are then notified whenever a validation takes place which may impact the validation status of a field. In reaction on such a change the UI may be updated, e.g. fields with invalid content may be marked in a specific way.

    Version:
    $Id: FieldValidationStatus.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Enum Constant Detail

      • VALID

        public static final FieldValidationStatus VALID
        The field is valid (and has already been visited).
      • INVALID

        public static final FieldValidationStatus INVALID
        The field is invalid (and has already been visited).
      • WARNING

        public static final FieldValidationStatus WARNING
        The field is in warning state (and has already been visited).
      • NOT_VISITED_VALID

        public static final FieldValidationStatus NOT_VISITED_VALID
        The field has not yet been visited and is valid.
      • NOT_VISITED_INVALID

        public static final FieldValidationStatus NOT_VISITED_INVALID
        The field has not yet been visited and is invalid.
      • NOT_VISITED_WARNING

        public static final FieldValidationStatus NOT_VISITED_WARNING
        The field has not yet been visited and contains a warning.
    • Method Detail

      • values

        public static FieldValidationStatus[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (FieldValidationStatus c : FieldValidationStatus.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static FieldValidationStatus valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getStatus

        public static FieldValidationStatus getStatus​(ValidationResult vres,
                                                      boolean visited)
        Returns the FieldValidationStatus instance that corresponds to the given ValidationResult and visited status.
        Parameters:
        vres - the ValidationResult (can be null, then the result is considered valid)
        visited - the visited status
        Returns:
        the corresponding FieldValidationStatus instance