Class FormModel.Validate

  • Enclosing class:
    FormModel

    public static class FormModel.Validate
    extends java.lang.Object
    A base class that an implementation can derive from to interact with the form validation process. Before performing each validation test, the validation framework calls back to a Validate instance to determine whether that kind of validation test is enabled. Each time a validation failure occurs, the validation framework calls back to a Validate instance to record the failure.

    This default implementation has all kinds of validations enabled by default. It takes no action on validation failures, except to increment the number of failures.

    • Constructor Summary

      Constructors 
      Constructor Description
      Validate()
      Initializes a newly created Validate object so that all kinds validation tests are enabled.
      Validate​(boolean bScriptTestEnabled, boolean bNullTestEnabled, boolean bFormatTestEnabled, boolean bBarcodeTestEnabled)
      Initializes a newly created Validate object so that specified validation tests are enabled.
    • Constructor Detail

      • Validate

        public Validate()
        Initializes a newly created Validate object so that all kinds validation tests are enabled.
      • Validate

        public Validate​(boolean bScriptTestEnabled,
                        boolean bNullTestEnabled,
                        boolean bFormatTestEnabled,
                        boolean bBarcodeTestEnabled)
        Initializes a newly created Validate object so that specified validation tests are enabled.
        Parameters:
        bScriptTestEnabled - determines whether script validations are enabled
        bNullTestEnabled - determines whether null validations are enabled
        bFormatTestEnabled - determines whether format validations are enabled
        bBarcodeTestEnabled - determines whether barcode validations are enabled
    • Method Detail

      • onValidateStart

        public void onValidateStart()
        Is called when a validation pass is started.
      • onValidateEnd

        public void onValidateEnd()
        Is called when a validation pass ends.
      • clone

        public FormModel.Validate clone()
        Creates a copy of this Validate. The set of tests enabled is copied, and the number of failures is set to zero.
      • isBarcodeTestEnabled

        public boolean isBarcodeTestEnabled()
        Determines if barcode validation tests are enabled.
        Returns:
        true if barcode validation tests are enabled; otherwise false
      • setBarcodeTestEnabled

        public void setBarcodeTestEnabled​(boolean bEnabled)
        Sets whether barcode validation tests are to be enabled.
        Parameters:
        bEnabled - true if barcode tests are to be performed.
      • isFormatTestEnabled

        public boolean isFormatTestEnabled()
        Determines if format validation tests are enabled.
        Returns:
        true if format validation tests are enabled; otherwise false
      • setFormatTestEnabled

        public void setFormatTestEnabled​(boolean bEnabled)
        Sets whether format validation tests are to be enabled.
        Parameters:
        bEnabled - true if format tests are to be performed.
      • isNullTestEnabled

        public boolean isNullTestEnabled()
        Determines if null validation tests are enabled.
        Returns:
        true if null validation tests are enabled; otherwise false
      • setNullTestEnabled

        public void setNullTestEnabled​(boolean bEnabled)
        Sets whether null validation tests are to be enabled.
        Parameters:
        bEnabled - true if null tests are to be performed.
      • isScriptTestEnabled

        public boolean isScriptTestEnabled()
        Determines if script validation tests are enabled.
        Returns:
        true if script validation tests are enabled; otherwise false
      • setScriptTestEnabled

        public void setScriptTestEnabled​(boolean bEnabled)
        Sets whether script validation tests are to be enabled.
        Parameters:
        bEnabled - true if script tests are to be performed.
      • onValidateBarcodeTestFailed

        public boolean onValidateBarcodeTestFailed​(FormField field,
                                                   java.lang.String sValidationMessage)
        Is called by the validation framework when a barcode validation test fails. This base implementation increments the number of failures and returns true.
        Parameters:
        field - the field containing the barcode test
        sValidationMessage - the validation error message
        Returns:
        true if validation should continue
      • onValidateFormatTestFailed

        public boolean onValidateFormatTestFailed​(FormField field,
                                                  java.lang.String sValidationMessage,
                                                  BooleanHolder bDisableValidate)
        Is called by the validation framework when a format validation test fails. This base implementation increments the number of failures and returns true.
        Parameters:
        field - the field containing the format test
        sValidationMessage - the validation error message
        bDisableValidate - indicates whether future validations for this field should be disabled
        Returns:
        true if validation should continue
      • onValidateNullTestFailed

        public boolean onValidateNullTestFailed​(ProtoableNode node,
                                                java.lang.String sValidationMessage,
                                                BooleanHolder bDisableValidate)
        Is called by the validation framework when a null validation test fails. This base implementation increments the number of failures and returns true.
        Parameters:
        node - the node containing the null test
        sValidationMessage - the validation error message
        bDisableValidate - indicates whether future validations for this ProtoableNode should be disabled
        Returns:
        true if validation should continue
      • onValidateScriptFailed

        public boolean onValidateScriptFailed​(ProtoableNode node,
                                              java.lang.String sScript,
                                              java.lang.String sLanguage,
                                              java.lang.String sValidationMessage,
                                              BooleanHolder bDisableValidate)
        Is called by the validation framework when a script validation test fails. This base implementation increments the number of failures and returns true.
        Parameters:
        node - the node containing the script test
        sScript - the text of the validation script that failed
        sLanguage - the language of the script
        sValidationMessage - the validation error message
        bDisableValidate - indicates whether future validations for this ProtoableNode should be disabled
        Returns:
        true if validation should continue
      • getFailCount

        public int getFailCount()
        Returns the number of validation failures since the fail count was last reset.
        Returns:
        the number of validation failures
      • resetFailCount

        public void resetFailCount()
        Sets the number of validation failures to zero. The validation framework calls this method before it starts each validation pass initiated by:
      • a call to an execValidate method
      • an execute or submit action of an event, or
      • an excit event of a FormSubform or FormExclGroup.
      • This method is not called when FormModel.recalculate(boolean, FormModel.Validate, boolean) is called.