Search in sources :

Example 1 with ValidationFailedStatus

use of org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus in project scout.rt by eclipse.

the class AbstractMixedSmartField method setValidationError.

private void setValidationError(String displayText, String errorMessage, int code) {
    setCurrentLookupRow(null);
    setDisplayText(displayText);
    // remove existing validation errors first
    removeErrorStatus(ValidationFailedStatus.class);
    addErrorStatus(new ValidationFailedStatus(errorMessage, ValidationFailedStatus.ERROR, code));
}
Also used : ValidationFailedStatus(org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus)

Example 2 with ValidationFailedStatus

use of org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus in project scout.rt by eclipse.

the class AbstractColumn method setValue.

protected void setValue(ITableRow r, VALUE value, boolean updateValidDisplayText) {
    try {
        Cell cell = r.getCellForUpdate(this);
        cell.removeErrorStatus(ValidationFailedStatus.class);
        VALUE newValue = validateValue(r, value);
        // set newValue into the cell only if there's no error.
        if (!cell.hasError()) {
            r.setCellValue(getColumnIndex(), newValue);
            if (this instanceof ITableRowCustomValueContributor) {
                ((ITableRowCustomValueContributor) this).enrichCustomValues(r, r.getCustomValues());
            }
        }
        ensureVisibileIfInvalid(r);
        if (updateValidDisplayText) {
            updateDisplayText(r, newValue);
        }
    } catch (ProcessingException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Error setting column value ", e);
        }
        Cell cell = r.getCellForUpdate(this);
        // add error
        cell.addErrorStatus(new ValidationFailedStatus<VALUE>(e, value));
        updateDisplayText(r, value);
    }
}
Also used : ITableRowCustomValueContributor(org.eclipse.scout.rt.client.ui.basic.table.ITableRowCustomValueContributor) ValidationFailedStatus(org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus) Cell(org.eclipse.scout.rt.client.ui.basic.cell.Cell) IHeaderCell(org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell) HeaderCell(org.eclipse.scout.rt.client.ui.basic.table.HeaderCell) ICell(org.eclipse.scout.rt.client.ui.basic.cell.ICell) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException)

Aggregations

ValidationFailedStatus (org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus)2 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)1 ICell (org.eclipse.scout.rt.client.ui.basic.cell.ICell)1 HeaderCell (org.eclipse.scout.rt.client.ui.basic.table.HeaderCell)1 IHeaderCell (org.eclipse.scout.rt.client.ui.basic.table.IHeaderCell)1 ITableRowCustomValueContributor (org.eclipse.scout.rt.client.ui.basic.table.ITableRowCustomValueContributor)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1