use of io.jmix.ui.component.validation.time.TimeValidator in project jmix by jmix-framework.
the class PastOrPresentValidator method accept.
@Override
public void accept(T value) throws ValidationException {
// consider null value is valid
if (value == null) {
return;
}
TimeValidator timeConstraint = ValidatorHelper.getTimeConstraint(timeSource, value);
if (timeConstraint == null) {
throw new IllegalArgumentException("PastOrPresentValidator doesn't support following type: '" + value.getClass() + "'");
}
timeConstraint.setCheckSeconds(checkSeconds);
if (!timeConstraint.isPastOrPresent()) {
String message = getMessage();
if (message == null) {
message = messages.getMessage("validation.constraints.pastOrPresent");
}
throw new ValidationException(message);
}
}
use of io.jmix.ui.component.validation.time.TimeValidator in project jmix by jmix-framework.
the class PastValidator method accept.
@Override
public void accept(T value) throws ValidationException {
// consider null value is valid
if (value == null) {
return;
}
TimeValidator timeConstraint = ValidatorHelper.getTimeConstraint(timeSource, value);
if (timeConstraint == null) {
throw new IllegalArgumentException("PastValidator doesn't support following type: '" + value.getClass() + "'");
}
timeConstraint.setCheckSeconds(checkSeconds);
if (!timeConstraint.isPast()) {
String message = getMessage();
if (message == null) {
message = messages.getMessage("validation.constraints.past");
}
throw new ValidationException(message);
}
}
use of io.jmix.ui.component.validation.time.TimeValidator in project jmix by jmix-framework.
the class FutureOrPresentValidator method accept.
@Override
public void accept(T value) throws ValidationException {
// consider null value is valid
if (value == null) {
return;
}
TimeValidator timeConstraint = ValidatorHelper.getTimeConstraint(timeSource, value);
if (timeConstraint == null) {
throw new IllegalArgumentException("FutureOrPresentValidator doesn't support following type: '" + value.getClass() + "'");
}
timeConstraint.setCheckSeconds(checkSeconds);
if (!timeConstraint.isFutureOrPresent()) {
String message = getMessage();
if (message == null) {
message = messages.getMessage("validation.constraints.futureOrPresent");
}
throw new ValidationException(message);
}
}
use of io.jmix.ui.component.validation.time.TimeValidator in project jmix by jmix-framework.
the class FutureValidator method accept.
@Override
public void accept(T value) throws ValidationException {
// consider null value is valid
if (value == null) {
return;
}
TimeValidator timeConstraint = ValidatorHelper.getTimeConstraint(timeSource, value);
if (timeConstraint == null) {
throw new IllegalArgumentException("FutureValidator doesn't support following type: '" + value.getClass() + "'");
}
timeConstraint.setCheckSeconds(checkSeconds);
if (!timeConstraint.isFuture()) {
String message = getMessage();
if (message == null) {
message = messages.getMessage("validation.constraints.future");
}
throw new ValidationException(message);
}
}
Aggregations