@Override
public boolean validateModel(ModelData model) {
Date d = getModelValue(model);
long time = d == null ? 0l : new DateWrapper(d).clearTime().getTime();
if (beforeItem.isChecked() && beforeMenu.getDate() != null) {
long pvalue = new DateWrapper(beforeMenu.getDate()).clearTime().getTime();
if (d == null || pvalue <= time) {
return false;
}
}
if (afterItem.isChecked() && afterMenu.getDate() != null) {
long pvalue = new DateWrapper(afterMenu.getDate()).clearTime().getTime();
if (d == null || pvalue >= time) {
return false;
}
}
if (onItem.isChecked() && onMenu.getDate() != null) {
long pvalue = new DateWrapper(onMenu.getDate()).resetTime().getTime();
if (d == null || pvalue != (d == null ? 0l : new DateWrapper(d).resetTime().getTime())) {
return false;
}
}
return true;
}