org.javalid.external.jsf.ui.validator
Class JvComponentValidator

java.lang.Object
  extended by org.javalid.external.jsf.ui.validator.JvComponentValidator
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

public class JvComponentValidator
extends java.lang.Object
implements javax.faces.validator.Validator, javax.faces.component.StateHolder, java.io.Serializable

This validator allows validation of a single property (in contrast to the normal JV framework behavior). It might be convenient to use the standard JSF validation mechanism in your pages sometimes. However for more sophisticated validation you are encouraged to use JvJsfUpdateValuesPhaseListener as that one allows the full power offered by JaValid. Or use the AnnotationValidator directly yourself.

IMPORTANT: Make sure that if your EditableValueHolder component (e.g. inputfield), if it is a required value, to set it to required in the jsf component! Not doing so, will skip validation (and thus this validator), resulting in undesired behavior! The cause to this is the way JSF implements the UIInput...

Changes for 1.0.1:

Since:
1.0
Version:
1.0.1
Author:
M.Reuvers
See Also:
Serialized Form

Field Summary
static java.lang.String VALIDATOR_ID
           
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
JvComponentValidator()
           
JvComponentValidator(java.lang.String group, boolean active)
           
 
Method Summary
 java.lang.String getGroup()
           
 boolean isActive()
           
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext facesContext, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext facesContext)
           
 void setActive(boolean active)
           
 void setGroup(java.lang.String group)
           
 void setTransient(boolean b)
           
 void validate(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, java.lang.Object objectValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final java.lang.String VALIDATOR_ID
See Also:
Constant Field Values
Constructor Detail

JvComponentValidator

public JvComponentValidator()

JvComponentValidator

public JvComponentValidator(java.lang.String group,
                            boolean active)
Method Detail

validate

public void validate(javax.faces.context.FacesContext facesContext,
                     javax.faces.component.UIComponent component,
                     java.lang.Object objectValue)
              throws javax.faces.validator.ValidatorException
Specified by:
validate in interface javax.faces.validator.Validator
Throws:
javax.faces.validator.ValidatorException

setGroup

public void setGroup(java.lang.String group)

getGroup

public java.lang.String getGroup()

setActive

public void setActive(boolean active)

isActive

public boolean isActive()

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext facesContext)
Specified by:
saveState in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext facesContext,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean b)
Specified by:
setTransient in interface javax.faces.component.StateHolder