|
|||||||||
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.PatternValidator
public class PatternValidator
The validator bean that provides a pattern validation service.
The actual pattern matching algorithm is provided by the
PatternDelegate
. This enables the user to provide
custom pattern matching implementations. In the event a custom implementation is not
provided, this validator will use the RegexpMatcher
.
This validator has the ability to provide client side validation on demand.
To enable client side validation simply set the clientScriptingEnabled
property to true
.
The default implementation of the script will be in JavaScript and allows the user to
override this with a custom implementation by setting the path to the custom
script via setScriptPath(String)
.
Field Summary |
---|
Fields inherited from class org.apache.tapestry.valid.BaseValidator |
---|
FIELD_SYMBOL, FORM_SYMBOL, FUNCTION_SYMBOL, VALIDATOR_SYMBOL |
Constructor Summary | |
---|---|
PatternValidator()
|
Method Summary | |
---|---|
String |
getEscapedPatternString()
Returns the escaped sequence of the pattern string for rendering in the error message. |
PatternDelegate |
getPatternDelegate()
Returns the custom pattern matcher if one is provided or creates and returns the default matcher laziliy. |
String |
getPatternNotMatchedMessage()
Returns custom validation failure message. |
String |
getPatternString()
Returns the pattern that this validator uses for validation. |
void |
renderValidatorContribution(IFormComponent field,
IMarkupWriter writer,
IRequestCycle cycle)
This implementation does nothing. |
void |
setPatternDelegate(PatternDelegate patternDelegate)
Allows for a custom implementation to do the pattern matching. |
void |
setPatternNotMatchedMessage(String message)
Allows for a custom message to be set typically via the bean specification. |
void |
setPatternString(String pattern)
Allows the user to change the validation pattern. |
void |
setScriptPath(String scriptPath)
Allows for a custom implementation of the client side validation. |
Object |
toObject(IFormComponent field,
String input)
Converts input, submitted by the client, into an object value. |
String |
toString()
|
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, wait, wait, wait |
Constructor Detail |
---|
public PatternValidator()
Method Detail |
---|
public String getPatternNotMatchedMessage()
ValidationStrings.properties
file for key
pattern-not-matched
.
public String getPatternString()
public void setPatternNotMatchedMessage(String message)
public void setPatternString(String pattern)
public void setPatternDelegate(PatternDelegate patternDelegate)
RegexpMatcher
.
public PatternDelegate getPatternDelegate()
public String toString(IFormComponent field, Object value)
IValidator
IValidator.toString(org.apache.tapestry.form.IFormComponent, java.lang.Object)
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).IValidator.toObject(org.apache.tapestry.form.IFormComponent, java.lang.String)
public void setScriptPath(String scriptPath)
public void renderValidatorContribution(IFormComponent field, IMarkupWriter writer, IRequestCycle cycle)
BaseValidator
renderValidatorContribution
in interface IValidator
renderValidatorContribution
in class BaseValidator
IValidator.renderValidatorContribution(org.apache.tapestry.form.IFormComponent, org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
public String getEscapedPatternString()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |