org.apache.myfaces.trinidad.validator
Class DateRestrictionValidator

java.lang.Object
  extended by org.apache.myfaces.trinidad.validator.DateRestrictionValidator
All Implemented Interfaces:
EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

@JSFValidator(configExcluded=true)
public class DateRestrictionValidator
extends Object
implements javax.faces.validator.Validator, javax.faces.component.StateHolder


Field Summary
static String DAY_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the valid days value check fails.
static String MONTH_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the valid month value check fails.
static String VALIDATOR_ID
           
static String WEEKDAY_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the valid weekdays value check fails.
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
DateRestrictionValidator()
          Construct a Validator with no preconfigured limits.
 
Method Summary
 boolean equals(Object o)
           
protected  Calendar getCalendar()
           
protected static Date getDateValue(Object value)
          Parses the already converted value to a java.util.Date.
 String getHintInvalidDaysOfWeek()
          Return custom hint invalidDaysOfWeek message.
 String getHintInvalidMonths()
          Return custom hint invalidMonths message.
 DateListProvider getInvalidDays()
           
 String[] getInvalidDaysOfWeek()
           
 String[] getInvalidMonths()
           
 String getMessageDetailInvalidDays()
           
 String getMessageDetailInvalidDaysOfWeek()
           
 String getMessageDetailInvalidMonths()
           
 javax.faces.el.ValueBinding getValueBinding(String name)
          Deprecated.  
 javax.el.ValueExpression getValueExpression(String name)
          Return the ValueExpression used to calculate the value for the specified attribute name, if any.
 int hashCode()
           
 boolean isDisabled()
          Return whether it is disabled.
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
 Object saveState(javax.faces.context.FacesContext context)
           
 void setDisabled(boolean isDisabled)
          Return whether it is disabled.
 void setHintInvalidDaysOfWeek(String hintWeek)
          Custom hint invalidDaysOfWeek message.
 void setHintInvalidMonths(String hintMonth)
          Custom hint invalidMonths message.
 void setInvalidDays(DateListProvider invalidDays)
           
 void setInvalidDaysOfWeek(String[] invalidDaysOfWeek)
           
 void setInvalidMonths(String[] invalidMonths)
           
 void setMessageDetailInvalidDays(String invalidDays)
           
 void setMessageDetailInvalidDaysOfWeek(String invalidDaysOfWeek)
           
 void setMessageDetailInvalidMonths(String invalidMonths)
           
 void setTransient(boolean transientValue)
           
 void setValueBinding(String name, javax.faces.el.ValueBinding binding)
          Deprecated.  
 void setValueExpression(String name, javax.el.ValueExpression expression)
          Set the ValueExpression used to calculate the value for the specified attribute if any.
 void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final String VALIDATOR_ID
See Also:
Constant Field Values

DAY_MESSAGE_ID

public static final String DAY_MESSAGE_ID

The message identifier of the FacesMessage to be created if the valid days value check fails. The message format string for this message may optionally include {0}, {1} and {3} placeholders, which will be replaced by user input, component label and configured days value.

See Also:
Constant Field Values

MONTH_MESSAGE_ID

public static final String MONTH_MESSAGE_ID

The message identifier of the FacesMessage to be created if the valid month value check fails. The message format string for this message may optionally include {0}, {1} and {3} placeholders, which will be replaced by user input, component label and configured month value.

See Also:
Constant Field Values

WEEKDAY_MESSAGE_ID

public static final String WEEKDAY_MESSAGE_ID

The message identifier of the FacesMessage to be created if the valid weekdays value check fails. The message format string for this message may optionally include {0}, {1} and {3} placeholders, which will be replaced by user input, component label and configured weekdays value.

See Also:
Constant Field Values
Constructor Detail

DateRestrictionValidator

public DateRestrictionValidator()
Construct a Validator with no preconfigured limits.

Method Detail

getInvalidMonths

@JSFProperty
public final String[] getInvalidMonths()

setInvalidMonths

public final void setInvalidMonths(String[] invalidMonths)

getInvalidDaysOfWeek

@JSFProperty
public final String[] getInvalidDaysOfWeek()

setInvalidDaysOfWeek

public final void setInvalidDaysOfWeek(String[] invalidDaysOfWeek)

