|
||||||||||
| 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.WLengthValidator
public class WLengthValidator
A validator that checks the string length of user input.
This validator checks whether user input is within the specified range of accepted string lengths.
If you only want to limit the length on a line edit, you may also use
WLineEdit#setMaxLength().
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 | |
|---|---|
WLengthValidator()
Creates a length validator that accepts input of any length. |
|
WLengthValidator(int minLength,
int maxLength)
Creates a length validator that accepts input within a length range. |
|
WLengthValidator(int minLength,
int maxLength,
WObject parent)
Creates a length validator that accepts input within a length range. |
|
WLengthValidator(WObject parent)
Creates a length validator that accepts input of any length. |
|
| Method Summary | |
|---|---|
WString |
getInvalidTooLongText()
Returns the message displayed when the input is too long. |
WString |
getInvalidTooShortText()
Returns the message displayed when the input is too short. |
java.lang.String |
getJavaScriptValidate()
Creates a Javascript object that validates the input. |
int |
getMaximumLength()
Returns the maximum length. |
int |
getMinimumLength()
Returns the minimum length. |
void |
setInvalidTooLongText(java.lang.CharSequence text)
Sets the message to display when the input is too long. |
void |
setInvalidTooShortText(java.lang.CharSequence text)
Sets the message to display when the input is too short. |
void |
setMaximumLength(int maxLength)
Sets the maximum length. |
void |
setMinimumLength(int minLength)
Sets the minimum length. |
WValidator.Result |
validate(java.lang.String input)
Validates the given input. |
| Methods inherited from class eu.webtoolkit.jwt.WValidator |
|---|
fixup, getInputFilter, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, 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 WLengthValidator(WObject parent)
public WLengthValidator()
Calls this((WObject)null)
public WLengthValidator(int minLength,
int maxLength,
WObject parent)
public WLengthValidator(int minLength,
int maxLength)
Calls
this(minLength, maxLength, (WObject)null)
| Method Detail |
|---|
public void setMinimumLength(int minLength)
The default value is 0.
public int getMinimumLength()
setMinimumLength(int minLength)public void setMaximumLength(int maxLength)
The default value is the maximum integer value.
public int getMaximumLength()
setMaximumLength(int maxLength)public WValidator.Result validate(java.lang.String input)
The input is considered valid only when it is blank for a non-mandatory field, or has a length within the valid range.
validate in class WValidatorpublic void setInvalidTooShortText(java.lang.CharSequence text)
Depending on whether getMaximumLength() is a real bound, the default message is "The
input must have a length between {1} and {2} characters" or "
"The input must be at least {1} characters".
public WString getInvalidTooShortText()
setInvalidTooShortText(CharSequence text)public void setInvalidTooLongText(java.lang.CharSequence text)
Depending on whether getMinimumLength() is different from zero, the default message is
"The input must have a length between {1} and {2} characters"
or " "The input must be no more than {2} characters".
public WString getInvalidTooLongText()
setInvalidTooLongText(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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||