use of org.apache.wicket.validation.ValidationError in project midpoint by Evolveum.
the class NotNullValidator method validate.
@Override
public void validate(IValidatable<T> validatable) {
if (validatable.getValue() == null) {
ValidationError err = new ValidationError();
err.addKey(key);
validatable.error(err);
}
}
use of org.apache.wicket.validation.ValidationError in project midpoint by Evolveum.
the class JasperReportConfigurationPanel method createTextPanel.
@SuppressWarnings({ "rawtypes", "unchecked" })
private <J> Component createTextPanel(String componentId, final IModel<J> model, String expression, final Boolean mandatory) {
TextPanel<String> textPanel = new TextPanel<String>(componentId, new PropertyModel<String>(model, expression));
FormComponent input = textPanel.getBaseFormComponent();
input.add(new AttributeAppender("style", "width: 100%"));
input.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
input.add(new IValidator() {
private static final long serialVersionUID = 1L;
@Override
public void validate(IValidatable validatable) {
if (!mandatory) {
return;
}
if (validatable.getValue() == null) {
validatable.error(new ValidationError("JasperReportConfigurationPanel.errormsg"));
}
}
});
return textPanel;
}
use of org.apache.wicket.validation.ValidationError in project ocvn by devgateway.
the class EarlierThanDateFieldValidator method validate.
@Override
public void validate(final IValidatable<Date> validatable) {
highDate.getField().validate();
if (!highDate.getField().isValid()) {
return;
}
Date endDate = (Date) highDate.getField().getConvertedInput();
if (endDate != null && validatable.getValue() != null && endDate.before(validatable.getValue())) {
ValidationError error = new ValidationError(this);
error.setVariable("highDateName", new StringResourceModel(highDate.getLabelKey(), highDate.getParent(), null).getString());
validatable.error(error);
}
}
use of org.apache.wicket.validation.ValidationError in project ocvn by devgateway.
the class YearValidator method validate.
@Override
public void validate(final IValidatable<Integer> validatable) {
if (validatable.getValue() == null) {
return;
}
if (maxCurrentYear && validatable.getValue() > Calendar.getInstance().get(Calendar.YEAR)) {
ValidationError error = new ValidationError();
error.addKey(this, "maxCurrentYear");
validatable.error(error);
}
}
Aggregations