Class CmsValidationController
- java.lang.Object
-
- org.opencms.gwt.client.validation.CmsValidationController
-
- All Implemented Interfaces:
I_CmsValidationController
public class CmsValidationController extends java.lang.Object implements I_CmsValidationController
This class is responsible for coordinating the synchronous and asynchronous validation for a set of form fields.- Since:
- 8.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Collection<I_CmsFormField>
m_fields
The list of form fields which should be validated.protected java.util.Map<java.lang.String,org.opencms.gwt.shared.CmsValidationQuery>
m_validationQueries
A map containing all validation queries which should be executed asynchronously.
-
Constructor Summary
Constructors Constructor Description CmsValidationController(java.util.Collection<I_CmsFormField> fields, I_CmsValidationHandler handler)
Creates a new validation controller for a list of form fields.CmsValidationController(I_CmsFormField field, I_CmsValidationHandler handler)
Creates a new validation controller for a single form field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getId()
Returns the id of this validation controller.java.util.Set<java.lang.String>
getValidatedFields()
Returns the set of fields which have been validated.protected void
internalStartValidation()
Starts the validation.protected void
onReceiveValidationResults(java.util.Map<java.lang.String,org.opencms.gwt.shared.CmsValidationResult> results)
Internal method which is executed when the results of the asynchronous validation are received from the server.void
provideValidationResult(java.lang.String field, org.opencms.gwt.shared.CmsValidationResult result)
Reports the result of a synchronous validation.void
setFormValidator(java.lang.String formValidatorClass)
Sets the form validator class name for this validation controller.void
setFormValidatorConfig(java.lang.String formValidatorConfig)
Sets the form validator configuration string.void
startValidation()
Starts the validation.void
validateAsync(java.lang.String field, java.lang.String value, java.lang.String validator, java.lang.String config)
Requests an server-side validation to be performed later.
-
-
-
Field Detail
-
m_fields
protected java.util.Collection<I_CmsFormField> m_fields
The list of form fields which should be validated.
-
m_validationQueries
protected java.util.Map<java.lang.String,org.opencms.gwt.shared.CmsValidationQuery> m_validationQueries
A map containing all validation queries which should be executed asynchronously.
-
-
Constructor Detail
-
CmsValidationController
public CmsValidationController(java.util.Collection<I_CmsFormField> fields, I_CmsValidationHandler handler)
Creates a new validation controller for a list of form fields.- Parameters:
fields
- the fields which should be validatedhandler
- the validation handler
-
CmsValidationController
public CmsValidationController(I_CmsFormField field, I_CmsValidationHandler handler)
Creates a new validation controller for a single form field.- Parameters:
field
- the form fieldhandler
- the validation handler
-
-
Method Detail
-
getId
public int getId()
Returns the id of this validation controller.- Returns:
- an id
-
getValidatedFields
public java.util.Set<java.lang.String> getValidatedFields()
Returns the set of fields which have been validated.- Returns:
- the set of validated fields
-
provideValidationResult
public void provideValidationResult(java.lang.String field, org.opencms.gwt.shared.CmsValidationResult result)
Description copied from interface:I_CmsValidationController
Reports the result of a synchronous validation.- Specified by:
provideValidationResult
in interfaceI_CmsValidationController
- Parameters:
field
- the field nameresult
- the validation result- See Also:
I_CmsValidationController.provideValidationResult(java.lang.String, org.opencms.gwt.shared.CmsValidationResult)
-
setFormValidator
public void setFormValidator(java.lang.String formValidatorClass)
Sets the form validator class name for this validation controller.- Parameters:
formValidatorClass
- the class name of the form validator
-
setFormValidatorConfig
public void setFormValidatorConfig(java.lang.String formValidatorConfig)
Sets the form validator configuration string.a
- Parameters:
formValidatorConfig
- the form validator configuration string
-
startValidation
public void startValidation()
Starts the validation.This uses the
CmsValidationScheduler
, so the validation only starts after the currently running or scheduled validations have finished running.
-
validateAsync
public void validateAsync(java.lang.String field, java.lang.String value, java.lang.String validator, java.lang.String config)
Description copied from interface:I_CmsValidationController
Requests an server-side validation to be performed later.- Specified by:
validateAsync
in interfaceI_CmsValidationController
- Parameters:
field
- the field namevalue
- the value of the fieldvalidator
- the server-side validator class nameconfig
- the configuration string for the server-side validator- See Also:
I_CmsValidationController.validateAsync(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
-
internalStartValidation
protected void internalStartValidation()
Starts the validation.
-
onReceiveValidationResults
protected void onReceiveValidationResults(java.util.Map<java.lang.String,org.opencms.gwt.shared.CmsValidationResult> results)
Internal method which is executed when the results of the asynchronous validation are received from the server.- Parameters:
results
- the validation results
-
-