Search in sources :

Example 1 with ValidationFailedException

use of org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException in project nebula.widgets.nattable by eclipse.

the class CrossValidationDialogErrorHandling method validate.

@Override
public boolean validate(int columnIndex, int rowIndex, Object newValue) {
    // get the row object out of the dataprovider
    EventData rowObject = this.bodyDataProvider.getRowObject(rowIndex);
    // as the object itself is not yet updated, we need to validate against
    // the given new value
    Date fromDate = rowObject.getFromDate();
    Date toDate = rowObject.getToDate();
    if (columnIndex == 3) {
        fromDate = (Date) newValue;
    } else if (columnIndex == 4) {
        toDate = (Date) newValue;
    }
    if (!CrossValidationGridExample.isEventDataValid(fromDate, toDate)) {
        throw new ValidationFailedException("fromDate is not before toDate");
    }
    return true;
}
Also used : ValidationFailedException(org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException) EventData(org.eclipse.nebula.widgets.nattable.dataset.EventData) Date(java.util.Date)

Example 2 with ValidationFailedException

use of org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException in project nebula.widgets.nattable by eclipse.

the class CrossValidationDialogErrorHandling method validate.

@Override
public boolean validate(int columnIndex, int rowIndex, Object newValue) {
    // get the row object out of the dataprovider
    EventData rowObject = this.bodyDataProvider.getRowObject(rowIndex);
    // as the object itself is not yet updated, we need to validate against
    // the given new value
    Date fromDate = rowObject.getFromDate();
    Date toDate = rowObject.getToDate();
    if (columnIndex == 3) {
        fromDate = (Date) newValue;
    } else if (columnIndex == 4) {
        toDate = (Date) newValue;
    }
    if (!_4451_CrossValidationGridExample.isEventDataValid(fromDate, toDate)) {
        throw new ValidationFailedException("fromDate is not before toDate");
    }
    return true;
}
Also used : ValidationFailedException(org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException) EventData(org.eclipse.nebula.widgets.nattable.dataset.EventData) Date(java.util.Date)

Aggregations

Date (java.util.Date)2 ValidationFailedException (org.eclipse.nebula.widgets.nattable.data.validate.ValidationFailedException)2 EventData (org.eclipse.nebula.widgets.nattable.dataset.EventData)2