lumis.doui.control.validator
Class DateCompareValidatorControl

Package class diagram package DateCompareValidatorControl
java.lang.Object
  extended by lumis.doui.control.Control
      extended by lumis.doui.control.ValidatorControl
          extended by lumis.doui.control.validator.DateCompareValidatorControl
All Implemented Interfaces:
VariableResolver, IControl, IValidatorControl

public class DateCompareValidatorControl
extends ValidatorControl

A date comparision validator control. This class is designed to compare the date value of two Doui Controls that implement the IClientSideReadableControl. These controls must implement a protected method named getScriptGetValuesFunctionImplementation in which a client-side javascript code returns a array of size 2. On the first position (index 0), the date must be returned. On the second position (index 1), the time must be returned. In case the controls being validated only contains date, this array must return on the second position a empty string.

The XML structure for declaring this control is:

<control type="lum_dateCompareValidator" controlToValidateId="" compareToControlId="" operator="" dateFormat="" timeFormat="" />

controlToValidateId: This attribute must contain the Id of the Doui Control that you want to validate. It can be ommited if the validation control is declard within the control you want to validade.

compareToControlId: This attribute specifies the Id of the Doui Control you want to compare the value of the control being validated.

operator: equal, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual.

dateFormat and timeFormat: specifies the date and time format. If not declared, will use the default date format for the current language locale being used.

Generates client side and server side validation that compares date values of two controls. The comparison may be either equal, lessThan, lessThanOrEqual, greaterThan or greaterThanOrEqual.

Example use: <control:lum_dateCompareValidator controlToValidateId="endDate" compareToControlId="startDate" operator="greaterThanOrEqual" /> xml data available for xsl rendering: <control id="8A488A03115BCABC01115BD4864700A4" type="lum_dateDataTypeValidator"> <script><!-- validation javascript --></script><noscript>Lumis portal script</noscript> <data> <clientUniqueId>Form_8A488A031150E33501115107712D01FC8A488A03115BCABC01115BD4864700A4</clientUniqueId> </data> </control>

Since:
4.0.9

Field Summary
protected  String compareToArgument
           
protected static String CONTROL_PARAMETER_DATE_FORMAT_PATTERN
           
protected static String CONTROL_PARAMETER_TIME_FORMAT_PATTERN
           
protected  String controlToValidateId
           
protected  String dateFormat
           
protected  String operatorType
           
protected  SimpleDateFormat sdfDate
           
protected  SimpleDateFormat sdfDateTime
           
protected  String timeFormat
           
static String TYPE_OPERATOR_EQUAL
           
static String TYPE_OPERATOR_GREATER_THAN
           
static String TYPE_OPERATOR_GREATER_THAN_OR_EQUAL
           
static String TYPE_OPERATOR_LESS_THAN
           
static String TYPE_OPERATOR_LESS_THAN_OR_EQUAL
           
 
Fields inherited from class lumis.doui.control.ValidatorControl
clientSideValidationEnabled, DEFAULT_VALUE, ERROR_TYPE_CONTROL_BEING_VALIDATED_IS_NOT_CLIENT_SIDE_READABLE, ERROR_TYPE_ERROR_VALIDATING_CONTROL, messages, SOURCE_FIELD_NAME_UNDEFINED, 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
DateCompareValidatorControl()
           
 
Method Summary
 boolean doServerValidation()
          Performs the server validation of the controls for this validator.
 IResource getControlResource()
           
protected  String[] getDefaultMessageParameters()
           
protected  ValidationMessages getDefaultMessages(String errorType)
           
 String getScriptValidationFunctionImplementation()
          Returns the client side code that must be placed in a client side function to perform the validation
protected  void includeScripts()
           
 void init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl)
           
 
Methods inherited from class lumis.doui.control.ValidatorControl
getClientUniqueId, getControlToValidate, getControlToValidateIds, getControlToValidateSourceFieldName, getMessages, getMessages, getScriptClear, getScriptSetMessages, getScriptSetMessages, getScriptSetMessages, getScriptValidate, getScriptValidateRegistration, getScriptValidationFunctionName, isClientSideValidationEnabled, isValidateOnlyIfVisible, serverValidate, setRenderData
 
Methods inherited from class lumis.doui.control.Control
appendSubControl, appendSubControls, applyOnEventScripts, buildSubControls, convertToStandardValue, createContainer, disconnect, fixedIdentifierRequired, generateControlId, getAdditionalParameters, getAncestor, getChildControls, getClientEventHandlerScript, getId, getLocale, 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.IControl
buildSubControls, createContainer, disconnect, getChildControls, getId, getParentControl, getPrepareForReadScript, getRenderData, getResources, getType, isValid, registerOnEventScript, removeChild, removeChildren, setRuntimeAttributes, setValid
 

Field Detail

TYPE_OPERATOR_EQUAL

public static String TYPE_OPERATOR_EQUAL

TYPE_OPERATOR_LESS_THAN

public static String TYPE_OPERATOR_LESS_THAN

TYPE_OPERATOR_LESS_THAN_OR_EQUAL

public static String TYPE_OPERATOR_LESS_THAN_OR_EQUAL

TYPE_OPERATOR_GREATER_THAN

public static String TYPE_OPERATOR_GREATER_THAN

TYPE_OPERATOR_GREATER_THAN_OR_EQUAL

public static String TYPE_OPERATOR_GREATER_THAN_OR_EQUAL

CONTROL_PARAMETER_DATE_FORMAT_PATTERN

protected static final String CONTROL_PARAMETER_DATE_FORMAT_PATTERN
See Also:
Constant Field Values

CONTROL_PARAMETER_TIME_FORMAT_PATTERN

protected static final String CONTROL_PARAMETER_TIME_FORMAT_PATTERN
See Also:
Constant Field Values

dateFormat

protected String dateFormat

timeFormat

protected String timeFormat

operatorType

protected String operatorType

controlToValidateId

protected String controlToValidateId

compareToArgument

protected String compareToArgument

sdfDateTime

protected SimpleDateFormat sdfDateTime

sdfDate

protected SimpleDateFormat sdfDate
Constructor Detail

DateCompareValidatorControl

public DateCompareValidatorControl()
Method Detail

init

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

doServerValidation

public boolean doServerValidation()
                           throws PortalException
Description copied from class: ValidatorControl
Performs the server validation of the controls for this validator.

Overrides:
doServerValidation in class ValidatorControl
Returns:
false if the validation failed, true otherwise.
Throws:
PortalException
See Also:
ValidatorControl.serverValidate()

getDefaultMessages

protected ValidationMessages getDefaultMessages(String errorType)
                                         throws ControlException,
                                                PortalException
Overrides:
getDefaultMessages in class ValidatorControl
Throws:
ControlException
PortalException

getDefaultMessageParameters

protected String[] getDefaultMessageParameters()
                                        throws PortalException
Overrides:
getDefaultMessageParameters in class ValidatorControl
Throws:
PortalException

includeScripts

protected void includeScripts()
                       throws ControlException,
                              PortalException
Overrides:
includeScripts in class ValidatorControl
Throws:
ControlException
PortalException

getScriptValidationFunctionImplementation

public String getScriptValidationFunctionImplementation()
                                                 throws PortalException
Description copied from interface: IValidatorControl
Returns the client side code that must be placed in a client side function to perform the validation

Returns:
a String.
Throws:
PortalException

getControlResource

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


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