Java Code Examples for org.apache.wicket.validation.ValidationError#setVariable()

The following examples show how to use org.apache.wicket.validation.ValidationError#setVariable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateFormatValidator.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
@Override
public void validate(IValidatable<String> validatable) {
	String pattern = validatable.getValue();
	try {
		newDateFormat(pattern).format(new Date());
	} catch (Exception e) {
		ValidationError error = new ValidationError(this);
		error.setVariable("pattern", pattern);
		validatable.error(decorate(error, validatable));
	}
}
 
Example 2
Source File: OPropertyValueValidator.java    From wicket-orientdb with Apache License 2.0 5 votes vote down vote up
protected ValidationError newValidationError(String variation,
		Object... params) {
	ValidationError error = new ValidationError(this, variation);
	error.setVariable("property", getProperty().getFullName());
	error.setVariable("type", getProperty().getType());
	for (int i = 0; i < params.length; i += 2) {
		error.setVariable(params[i].toString(), params[i + 1]);
	}
	return error;
}
 
Example 3
Source File: UserEmailValidator.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public void validate(IValidatable<String> validatable) {
    String email = validatable.getValue();
    if (OrienteerUserRepository.isUserExistsWithEmail(email)) {
        ValidationError error = new ValidationError(this);
        error.setVariable("email", email);
        validatable.error(error);
    }
}