|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tapestry.valid.BaseValidator
org.apache.tapestry.valid.DateValidator
public class DateValidator
Provides input validation for strings treated as dates. In addition, allows a minimum and maximum date to be set.
Field Summary | |
---|---|
static DateFormat |
DEFAULT_DATE_FORMAT
|
static String |
DEFAULT_DISPLAY_FORMAT
|
Fields inherited from class org.apache.tapestry.valid.BaseValidator |
---|
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL |
Constructor Summary | |
---|---|
DateValidator()
|
|
DateValidator(String initializer)
Initializes the DateValidator with properties defined by the initializer. |
Method Summary | |
---|---|
protected String |
buildDateTooEarlyMessage(IFormComponent field,
String earliestDate)
|
protected String |
buildDateTooLateMessage(IFormComponent field,
String latestDate)
|
protected String |
buildInvalidDateFormatMessage(IFormComponent field)
|
String |
getDateTooEarlyMessage()
|
String |
getDateTooLateMessage()
|
String |
getDisplayFormat()
|
String |
getEffectiveDisplayFormat()
|
DateFormat |
getEffectiveFormat()
|
DateFormat |
getFormat()
|
String |
getInvalidDateFormatMessage()
|
Date |
getMaximum()
|
Date |
getMinimum()
|
String |
getScriptPath()
|
void |
renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
This implementation does nothing. |
void |
setDateTooEarlyMessage(String string)
Overrides the bundle key date-too-early . |
void |
setDateTooLateMessage(String string)
Overrides the bundle key date-too-late . |
void |
setDisplayFormat(String value)
|
void |
setFormat(DateFormat value)
|
void |
setInvalidDateFormatMessage(String string)
Overrides the bundle key invalid-date-format . |
void |
setMaximum(Date maximum)
|
void |
setMinimum(Date minimum)
|
void |
setScriptPath(String scriptPath)
Allows a developer to use the existing validation logic with a different client-side script. |
Object |
toObject(IFormComponent field,
String value)
Converts input, submitted by the client, into an object value. |
String |
toString(IFormComponent file,
Object value)
Invoked during rendering to convert an object value (which may be null) to a String. |
Methods inherited from class org.apache.tapestry.valid.BaseValidator |
---|
buildRequiredMessage, checkRequired, formatString, formatString, formatString, getPattern, getRequiredMessage, isClientScriptingEnabled, isRequired, processValidatorScript, setClientScriptingEnabled, setRequired, setRequiredMessage, setScriptSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_DISPLAY_FORMAT
public static final DateFormat DEFAULT_DATE_FORMAT
Constructor Detail |
---|
public DateValidator()
public DateValidator(String initializer)
Method Detail |
---|
public void setFormat(DateFormat value)
public DateFormat getFormat()
public DateFormat getEffectiveFormat()
DateFormat
the validator will use, returning the default if no other date
format is specified via setFormat(DateFormat)
public String getDisplayFormat()
public void setDisplayFormat(String value)
public String getEffectiveDisplayFormat()
SimpleDateFormat.toPattern()
for SimpleDateFormat
s, or "MM/DD/YYYY"
for unknown DateFormat
subclasses.public String toString(IFormComponent file, Object value)
IValidator
public Object toObject(IFormComponent field, String value) throws ValidatorException
IValidator
The input string will already have been trimmed. It may be null.
ValidatorException
- if the string cannot be converted into an object, or the object is not valid (due
to other constraints).public Date getMaximum()
public void setMaximum(Date maximum)
public Date getMinimum()
public void setMinimum(Date minimum)
public void renderValidatorContribution(IFormComponent field, IMarkupWriter writer, IRequestCycle cycle)
BaseValidator
renderValidatorContribution
in interface IValidator
renderValidatorContribution
in class BaseValidator
public String getScriptPath()
public void setScriptPath(String scriptPath)
window.alert()
).
public String getDateTooEarlyMessage()
public String getDateTooLateMessage()
public String getInvalidDateFormatMessage()
protected String buildInvalidDateFormatMessage(IFormComponent field)
protected String buildDateTooEarlyMessage(IFormComponent field, String earliestDate)
protected String buildDateTooLateMessage(IFormComponent field, String latestDate)
public void setDateTooEarlyMessage(String string)
date-too-early
. Parameter {0} is the display name of
the field. Parameter {1} is the earliest allowed date.
public void setDateTooLateMessage(String string)
date-too-late
. Parameter {0} is the display name of
the field. Parameter {1} is the latest allowed date.
public void setInvalidDateFormatMessage(String string)
invalid-date-format
. Parameter {0} is the display
name of the field. Parameter {1} is the allowed format.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |