lumis.doui.control
Class ValidatorControl

Package class diagram package ValidatorControl
java.lang.Object
  extended by lumis.doui.control.Control
      extended by lumis.doui.control.ValidatorControl
All Implemented Interfaces:
VariableResolver, IControl, IValidatorControl
Direct Known Subclasses:
DateCompareValidatorControl, DateDataTypeValidatorControl, FileSizeValidatorControl, FilterUniqueIdValidator, HtmlEditorValidatorControl, IntegerDataTypeValidatorControl, LengthValidatorControl, 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

Field Summary
protected  boolean clientSideValidationEnabled
           
static String DEFAULT_VALUE
           
static String ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE
           
static String ERROR_TYPE_ERROR_VALIDATING_CONTROL
           
protected  ValidationMessages messages
           
static String SOURCE_FIELD_NAME_UNDEFINED
           
protected  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_SCRIPT, onEventScripts, PARAMETER_TYPE_FIRST_SELECTED, PARAMETER_TYPE_GET_VALUE, parentControl, resources, type, VALIDATION_SELECTED_MANY, VALIDATION_SELECTED_ONE
 
Constructor Summary
ValidatorControl()
           
 
Method Summary
protected  boolean doServerValidation()
          Performs the server validation of the controls for this validator.
protected  String getClientUniqueId()
           
 IResource getControlResource()
           
protected  IControl getControlToValidate()
           
 Collection<String> getControlToValidateIds()
          Returns a collection with the ids of the controls to be validated by this validator control.
protected  String getControlToValidateSourceFieldName()
          Returns the source field name associated with the control to be validated.
protected  String[] getDefaultMessageParameters()
           
protected  ValidationMessages getDefaultMessages(String errorType)
           
protected  ValidationMessages getMessages()
           
protected  ValidationMessages getMessages(String errorType)
           
 String getScriptClear()
          Clears the message displayed by this validator.
protected  String getScriptSetMessages(ITransaction portalTransaction)
           
protected  String getScriptSetMessages(String errorType, ITransaction portalTransaction)
           
protected  String getScriptSetMessages(ValidationMessages validationMessages, ITransaction portalTransaction)
           
 String getScriptValidate()
          Returns the code that needs to be executed on the client side for this validation.
 String getScriptValidateRegistration()
          Returns a script that must be placed on the page.
 String getScriptValidationFunctionName()
          Returns the name of the client side validation function.
protected  void includeScripts()
           
 void init(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 side
 void setRenderData()
           
 
Methods inherited from class lumis.doui.control.Control
appendSubControl, appendSubControls, applyOnEventScripts, buildSubControls, convertToStandardValue, createContainer, disconnect, fixedIdentifierRequired, generateControlId, getAdditionalParameters, getAdditionalParameters, getAncestor, getChildControls, getClientEventHandlerScript, getId, getLocale, getNamespace, getParentControl, getPrepareForReadScript, getRenderData, getResources, getRuntimeDefaultSource, getScriptActionValidation, getScriptGetValues, getScriptGetValuesFunctionImplementation, getScriptGetValuesFunctionName, getScriptGetValuesRegistration, getSourceContext, getStringsToLocalize, getType, getValidationScript, isValid, localize, localizeStrings, processCustomTags, registerOnEventScript, removeChild, removeChildren, resolveVariable, 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.IValidatorControl
getScriptValidationFunctionImplementation
 
Methods inherited from interface lumis.doui.control.IControl
buildSubControls, createContainer, disconnect, getChildControls, getId, getParentControl, getPrepareForReadScript, getRenderData, getResources, getType, isValid, registerOnEventScript, removeChild, removeChildren, setRuntimeAttributes, setValid
 

Field Detail

DEFAULT_VALUE

public static final String DEFAULT_VALUE
See Also:
Constant Field Values

ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE

public static final String ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE
See Also:
Constant Field Values

ERROR_TYPE_ERROR_VALIDATING_CONTROL

public static final String ERROR_TYPE_ERROR_VALIDATING_CONTROL
See Also:
Constant Field Values

SOURCE_FIELD_NAME_UNDEFINED

public static final String SOURCE_FIELD_NAME_UNDEFINED
See Also:
Constant Field Values

clientSideValidationEnabled

protected boolean clientSideValidationEnabled

validateOnClientSideEvents

protected String[] validateOnClientSideEvents

messages

protected ValidationMessages messages
Constructor Detail

ValidatorControl

public ValidatorControl()
Method Detail

init

public void init(Node controlDefinitionNode,
                 ControlContainer controlContainer,
                 IControl parentControl)
          throws PortalException
Specified by:
init in interface IControl
Overrides:
init in class Control
Throws:
PortalException

serverValidate

public boolean serverValidate()
                       throws PortalException
Validates all dependent control values on the server side

This 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 interface IValidatorControl
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 interface IControl
Overrides:
setRenderData in class Control
Throws:
PortalException

includeScripts

protected void includeScripts()
                       throws PortalException
Throws:
PortalException

getScriptValidate

public 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 interface IValidatorControl
Returns:
a String.
Throws:
PortalException

getScriptClear

public String getScriptClear()
                      throws PortalException
Description copied from interface: IValidatorControl
Clears the message displayed by this validator.

Specified by:
getScriptClear in interface IValidatorControl
Returns:
a String.
Throws:
PortalException

getScriptValidationFunctionName

public final 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 interface IValidatorControl
Returns:
the validation function name that was registered for this validator
Throws:
PortalException

getScriptValidateRegistration

public final 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 interface IValidatorControl
Returns:
script that is used for performing client side validation.
Throws:
PortalException

getControlResource

public IResource getControlResource()
                             throws PortalException
Specified by:
getControlResource in interface IControl
Overrides:
getControlResource in class Control
Throws:
PortalException

isClientSideValidationEnabled

public boolean isClientSideValidationEnabled()
Description copied from interface: IValidatorControl
Verify if the parameter ClienteSideValidation is enable.

Specified by:
isClientSideValidationEnabled in interface IValidatorControl
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 String getScriptSetMessages(ITransaction portalTransaction)
                               throws PortalException
Throws:
PortalException

getScriptSetMessages

protected String getScriptSetMessages(String errorType,
                                      ITransaction portalTransaction)
                               throws PortalException
Throws:
PortalException

getScriptSetMessages

protected String getScriptSetMessages(ValidationMessages validationMessages,
                                      ITransaction portalTransaction)
                               throws PortalException
Throws:
PortalException

getClientUniqueId

protected String getClientUniqueId()

getControlToValidateIds

public Collection<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 interface IValidatorControl
Returns:
a collection with the controls ids.
Throws:
PortalException

getControlToValidateSourceFieldName

protected 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(String errorType)
                                  throws PortalException
Throws:
PortalException

getDefaultMessages

protected ValidationMessages getDefaultMessages(String errorType)
                                         throws PortalException
Throws:
PortalException

getDefaultMessageParameters

protected String[] getDefaultMessageParameters()
                                        throws PortalException
Throws:
PortalException

getControlToValidate

protected IControl getControlToValidate()
                                 throws PortalException
Throws:
PortalException


Lumisportal  5.5.0.091130 - Copyright © 2001-2007, Lumis. All Rights Reserved.