|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.aria.validation.AbstractValidator
public abstract class AbstractValidator
A basic implementation of the Validator interface
Copyright: Copyright (c) Formaria Ltd., 2008
License: see license.txt
| Field Summary | |
|---|---|
protected java.lang.Object |
container
Container to be used for validation methods |
protected Project |
currentProject
The owner project and the context for this object |
protected int |
errorLevel
The level of the errors detected by the validation |
protected java.lang.String |
formattedMessage
The formatted message |
protected boolean |
mandatory
boolean indicating whether component requires input |
protected int |
mask
The event mask of the validation |
protected java.lang.String |
message
The unformatted message to be displayed |
protected boolean |
showErrorBadges
If true show error badges for validation errors |
protected boolean |
start
Indicates that the validation has started |
protected Translator |
translator
|
static int |
USE_FAIL_STYLE
|
static int |
USE_NORMAL_STYLE
|
static int |
USE_WARN_STYLE
|
protected java.lang.reflect.Method |
validationMethod
Method to be used for callback validations |
protected java.lang.String |
validationName
The name of the validation which is being handled by this validator |
protected java.lang.String |
value
Used to store the current value contained in the component |
| Fields inherited from interface org.formaria.aria.validation.Validator |
|---|
IGNORE_BLANKS, LEVEL_ERROR, LEVEL_IGNORE, LEVEL_WARNING, MANDATORY, STRICT_CHECK, WEAK_CHECK |
| Constructor Summary | |
|---|---|
AbstractValidator(Project project)
|
|
| Method Summary | |
|---|---|
void |
applyErrorStyle(java.lang.Object comp,
int errorStatus)
Modify the evaluated component to indicate the error status |
int |
getLevel()
Get the error level of the validations |
int |
getMask()
Get the event mask. |
java.lang.String |
getMessage()
Get the validation message which is formatted after the tokens have been replaced |
java.lang.String |
getName()
Get the name of the validation |
protected java.lang.String |
getText(java.lang.Object c)
Get the text value of the component. |
java.lang.String |
getValueAsString()
Get the value as a string object |
java.lang.Object |
invokeMethod()
Call the funcion to get the value we are validating. |
protected void |
replaceToken(java.lang.String lookup,
java.lang.String replacement)
Carry out a replacement on the validation message |
protected void |
replaceTokens()
Replace any further tokens in the message |
void |
setMask(int newMask)
Set the event mask. |
void |
setName(java.lang.String name)
Set the name of the validation |
void |
setup(XmlElement ruleConfig,
XmlElement instanceConfig)
Set the validation parameters |
static void |
setValidationColors(java.awt.Color[] validationColors)
Set the validation colors |
void |
setValidationMethod(java.lang.reflect.Method m,
java.lang.Object c)
Set the Method of the Page to be invoked when we are doing a funcion validation |
protected void |
throwException()
Replace the remaining tokens and throw the exception |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.formaria.aria.validation.Validator |
|---|
validate |
| Field Detail |
|---|
public static final int USE_NORMAL_STYLE
public static final int USE_WARN_STYLE
public static final int USE_FAIL_STYLE
protected boolean mandatory
protected java.lang.String message
protected java.lang.String value
protected java.lang.String formattedMessage
protected java.lang.String validationName
protected java.lang.Object container
protected java.lang.reflect.Method validationMethod
protected int mask
protected int errorLevel
protected boolean start
protected Project currentProject
protected boolean showErrorBadges
protected Translator translator
| Constructor Detail |
|---|
public AbstractValidator(Project project)
project - the owner project| Method Detail |
|---|
public int getMask()
getMask in interface Validatorpublic void setMask(int newMask)
newMask - The new mask which is to be used by the validator
public void setValidationMethod(java.lang.reflect.Method m,
java.lang.Object c)
setValidationMethod in interface Validatorc - The component being validatedm - The method to be invokedpublic java.lang.String getName()
getName in interface Validatorpublic void setName(java.lang.String name)
name - the new namepublic java.lang.String getMessage()
getMessage in interface Validator
public void setup(XmlElement ruleConfig,
XmlElement instanceConfig)
setup in interface ValidatorruleConfig - the validator parameters as declared in the validations rules fileinstanceConfig - the validator instance parameters as declared in the page filepublic java.lang.String getValueAsString()
getValueAsString in interface Validatorpublic int getLevel()
getLevel in interface Validatorpublic java.lang.Object invokeMethod()
protected void replaceToken(java.lang.String lookup,
java.lang.String replacement)
lookup - The text to findreplacement - The text to replace the text withprotected void replaceTokens()
protected java.lang.String getText(java.lang.Object c)
c - The component
protected void throwException()
throws java.lang.Exception
java.lang.Exception - Throw an exception so that it can be caught
public void applyErrorStyle(java.lang.Object comp,
int errorStatus)
comp - the validated componenterrorStatus - the error statuspublic static void setValidationColors(java.awt.Color[] validationColors)
validationColors - the validation colors in the following order:
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||