Package lumis.doui.control.validator
Class DateCompareValidatorControl
- java.lang.Object
-
- lumis.doui.control.Control
-
- lumis.doui.control.ValidatorControl
-
- 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. These controls must register a getValue javascript function (see javascript method lumis/doui/client/script/LumisDoui.js - registerGetValueFunction(formName, controlId, pFunction) for more details) that returns an 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:
xml data available for xsl rendering:<control:lum_dateCompareValidator controlToValidateId="endDate" compareToControlId="startDate" operator="greaterThanOrEqual" />
<control id="8A488A03115BCABC01115BD4864700A4" type="lum_dateDataTypeValidator"> <script><!-- validation javascript --></script> <data> <clientUniqueId>Form_8A488A031150E33501115107712D01FC8A488A03115BCABC01115BD4864700A4</clientUniqueId> </data> </control>
- Since:
- 4.0.9
- Version:
- $Revision: 22315 $ $Date: 2019-01-25 18:30:16 -0200 (Fri, 25 Jan 2019) $
-
-
Field Summary
Fields Modifier and Type Field Description 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_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 DateCompareValidatorControl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 validationprotected void
includeScripts()
void
init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl)
-
Methods inherited from class lumis.doui.control.ValidatorControl
getClientUniqueId, getControlToValidate, getControlToValidateIds, getControlToValidateSourceFieldName, getLocalizedErrorMessage, 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, 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
-
-
-
-
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
-
-
Method Detail
-
init
public void init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl) throws PortalException
- Specified by:
init
in interfaceIControl
- Overrides:
init
in classValidatorControl
- 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 classValidatorControl
- 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 classValidatorControl
- Throws:
ControlException
PortalException
-
getDefaultMessageParameters
protected String[] getDefaultMessageParameters() throws PortalException
- Overrides:
getDefaultMessageParameters
in classValidatorControl
- Throws:
PortalException
-
includeScripts
protected void includeScripts() throws ControlException, PortalException
- Overrides:
includeScripts
in classValidatorControl
- 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 interfaceIControl
- Overrides:
getControlResource
in classValidatorControl
- Throws:
PortalException
-
-