Search in sources :

Example 1 with ProcessingStatus

use of org.eclipse.scout.rt.platform.exception.ProcessingStatus in project scout.rt by eclipse.

the class AbstractDateField method validateValueInternal.

@Override
protected Date validateValueInternal(Date rawValue) {
    rawValue = super.validateValueInternal(rawValue);
    if (rawValue == null) {
        return null;
    }
    // Check if date is allowed (if allowed dates are set)
    if (getAllowedDates().size() > 0) {
        Date truncDate = DateUtility.truncDate(rawValue);
        boolean found = false;
        for (Date allowedDate : getAllowedDates()) {
            if (allowedDate.compareTo(truncDate) == 0) {
                found = true;
                break;
            }
        }
        if (!found) {
            throw new VetoException(new ProcessingStatus(TEXTS.get("DateIsNotAllowed"), IStatus.ERROR));
        }
    }
    return rawValue;
}
Also used : VetoException(org.eclipse.scout.rt.platform.exception.VetoException) ProcessingStatus(org.eclipse.scout.rt.platform.exception.ProcessingStatus) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 ProcessingStatus (org.eclipse.scout.rt.platform.exception.ProcessingStatus)1 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)1