|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WValidator
eu.webtoolkit.jwt.WIntValidator
public class WIntValidator
A validator that validates integer user input.
This validator checks whether user input is an integer number in a pre-defined range.
The strings used in this class can be translated by overriding the default values for the following localization keys:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WValidator |
|---|
WValidator.Result, WValidator.State |
| Constructor Summary | |
|---|---|
WIntValidator()
Creates a new integer validator that accepts any integer. |
|
WIntValidator(int bottom,
int top)
Creates a new integer validator that accepts integer input within the given range. |
|
WIntValidator(int bottom,
int top,
WObject parent)
Creates a new integer validator that accepts integer input within the given range. |
|
WIntValidator(WObject parent)
Creates a new integer validator that accepts any integer. |
|
| Method Summary | |
|---|---|
int |
getBottom()
Returns the bottom of the valid integer range. |
java.lang.String |
getInputFilter()
Returns a regular expression that filters input. |
WString |
getInvalidNotANumberText()
Returns the message displayed when the input is not a number. |
WString |
getInvalidTooLargeText()
Returns the message displayed when the number is too large. |
WString |
getInvalidTooSmallText()
Returns the message displayed when the number is too small. |
java.lang.String |
getJavaScriptValidate()
Creates a Javascript object that validates the input. |
int |
getTop()
Returns the top of the valid integer range. |
void |
setBottom(int bottom)
Sets the bottom of the valid integer range. |
void |
setInvalidNotANumberText(java.lang.CharSequence text)
Sets the message to display when the input is not a number. |
void |
setInvalidTooLargeText(java.lang.CharSequence text)
Sets the message to display when the number is too large. |
void |
setInvalidTooSmallText(java.lang.CharSequence text)
Sets the message to display when the number is too small. |
void |
setRange(int bottom,
int top)
Sets the range of valid integers. |
void |
setTop(int top)
Sets the top of the valid integer range. |
WValidator.Result |
validate(java.lang.String input)
Validates the given input. |
| Methods inherited from class eu.webtoolkit.jwt.WValidator |
|---|
fixup, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WIntValidator(WObject parent)
public WIntValidator()
Calls this((WObject)null)
public WIntValidator(int bottom,
int top,
WObject parent)
public WIntValidator(int bottom,
int top)
Calls this(bottom, top, (WObject)null)
| Method Detail |
|---|
public int getBottom()
public void setBottom(int bottom)
The default value is the minimum integer value.
public int getTop()
public void setTop(int top)
The default value is the maximum integer value.
public void setRange(int bottom,
int top)
public WValidator.Result validate(java.lang.String input)
The input is considered valid only when it is blank for a non-mandatory field, or represents an integer within the valid range.
validate in class WValidatorpublic void setInvalidNotANumberText(java.lang.CharSequence text)
The default value is "Must be an integer number."
public WString getInvalidNotANumberText()
setInvalidNotANumberText(CharSequence text)public void setInvalidTooSmallText(java.lang.CharSequence text)
Depending on whether getBottom() and
getTop() are real bounds, the default
message is "The number must be between {1} and {2}" or
"The number must be larger than {1}".
public WString getInvalidTooSmallText()
setInvalidTooSmallText(CharSequence text)public void setInvalidTooLargeText(java.lang.CharSequence text)
Depending on whether getBottom() and
getTop() are real bounds, the default
message is "The number must be between {1} and {2}" or
"The number must be smaller than {2}".
public WString getInvalidTooLargeText()
setInvalidTooLargeText(CharSequence text)public java.lang.String getJavaScriptValidate()
WValidator
The JavaScript expression should evaluate to an object which contains a
validate(text) function, which returns an object that
contains the following two fields:
message that indicates the problem if not valid.Returns an empty string if the validator does not provide a client-side validation implementationq.
Note: The signature and contract changed changed in JWt 3.1.9.
getJavaScriptValidate in class WValidatorWValidator.getInputFilter()public java.lang.String getInputFilter()
WValidatorThe returned regular expression is used to filter keys presses. The regular expression should accept valid single characters.
For details on valid regular expressions, see WRegExpValidator.
As an example, "[0-9]" would only accept numbers as valid
input.
The default implementation returns an empty string, which does not filter any input.
getInputFilter in class WValidatorWValidator.getJavaScriptValidate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||