form.addField("i", tf);
// TODO CompositeValidator
tf = new TextField(
"A field, must be a floating point number with 4-5 chars");
CompositeValidator cv = new CompositeValidator(CombinationMode.AND,
"The field must contain a floating point number with 4-5 characters");
cv.addValidator(new StringLengthValidator(
"String length of '{0}' should be 4-5 characters", 4, 5, false));
cv.addValidator(new DoubleValidator(
"{0} must be a floating point number"));
tf.addValidator(cv);
tf.setValue("12.34");
form.addField("j", tf);
tf = new TextField(
"A field, must be a floating point number or 4-5 chars");
cv = new CompositeValidator(CombinationMode.OR,
"The field must contain a floating point or with 4-5 characters");
cv.addValidator(new StringLengthValidator(
"String length of '{0}' should be 4-5 characters", 4, 5, false));
cv.addValidator(new DoubleValidator(
"{0} must be a floating point number"));
tf.addValidator(cv);
tf.setValue("12.34g");
form.addField("jb", tf);