getInvalidDays

@JSFProperty
public final DateListProvider getInvalidDays()

setInvalidDays

public final void setInvalidDays(DateListProvider invalidDays)

getMessageDetailInvalidMonths

@JSFProperty
public final String getMessageDetailInvalidMonths()

setMessageDetailInvalidMonths

public final void setMessageDetailInvalidMonths(String invalidMonths)

getMessageDetailInvalidDaysOfWeek

@JSFProperty
public final String getMessageDetailInvalidDaysOfWeek()

setMessageDetailInvalidDaysOfWeek

public final void setMessageDetailInvalidDaysOfWeek(String invalidDaysOfWeek)

getMessageDetailInvalidDays

@JSFProperty
public final String getMessageDetailInvalidDays()

setMessageDetailInvalidDays

public final void setMessageDetailInvalidDays(String invalidDays)

setHintInvalidDaysOfWeek

public void setHintInvalidDaysOfWeek(String hintWeek)

Custom hint invalidDaysOfWeek message.

Overrides default hint message

Parameters:
hintWeek - Custom hint message.

getHintInvalidDaysOfWeek

@JSFProperty(tagExcluded=true)
public String getHintInvalidDaysOfWeek()

Return custom hint invalidDaysOfWeek message.

Returns:
Custom hint message.
See Also:
setHintInvalidDaysOfWeek(String)

setHintInvalidMonths

public void setHintInvalidMonths(String hintMonth)

Custom hint invalidMonths message.

Overrides default hint message

Parameters:
hintMonth - Custom hint message.

getHintInvalidMonths

@JSFProperty(tagExcluded=true)
public String getHintInvalidMonths()

Return custom hint invalidMonths message.

Returns:
Custom hint message.
See Also:
setHintInvalidMonths(String)

validate

public void validate(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     Object value)
              throws javax.faces.validator.ValidatorException
Specified by:
validate in interface javax.faces.validator.Validator
Throws:
IllegalArgumentException - if value is not of type Date
javax.faces.validator.ValidatorException

saveState

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

restoreState

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

isTransient

@JSFProperty(istransient=true,
             tagExcluded=true)
public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

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

setValueExpression

public void setValueExpression(String name,
                               javax.el.ValueExpression expression)

Set the ValueExpression used to calculate the value for the specified attribute if any.

Parameters:
name - Name of the attribute for which to set a ValueExpression
expression - The ValueExpression to set, or null to remove any currently set ValueExpression
Throws:
NullPointerException - if name is null
IllegalArgumentException - if name is not a valid attribute of this converter

getValueExpression

public javax.el.ValueExpression getValueExpression(String name)

Return the ValueExpression used to calculate the value for the specified attribute name, if any.

Parameters:
name - Name of the attribute or property for which to retrieve a ValueExpression
Throws:
NullPointerException - if name is null
IllegalArgumentException - if name is not a valid attribute of this converter

setValueBinding

public void setValueBinding(String name,
                            javax.faces.el.ValueBinding binding)
Deprecated. 

Set the ValueBinding used to calculate the value for the specified attribute if any.

Parameters:
name - Name of the attribute for which to set a ValueBinding
binding - The ValueBinding to set, or null to remove any currently set ValueBinding
Throws:
NullPointerException - if name is null
IllegalArgumentException - if name is not a valid attribute of this validator

getValueBinding

public javax.faces.el.ValueBinding getValueBinding(String name)
Deprecated. 

Return the ValueBinding used to calculate the value for the specified attribute name, if any.

Parameters:
name - Name of the attribute or property for which to retrieve a ValueBinding
Throws:
NullPointerException - if name is null
IllegalArgumentException - if name is not a valid attribute of this validator

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

setDisabled

public void setDisabled(boolean isDisabled)
Return whether it is disabled.


isDisabled

public boolean isDisabled()
Return whether it is disabled.

Returns:
true if it's disabled and false if it's enabled.

getCalendar

protected Calendar getCalendar()

getDateValue

protected static Date getDateValue(Object value)
                            throws IllegalArgumentException
Parses the already converted value to a java.util.Date.

Parameters:
value - converted value
Returns:
fulltyped java.util.Date
Throws:
IllegalArgumentException


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.