|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.xsp.complex.ValueBindingObjectImpl com.ibm.xsp.validator.AbstractValidator com.ibm.xsp.validator.DateTimeRangeValidator
public class DateTimeRangeValidator
Extends the standard date time range validator to add support for automatic
client-side validation and computed expressions on it's properties.
Corresponds to the xp:validateDateTimeRange
tag
Field Summary |
---|
Fields inherited from interface javax.faces.validator.Validator |
---|
NOT_IN_RANGE_MESSAGE_ID |
Constructor Summary | |
---|---|
DateTimeRangeValidator()
|
Method Summary | |
---|---|
protected void |
calculateTimeAndPrintErrors(java.util.Date value,
javax.faces.context.FacesContext context,
javax.faces.component.UIInput component)
Protected method. |
protected java.util.Date |
convertToDate(java.lang.Object value)
Protected method. |
java.lang.String |
generateClientSideValidation(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Generate client side validation, a snippet of browser JavaScript in a single line, creating an instance of a Validator object matching the format described in xspClientDojo.js, the attachValidator function. |
java.lang.String |
getInvalidMessage()
Unlike server-side validators which display different error messages depending on the exact way that validation fails, client side validators usually have only one error message. |
java.util.Date |
getMaximum()
Returns the maximum date in the range to be validated, or null if there is no upper bound. |
java.util.Date |
getMinimum()
Returns the minimum date in the range to be validated, or null if there is no lower bound. |
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setMaximum(java.util.Date maximum)
Sets the maximum Date considered valid as a value for the control. |
void |
setMinimum(java.util.Date minimum)
Sets the minimum Date considered valid as a value for the control. |
void |
validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
Perform the correctness checks implemented by this Validator against the specified UIInput . |
Methods inherited from class com.ibm.xsp.validator.AbstractValidator |
---|
addInputInvalidMessage, createNullContextOrComponentEx, createValidatorEx, getInvalidRangeMessage, getMessage, getNotCorrectTypeMessage, setMessage |
Methods inherited from class com.ibm.xsp.complex.ValueBindingObjectImpl |
---|
getComponent, getFacesContext, getValueBinding, isTransient, setComponent, setTransient, setValueBinding |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateTimeRangeValidator()
Method Detail |
---|
public java.lang.String generateClientSideValidation(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
ClientSideValidator
The file xspClientDojo.js is reference in the source of every XPage. The version with comments is installed with Designer under the Data/domino/js folder, in a file named xspClientDojo.js.uncompressed.js.
The constructor of the Validator object should be passed any values needed to perform the validation (e.g. for a range validator the minimum and maximum values would be included). The translated error message to display if the error occurs should be passed to the validator too. Generally the server-side validators translate a default error message and allow the page designer to override the default in a "message" property.
generateClientSideValidation
in interface ClientSideValidator
context
- The current context.component
- The control whose value will be validated, usually a
UIInput
.
java.io.IOException
public java.util.Date getMinimum()
null
if there is no lower bound.
public void setMinimum(java.util.Date minimum)
java.util.Date
- public java.util.Date getMaximum()
null
if there is no upper bound.
public void setMaximum(java.util.Date maximum)
java.util.Date
- public java.lang.String getInvalidMessage()
ClientSideValidator
This method may return different values depending on the configuration of the validator.
getInvalidMessage
in interface ClientSideValidator
public java.lang.Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
saveState
in class AbstractValidator
public void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
restoreState
in interface javax.faces.component.StateHolder
restoreState
in class AbstractValidator
protected java.util.Date convertToDate(java.lang.Object value)
public void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value) throws javax.faces.FacesException
Perform the correctness checks implemented by this
Validator
against the specified UIInput
.
If any violations are found:
Message
s to the specified
FacesContext
, specifying this UIInput
as
associated with the message, describing the nature of the
violation(s) encountered.valid
property on the specified
UIInput
to false
.
validate
in interface javax.faces.validator.Validator
context
- FacesContext for the request we are processingcomponent
- UIInput we are checking for correctnessvalue
- to be validated
java.lang.NullPointerException
- if context
or component
is null
javax.faces.FacesException
protected void calculateTimeAndPrintErrors(java.util.Date value, javax.faces.context.FacesContext context, javax.faces.component.UIInput component)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |