|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.validator.AbstractValidator<T>
com.vaadin.data.validator.RangeValidator<T>
T
- The type of Number to validate. Must implement Comparable so that
minimum and maximum checks work.public class RangeValidator<T extends java.lang.Comparable>
An base implementation for validating any objects that implement
Comparable
.
Verifies that the value is of the given type and within the (optionally)
given limits. Typically you want to use a sub class of this like
IntegerRangeValidator
, DoubleRangeValidator
or
DateRangeValidator
in applications.
Note that RangeValidator
always accept null values. Make a field
required to ensure that no empty values are accepted or override
isValidValue(Comparable)
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.vaadin.data.Validator |
---|
Validator.EmptyValueException, Validator.InvalidValueException |
Constructor Summary | |
---|---|
RangeValidator(java.lang.String errorMessage,
java.lang.Class<T> type,
T minValue,
T maxValue)
Creates a new range validator of the given type. |
Method Summary | |
---|---|
T |
getMaxValue()
Gets the maximum value of the range |
T |
getMinValue()
Gets the minimum value of the range |
java.lang.Class<T> |
getType()
|
boolean |
isMaxValueIncluded()
Checks if the maximum value is part of the accepted range |
boolean |
isMinValueIncluded()
Checks if the minimum value is part of the accepted range |
protected boolean |
isValidValue(T value)
Internally check the validity of a value. |
void |
setMaxValue(T maxValue)
Sets the maximum value of the range. |
void |
setMaxValueIncluded(boolean maxValueIncluded)
Sets if the maximum value is part of the accepted range |
void |
setMinValue(T minValue)
Sets the minimum value of the range. |
void |
setMinValueIncluded(boolean minValueIncluded)
Sets if the minimum value is part of the accepted range |
Methods inherited from class com.vaadin.data.validator.AbstractValidator |
---|
getErrorMessage, isValid, isValidType, setErrorMessage, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RangeValidator(java.lang.String errorMessage, java.lang.Class<T> type, T minValue, T maxValue)
errorMessage
- The error message to use if validation failstype
- The type of object the validator can validate.minValue
- The minimum value that should be accepted or null for no limitmaxValue
- The maximum value that should be accepted or null for no limitMethod Detail |
---|
public boolean isMinValueIncluded()
public void setMinValueIncluded(boolean minValueIncluded)
minValueIncluded
- true if the minimum value should be part of the range, false
otherwisepublic boolean isMaxValueIncluded()
public void setMaxValueIncluded(boolean maxValueIncluded)
maxValueIncluded
- true if the maximum value should be part of the range, false
otherwisepublic T getMinValue()
public void setMinValue(T minValue)
setMinValueIncluded(boolean)
to control whether this value is
part of the range or not.
minValue
- the minimum valuepublic T getMaxValue()
public void setMaxValue(T maxValue)
setMaxValueIncluded(boolean)
to control whether this value is
part of the range or not.
maxValue
- the maximum valueprotected boolean isValidValue(T value)
AbstractValidator
AbstractValidator.validate(Object)
and the return value of this method is ignored.
This method should not be called from outside the validator class itself.
isValidValue
in class AbstractValidator<T extends java.lang.Comparable>
public java.lang.Class<T> getType()
getType
in class AbstractValidator<T extends java.lang.Comparable>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |