|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.faces.validator.DoubleRangeValidator
com.ibm.xsp.validator.DoubleRangeValidatorEx2
public class DoubleRangeValidatorEx2
Extends the standard double range validator to add support for automatic
client-side validation and computed expressions on the properties.
Corresponds to the xp:validateDoubleRange tag
| Field Summary | |
|---|---|
static java.lang.String |
VALIDATOR_ID
|
| Fields inherited from class javax.faces.validator.DoubleRangeValidator |
|---|
MAXIMUM_MESSAGE_ID, MINIMUM_MESSAGE_ID, TYPE_MESSAGE_ID |
| Fields inherited from interface javax.faces.validator.Validator |
|---|
NOT_IN_RANGE_MESSAGE_ID |
| Constructor Summary | |
|---|---|
DoubleRangeValidatorEx2()
|
|
| Method Summary | |
|---|---|
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. |
javax.faces.component.UIComponent |
getComponent()
Return the associated UIComponent instance. |
protected javax.faces.context.FacesContext |
getFacesContext()
|
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. |
double |
getMaximum()
|
java.lang.String |
getMessage()
Validation error message to be displayed to the user |
double |
getMinimum()
|
javax.faces.el.ValueBinding |
getValueBinding(java.lang.String property)
Return the ValueBinding instance to used to calculate the value for the specified property. |
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setComponent(javax.faces.component.UIComponent component)
This will be called while constructing the component and the UIComponent tree, so no processing should be performed at this stage. |
void |
setMaximum(double maximum)
|
void |
setMessage(java.lang.String message)
Sets the validation error message to be displayed to the user |
void |
setMinimum(double minimum)
|
void |
setValueBinding(java.lang.String property,
javax.faces.el.ValueBinding binding)
Set the ValueBinding instance to used to calculate the value for the specified property. |
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 javax.faces.validator.DoubleRangeValidator |
|---|
equals, isTransient, setTransient |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String VALIDATOR_ID
| Constructor Detail |
|---|
public DoubleRangeValidatorEx2()
| Method Detail |
|---|
public void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
throws javax.faces.validator.ValidatorException
Perform the correctness checks implemented by this
Validator against the specified UIInput.
If any violations are found:
Messages 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.Validatorvalidate in class javax.faces.validator.DoubleRangeValidatorcontext - FacesContext for the request we are processingcomponent - UIInput we are checking for correctnessvalue -
java.lang.NullPointerException - if context
or component is null
javax.faces.validator.ValidatorExceptionpublic void setComponent(javax.faces.component.UIComponent component)
ComponentBindingObject
setComponent in interface ComponentBindingObjectComponentBindingObject.setComponent(javax.faces.component.UIComponent)public javax.faces.component.UIComponent getComponent()
ComponentBindingObject
getComponent in interface ComponentBindingObjectComponentBindingObject.getComponent()public void setMaximum(double maximum)
setMaximum in class javax.faces.validator.DoubleRangeValidatorDoubleRangeValidator.setMaximum(double)public double getMaximum()
getMaximum in class javax.faces.validator.DoubleRangeValidatorprotected javax.faces.context.FacesContext getFacesContext()
public void setMinimum(double minimum)
setMinimum in class javax.faces.validator.DoubleRangeValidatorpublic double getMinimum()
getMinimum in class javax.faces.validator.DoubleRangeValidatorpublic java.lang.String getMessage()
public java.lang.String getInvalidMessage()
ClientSideValidatorThis method may return different values depending on the configuration of the validator.
getInvalidMessage in interface ClientSideValidatorpublic void setMessage(java.lang.String message)
Set the value of the message property.
public javax.faces.el.ValueBinding getValueBinding(java.lang.String property)
ValueBindingObject
getValueBinding in interface ValueBindingObjectproperty - Name of the property
ValueBindingObject.getValueBinding(java.lang.String)
public void setValueBinding(java.lang.String property,
javax.faces.el.ValueBinding binding)
ValueBindingObject
setValueBinding in interface ValueBindingObjectproperty - Name of the propertybinding - The ValueBinding to set, or null to remove an existing ValueBindingValueBindingObject.setValueBinding(java.lang.String,
javax.faces.el.ValueBinding)public java.lang.Object saveState(javax.faces.context.FacesContext context)
saveState in interface javax.faces.component.StateHoldersaveState in class javax.faces.validator.DoubleRangeValidatorLengthValidator.saveState(javax.faces.context.FacesContext)
public void restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
restoreState in interface javax.faces.component.StateHolderrestoreState in class javax.faces.validator.DoubleRangeValidatorLengthValidator.restoreState(javax.faces.context.FacesContext, java.lang.Object)
public java.lang.String generateClientSideValidation(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws java.io.IOException
ClientSideValidatorThe 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 ClientSideValidatorcontext - The current context.component - The control whose value will be validated, usually a
UIInput.
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||