org.apache.tapestry.valid
Class DateValidator
java.lang.Object
|
+--org.apache.tapestry.valid.BaseValidator
|
+--org.apache.tapestry.valid.DateValidator
- All Implemented Interfaces:
- IValidator
- public class DateValidator
- extends BaseValidator
Provides input validation for strings treated as dates. In addition,
allows a minimum and maximum date to be set.
- Since:
- 1.0.8
- Version:
- $Id: DateValidator.java,v 1.5 2003/05/09 01:58:46 rlewisshell Exp $
- Author:
- Howard Lewis Ship
Methods inherited from class org.apache.tapestry.valid.BaseValidator |
buildRequiredMessage, checkRequired, formatString, formatString, formatString, getPattern, getRequiredMessage, isClientScriptingEnabled, isRequired, processValidatorScript, setClientScriptingEnabled, setRequired, setRequiredMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateValidator
public DateValidator()
setFormat
public void setFormat(DateFormat value)
getFormat
public DateFormat getFormat()
getDisplayFormat
public String getDisplayFormat()
setDisplayFormat
public void setDisplayFormat(String value)
toString
public String toString(IFormComponent file,
Object value)
- Description copied from interface:
IValidator
- Invoked during renderring to convert an object value (which may be null)
to a String. It is acceptible to return null. The string will be the
VALUE attribute of the HTML text field.
toObject
public Object toObject(IFormComponent field,
String value)
throws ValidatorException
- Description copied from interface:
IValidator
- Converts input, submitted by the client, into an object value.
May return null if the input is null (and the required flag is false).
The input string will already have been trimmed. It may be null.
- Following copied from interface:
org.apache.tapestry.valid.IValidator
- Throws:
ValidatorException
- if the string cannot be converted into
an object, or the object is
not valid (due to other constraints).
getMaximum
public Date getMaximum()
setMaximum
public void setMaximum(Date maximum)
getMinimum
public Date getMinimum()
setMinimum
public void setMinimum(Date minimum)
renderValidatorContribution
public void renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
- Description copied from class:
BaseValidator
- This implementation does nothing. Subclasses may supply their own implementation.
- Overrides:
renderValidatorContribution
in class BaseValidator
- Since:
- 2.2
getScriptPath
public String getScriptPath()
- Since:
- 2.2
setScriptPath
public void setScriptPath(String scriptPath)
- Allows a developer to use the existing validation logic with a different client-side
script. This is often sufficient to allow application-specific error presentation
(perhaps by using DHTML to update the content of a <span> tag, or to use
a more sophisticated pop-up window than
window.alert()
).
- Since:
- 2.2
getDateTooEarlyMessage
public String getDateTooEarlyMessage()
- Since:
- 3.0
getDateTooLateMessage
public String getDateTooLateMessage()
- Since:
- 3.0
getInvalidDateFormatMessage
public String getInvalidDateFormatMessage()
- Since:
- 3.0
buildInvalidDateFormatMessage
protected String buildInvalidDateFormatMessage(IFormComponent field)
- Since:
- 3.0
buildDateTooEarlyMessage
protected String buildDateTooEarlyMessage(IFormComponent field,
String earliestDate)
- Since:
- 3.0
buildDateTooLateMessage
protected String buildDateTooLateMessage(IFormComponent field,
String latestDate)
- Since:
- 3.0
setDateTooEarlyMessage
public void setDateTooEarlyMessage(String string)
- Overrides the bundle key
date-too-early
.
Parameter {0} is the display name of the field.
Parameter {1} is the earliest allowed date.
- Since:
- 3.0
setDateTooLateMessage
public void setDateTooLateMessage(String string)
- Overrides the bundle key
date-too-late
.
Parameter {0} is the display name of the field.
Parameter {1} is the latest allowed date.
- Since:
- 3.0
setInvalidDateFormatMessage
public void setInvalidDateFormatMessage(String string)
- Overrides the bundle key
invalid-date-format
.
Parameter {0} is the display name of the field.
Parameter {1} is the allowed format.
- Since:
- 3.0