sourceCode.setInnerHTML("");
return html;
}
private void setupValidation() {
validator = new DefaultValidationProcessor(showcaseMessages);
popupDesc = new PopupDescription(showcaseMessages, Location.TOP);
FocusAction focusAction = new FocusAction();
IntegerValidator val = new IntegerValidator(integerPositiveTextBox, 1, Integer.MAX_VALUE, "customNotInRange");
//val.setRequired(false);
validator.addValidators("positiveInteger",
val
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
//.addActionForFailure(new TextAction(errorLabel))
);
popupDesc.addDescription("positiveIntegerHelp", integerPositiveTextBox);
validator.addValidators("integerInRangeMinus5000Plus5000",
new IntegerValidator(integerMinus5000To5000TextBox, -5000, 5000)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("integerInRangeMinus5000Plus5000Help", integerMinus5000To5000TextBox);
validator.addValidators("anyInteger",
new IntegerValidator(integerTextBox3)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("anyIntegerHelp", integerTextBox3);
validator.addValidators("stringLengthSmaller5",
new StringLengthValidator(stringLengthSmaller5TextBox, 0, 4)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("stringLengthSmaller5Help", stringLengthSmaller5TextBox);
validator.addValidators("stringLengthBetween2And5",
new StringLengthValidator(stringLengthBetween2And5TextBox, 2, 5)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("stringLengthBetween2And5Help", stringLengthBetween2And5TextBox);
validator.addValidators("notEmpty",
new NotEmptyValidator(notEmptyTextBox)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
validator.addValidators("localizedDate",
new LocalizedDateValidator(localizedDateTextBox, DateTimeFormat.getShortDateFormat(), false)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("localizedDate.description", localizedDateTextBox);
validator.addValidators("name",
new NameValidator(nameValidatorTextBox)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("name.description", nameValidatorTextBox);
popupDesc.addDescription("notEmptyHelp", notEmptyTextBox);
RegularExpressionValidator regex = new RegularExpressionValidator(regexValidateEntryTextBox, new ValidatorConfigurationSource<String>() {
public String getConfigurationValue() {
String regex = regexEntryTextBox.getText();
if(regex.trim().equals("")) {
regexEntryTextBox.setText("(a|b)*");
return "(a|b)*";
}
return regex;
}
}, "regexNotMatched");
validator.addValidators("enterRegExedText", regex
.addActionForFailure(new StyleAction("validationFailedBorder"))
.addActionForFailure(focusAction)
);
popupDesc.addDescription("regexText.description", regexValidateEntryTextBox);
validator.addValidators("localizedDate",
new LocalizedDateValidator(localizedDateTextBox, DateTimeFormat.getShortDateFormat(), false)
.addActionForFailure(focusAction)
.addActionForFailure(new StyleAction("validationFailedBorder"))
);
popupDesc.addDescription("localizedDate.description", localizedDateTextBox);
validator.addValidators("suggest1", new IntegerValidator(suggestBox1)
.addActionForFailure(new StyleAction("validationFailedBorder"))
//.addActionForFailure(focusAction)
);
popupDesc.addDescription("localizedDate.description", suggestBox1);
validator.addGlobalAction(new DisclosureTextAction(allErrorsPanel, "redText") );
transValidator = new DefaultValidationProcessor();
transValidator.addValidators("string1", new UpperCaseTransformer(uppercaseTextBox));
transValidator.addValidators("string2", new TrimmedUpperCaseTransformer(trimmedUppercaseTextBox));
transValidator.addValidators("caesar1", new CaesarEncryptionTransformer(caesarTextBox, 1));
validatorStore = validator.getAllValidators();