|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry.valid.BaseValidator org.apache.tapestry.valid.StringValidator
public class StringValidator
Simple validation of strings, to enforce required, and minimum length (maximum length is enforced in the client browser, by setting a maximum input length on the text field).
Field Summary |
---|
Fields inherited from class org.apache.tapestry.valid.BaseValidator |
---|
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL |
Constructor Summary | |
---|---|
StringValidator()
|
Method Summary | |
---|---|
protected String |
buildMinimumLengthMessage(IFormComponent field)
|
int |
getMinimumLength()
|
String |
getMinimumLengthMessage()
|
String |
getScriptPath()
|
void |
renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
This implementation does nothing. |
void |
setMinimumLength(int minimumLength)
|
void |
setMinimumLengthMessage(String string)
Overrides the field-too-short bundle key. |
void |
setScriptPath(String scriptPath)
Allows a developer to use the existing validation logic with a different client-side script. |
Object |
toObject(IFormComponent field,
String input)
Converts input, submitted by the client, into an object value. |
String |
toString(IFormComponent field,
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringValidator()
Method Detail |
---|
public String toString(IFormComponent field, Object value)
IValidator
public Object toObject(IFormComponent field, String input) 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 int getMinimumLength()
public void setMinimumLength(int minimumLength)
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 getMinimumLengthMessage()
public void setMinimumLengthMessage(String string)
field-too-short
bundle key.
Parameter {0} is the minimum length.
Parameter {1} is the display name of the field.
protected String buildMinimumLengthMessage(IFormComponent field)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |