use of cz.metacentrum.perun.webgui.model.ItemTexts in project perun by CESNET.
the class RegistrarFormItemGenerator method checkValueRegex.
protected boolean checkValueRegex() {
if (item.getRegex() != null && !("".equals(item.getRegex()))) {
// Compile and use regular expression
RegExp regExp = RegExp.compile(item.getRegex());
MatchResult matcher = regExp.exec(strValueBox.getValue());
// equivalent to regExp.test(inputStr);
boolean matchFound = (matcher != null);
if (!matchFound) {
String errorMessage = ApplicationMessages.INSTANCE.incorrectFormat();
// does a custom message exist?
ItemTexts it = item.getItemTexts(locale);
if (it != null) {
if (it.getErrorMessage() != null && !it.getErrorMessage().equals("")) {
errorMessage = it.getErrorMessage();
}
}
statusCellWrapper.setWidget(new FormInputStatusWidget(errorMessage, Status.ERROR));
return false;
}
}
return true;
}
Aggregations