|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.araneaframework.uilib.form.constraint.BaseConstraint
public abstract class BaseConstraint
Base class for constraints. A Constraint
operates on the form elements or forms providing means to constrain their content.
| Field Summary | |
|---|---|
protected String |
customErrorMessage
Holds the custom error message for this constraint. |
| Constructor Summary | |
|---|---|
BaseConstraint()
|
|
| Method Summary | |
|---|---|
protected void |
addError(String error)
Adds the given error message to the errors list to be displayed later. |
protected void |
addErrors(Collection errorList)
Adds the given error messages to the errors list to be displayed later. |
void |
clearErrors()
Clears the the errors produced while validating this Constraint. |
protected ConfigurationContext |
getConfiguration()
Finds the ConfigurationContext from the
Environment. |
Environment |
getEnvironment()
Provides the Environment of the constraint. |
Set |
getErrors()
Returns the validation errors produced while validating this Constraint. |
boolean |
isValid()
Returns whether the constraint is satisfied/valid. |
void |
setCustomErrorMessage(String customErrorMessage)
Sets the custom error message, that will be used in place of default ones when this Constraint does not hold. |
void |
setEnvironment(Environment environment)
Sets the Environment of this Constraint. |
protected String |
t(String key)
Transletes the given message key according to the LocalizationContext. |
boolean |
validate()
This method validates this Constraint conditions. |
protected abstract void |
validateConstraint()
This method should validate the constraint conditions adding error messages and add messages about unsatisfied conditions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String customErrorMessage
| Constructor Detail |
|---|
public BaseConstraint()
| Method Detail |
|---|
public boolean validate()
throws Exception
ConstraintConstraint conditions.
validate in interface ConstraintExceptionpublic boolean isValid()
public Set getErrors()
ConstraintConstraint.
getErrors in interface Constraintpublic void clearErrors()
ConstraintConstraint.
clearErrors in interface Constraintpublic void setCustomErrorMessage(String customErrorMessage)
ConstraintConstraint does not hold.
setCustomErrorMessage in interface ConstraintcustomErrorMessage - custom error messagepublic void setEnvironment(Environment environment)
ConstraintEnvironment of this Constraint.
Environment should come from whatever Component
that this Constraint is operating on.
The Environment of a Constraint may be set to
non-null value only once, further calls are ignored. Application programmer
typically never calls this method as Environment is
propagated seamlessly.
setEnvironment in interface Constraintenvironment - the Environment for this constraint.public Environment getEnvironment()
Environment of the constraint.
Environment of the constraint.protected void addError(String error)
error - an error messageprotected void addErrors(Collection errorList)
errorList - A list of error messages (Strings).protected ConfigurationContext getConfiguration()
ConfigurationContext from the
Environment.
ConfigurationContext from the
Environment.protected String t(String key)
LocalizationContext.
key - The key to find the correct message.
LocalizationContext.
protected abstract void validateConstraint()
throws Exception
Exception - Any runtime exception that may occur.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||