Search in sources :

Example 1 with ITableRowCustomValueContributor

use of org.eclipse.scout.rt.client.ui.basic.table.ITableRowCustomValueContributor 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

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 ValidationFailedStatus (org.eclipse.scout.rt.client.ui.form.fields.ValidationFailedStatus)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1