Package lumis.doui.control
Class ValidatorControl
- java.lang.Object
-
- lumis.doui.control.Control
-
- lumis.doui.control.ValidatorControl
-
- All Implemented Interfaces:
javax.servlet.jsp.el.VariableResolver
,IControl
,IValidatorControl
- Direct Known Subclasses:
DateCompareValidatorControl
,DateDataTypeValidatorControl
,FileSizeValidatorControl
,FilterUniqueIdValidator
,HtmlEditorBlocksValidatorControl
,HtmlEditorValidatorControl
,IntegerDataTypeValidatorControl
,LengthValidatorControl
,MultiFileUploadExtensionCheckControl
,MultiFileUploadRequiredValueValidatorControl
,RegularExpressionValidatorControl
,RequiredValueValidatorControl
,SearchQueryValidatorControl
public abstract class ValidatorControl extends Control implements IValidatorControl
Implements generic validation control behaviour. Validation controls generally would extend this object.- Since:
- 4.0.0
- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
clientSideValidationEnabled
static java.lang.String
DEFAULT_VALUE
static java.lang.String
ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE
static java.lang.String
ERROR_TYPE_ERROR_VALIDATING_CONTROL
protected ValidationMessages
messages
static java.lang.String
SOURCE_FIELD_NAME_UNDEFINED
protected java.lang.String[]
validateOnClientSideEvents
-
Fields inherited from class lumis.doui.control.Control
childControls, controlContainer, controlDefinitionNode, controlResource, douiContext, hasValidatorSubControls, isValid, locale, ON_EVENT_CLOSE_WINDOW, ON_EVENT_LINK, ON_EVENT_POPUP_LINK_OR_RUNTIME_INTERFACE, ON_EVENT_POPUP_RUNTIME_INTERFACE, ON_EVENT_PROCESS_ACTION, ON_EVENT_RENDER_ACTION, ON_EVENT_REPLACE_INTERFACE, ON_EVENT_SCRIPT, ON_EVENT_VALIDATE, onEventScripts, PARAMETER_TYPE_FIRST_SELECTED, PARAMETER_TYPE_GET_VALUE, parentControl, resources, type, VALIDATION_SELECTED_MANY, VALIDATION_SELECTED_ONE
-
-
Constructor Summary
Constructors Constructor Description ValidatorControl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
doServerValidation()
Performs the server validation of the controls for this validator.protected java.lang.String
getClientUniqueId()
IResource
getControlResource()
protected IControl
getControlToValidate()
java.util.Collection<java.lang.String>
getControlToValidateIds()
Returns a collection with the ids of the controls to be validated by this validator control.protected java.lang.String
getControlToValidateSourceFieldName()
Returns the source field name associated with the control to be validated.protected java.lang.String[]
getDefaultMessageParameters()
protected ValidationMessages
getDefaultMessages(java.lang.String errorType)
java.lang.String
getLocalizedErrorMessage()
Returns the error message generated for the control.protected ValidationMessages
getMessages()
protected ValidationMessages
getMessages(java.lang.String errorType)
java.lang.String
getScriptClear()
Clears the message displayed by this validator.protected java.lang.String
getScriptSetMessages(java.lang.String errorType, ITransaction portalTransaction)
protected java.lang.String
getScriptSetMessages(ValidationMessages validationMessages, ITransaction portalTransaction)
protected java.lang.String
getScriptSetMessages(ITransaction portalTransaction)
java.lang.String
getScriptValidate()
Returns the code that needs to be executed on the client side for this validation.java.lang.String
getScriptValidateRegistration()
Returns a script that must be placed on the page.java.lang.String
getScriptValidationFunctionName()
Returns the name of the client side validation function.protected void
includeScripts()
void
init(org.w3c.dom.Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl)
boolean
isClientSideValidationEnabled()
Verify if the parameter ClienteSideValidation is enable.boolean
isValidateOnlyIfVisible()
Returns if this validator will perform the validation only if the validated control is visible.boolean
serverValidate()
Validates all dependent control values on the server sidevoid
setRenderData()
-
Methods inherited from class lumis.doui.control.Control
appendSubControl, appendSubControls, applyOnEventScripts, buildSubControls, convertToStandardValue, createContainer, disconnect, fixedIdentifierRequired, generateControlId, generateControlIdPrefix, getAdditionalParameters, getAdditionalParameters, getAncestor, getChildControls, getClientEventHandlerScript, getId, getLocale, getName, getNamespace, getParentControl, getPrepareForReadScript, getRenderData, getResources, getRuntimeDefaultSource, getScriptActionValidation, getSourceContext, getStringsToLocalize, getType, getValidationScript, getWindowProperties, getWindowProperties, isRequired, isValid, localize, localizeStrings, processCustomTags, registerOnEventScript, removeChild, removeChildren, resolveVariable, setName, setRuntimeAttributes, setValid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.doui.control.IControl
buildSubControls, createContainer, disconnect, getChildControls, getId, getName, getParentControl, getPrepareForReadScript, getRenderData, getResources, getType, isValid, registerOnEventScript, removeChild, removeChildren, setRuntimeAttributes, setValid
-
Methods inherited from interface lumis.doui.control.IValidatorControl
getScriptValidationFunctionImplementation
-
-
-
-
Field Detail
-
DEFAULT_VALUE
public static final java.lang.String DEFAULT_VALUE
- See Also:
- Constant Field Values
-
ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE
public static final java.lang.String ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE
- See Also:
- Constant Field Values
-
ERROR_TYPE_ERROR_VALIDATING_CONTROL
public static final java.lang.String ERROR_TYPE_ERROR_VALIDATING_CONTROL
- See Also:
- Constant Field Values
-
SOURCE_FIELD_NAME_UNDEFINED
public static final java.lang.String SOURCE_FIELD_NAME_UNDEFINED
- See Also:
- Constant Field Values
-
clientSideValidationEnabled
protected boolean clientSideValidationEnabled
-
validateOnClientSideEvents
protected java.lang.String[] validateOnClientSideEvents
-
messages
protected ValidationMessages messages
-
-
Method Detail
-
init
public void init(org.w3c.dom.Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl) throws PortalException
- Specified by:
init
in interfaceIControl
- Overrides:
init
in classControl
- Throws:
PortalException
-
serverValidate
public boolean serverValidate() throws PortalException
Validates all dependent control values on the server sideThis method does not perform the actual validation. Instead it performs some checks and calls
doServerValidation()
to perform the validation accordingly.Instead of overriding this method, you should override the
doServerValidation()
method.- Specified by:
serverValidate
in interfaceIValidatorControl
- Returns:
- true if controls are valid and false if not
- Throws:
ControlException
PortalException
-
doServerValidation
protected boolean doServerValidation() throws PortalException
Performs the server validation of the controls for this validator.- Returns:
- false if the validation failed, true otherwise.
- Throws:
PortalException
- Since:
- 4.1.0
- See Also:
serverValidate()
-
setRenderData
public void setRenderData() throws PortalException
- Specified by:
setRenderData
in interfaceIControl
- Overrides:
setRenderData
in classControl
- Throws:
PortalException
-
getLocalizedErrorMessage
public java.lang.String getLocalizedErrorMessage() throws PortalException
Description copied from interface:IValidatorControl
Returns the error message generated for the control. Null if no error message.- Specified by:
getLocalizedErrorMessage
in interfaceIValidatorControl
- Returns:
- the error message.
- Throws:
PortalException
-
includeScripts
protected void includeScripts() throws PortalException
- Throws:
PortalException
-
getScriptValidate
public java.lang.String getScriptValidate() throws PortalException
Description copied from interface:IValidatorControl
Returns the code that needs to be executed on the client side for this validation. Usually returns a call to the validation function name. e.g. return value: Validate_- Specified by:
getScriptValidate
in interfaceIValidatorControl
- Returns:
- a String.
- Throws:
PortalException
-
getScriptClear
public java.lang.String getScriptClear() throws PortalException
Description copied from interface:IValidatorControl
Clears the message displayed by this validator.- Specified by:
getScriptClear
in interfaceIValidatorControl
- Returns:
- a String.
- Throws:
PortalException
-
getScriptValidationFunctionName
public final java.lang.String getScriptValidationFunctionName() throws PortalException
Description copied from interface:IValidatorControl
Returns the name of the client side validation function. e.g. return value: Validate_- Specified by:
getScriptValidationFunctionName
in interfaceIValidatorControl
- Returns:
- the validation function name that was registered for this validator
- Throws:
PortalException
-
getScriptValidateRegistration
public final java.lang.String getScriptValidateRegistration() throws PortalException
Description copied from interface:IValidatorControl
Returns a script that must be placed on the page. This script contains function to perform client side validation. This method internally calls getScriptValidationFunctionImplementation() to get the code for validation.- Specified by:
getScriptValidateRegistration
in interfaceIValidatorControl
- Returns:
- script that is used for performing client side validation.
- Throws:
PortalException
-
getControlResource
public IResource getControlResource() throws PortalException
- Specified by:
getControlResource
in interfaceIControl
- Overrides:
getControlResource
in classControl
- Throws:
PortalException
-
isClientSideValidationEnabled
public boolean isClientSideValidationEnabled()
Description copied from interface:IValidatorControl
Verify if the parameter ClienteSideValidation is enable.- Specified by:
isClientSideValidationEnabled
in interfaceIValidatorControl
- Returns:
- true if the ClienteSideValidation is enable and false otherwise.
-
isValidateOnlyIfVisible
public boolean isValidateOnlyIfVisible()
Returns if this validator will perform the validation only if the validated control is visible.- Returns:
- true if it will validate only if the control is visible, false if the control will be validated even if it is not visible.
- Since:
- 4.1.0
-
getScriptSetMessages
protected java.lang.String getScriptSetMessages(ITransaction portalTransaction) throws PortalException
- Throws:
PortalException
-
getScriptSetMessages
protected java.lang.String getScriptSetMessages(java.lang.String errorType, ITransaction portalTransaction) throws PortalException
- Throws:
PortalException
-
getScriptSetMessages
protected java.lang.String getScriptSetMessages(ValidationMessages validationMessages, ITransaction portalTransaction) throws PortalException
- Throws:
PortalException
-
getClientUniqueId
protected java.lang.String getClientUniqueId()
-
getControlToValidateIds
public java.util.Collection<java.lang.String> getControlToValidateIds() throws PortalException
Description copied from interface:IValidatorControl
Returns a collection with the ids of the controls to be validated by this validator control.- Specified by:
getControlToValidateIds
in interfaceIValidatorControl
- Returns:
- a collection with the controls ids.
- Throws:
PortalException
-
getControlToValidateSourceFieldName
protected java.lang.String getControlToValidateSourceFieldName() throws PortalException
Returns the source field name associated with the control to be validated. This is used to generate a friendly message to the end user with the appropriate field name. e.g. "Title: required field"- Returns:
- Throws:
PortalException
-
getMessages
protected ValidationMessages getMessages() throws PortalException
- Throws:
PortalException
-
getMessages
protected ValidationMessages getMessages(java.lang.String errorType) throws PortalException
- Throws:
PortalException
-
getDefaultMessages
protected ValidationMessages getDefaultMessages(java.lang.String errorType) throws PortalException
- Throws:
PortalException
-
getDefaultMessageParameters
protected java.lang.String[] getDefaultMessageParameters() throws PortalException
- Throws:
PortalException
-
getControlToValidate
protected IControl getControlToValidate() throws PortalException
- Throws:
PortalException
-
-