@Override
protected void setup() {
requiredInput = new CheckBox("Field required");
requiredInput.setImmediate(true);
requiredInput.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
tf.setRequired(requiredInput.getValue());
}
});
requiredErrorInput = new TextField("Required error message");
requiredErrorInput.setImmediate(true);
requiredErrorInput.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
tf.setRequiredError(requiredErrorInput.getValue());
}
});
integerValidatorInput = new CheckBox("Integer.parseInt validator");
integerValidatorInput.setImmediate(true);
integerValidatorInput.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
if (integerValidatorInput.getValue()) {
tf.addValidator(integerValidator);
} else {
tf.removeValidator(integerValidator);
}
}
});
stringLengthValidatorInput = new CheckBox(
"stringLength.parseInt validator");
stringLengthValidatorInput.setImmediate(true);
stringLengthValidatorInput.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
if (stringLengthValidatorInput.getValue()) {
tf.addValidator(stringLengthValidator);