Search in sources :

Example 6 with IValueField

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

the class AbstractColumn method editorValueToCell.

/**
 * Map the values of a cell to the editing form field. The default implementation assumes a value field.
 *
 * @throws ProcessingException
 *           if the field is not a value field
 */
protected void editorValueToCell(ITableRow row, IFormField editorField) {
    if (!(editorField instanceof IValueField<?>)) {
        throw new ProcessingException("Expected a value field.");
    } else {
        @SuppressWarnings("unchecked") IValueField<VALUE> valueField = (IValueField<VALUE>) editorField;
        LOG.debug("complete edit: [value={}, text={}, status={}]", valueField.getValue(), valueField.getDisplayText(), valueField.getErrorStatus());
        String cellAction = "";
        Cell cell = row.getCellForUpdate(this);
        if (!contentEquals(cell, valueField)) {
            // remove existing validation and parsing error (but don't remove other possible error-statuses)
            cell.removeErrorStatus(ValidationFailedStatus.class);
            cell.removeErrorStatus(ParsingFailedStatus.class);
            if (valueField.getErrorStatus() == null) {
                parseValueAndSet(row, valueField.getValue(), true);
                cellAction = "parseAndSetValue";
            } else {
                cell.setText(valueField.getDisplayText());
                cell.addErrorStatuses(valueField.getErrorStatus().getChildren());
                cellAction = "setText/addErrorStatuses";
            }
        }
        LOG.debug("cell updated: [value={}, text={}, status={}, cellAction={}]", cell.getValue(), cell.getText(), cell.getErrorStatus(), cellAction);
    }
}
Also used : IValueField(org.eclipse.scout.rt.client.ui.form.fields.IValueField) 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)

Example 7 with IValueField

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

the class FindFieldByXmlIdsVisitor method visitField.

@Override
public boolean visitField(IFormField field, int level, int fieldIndex) {
    int fieldIdRank = getFieldIdRank(field);
    if (fieldIdRank > 0) {
        int enclosingFieldPathRank = getEnclosingFieldPathRank(field);
        CompositeObject key;
        if (field instanceof IValueField) {
            key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 2);
        } else if (!(field instanceof ICompositeField)) {
            key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 1);
        } else {
            key = new CompositeObject(fieldIdRank, enclosingFieldPathRank, 0);
        }
        if (m_prioMap.containsKey(key)) {
            m_ambiguousFieldKeys.add(key);
        } else {
            m_prioMap.put(key, field);
        }
    }
    return true;
}
Also used : CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject) ICompositeField(org.eclipse.scout.rt.client.ui.form.fields.ICompositeField) IValueField(org.eclipse.scout.rt.client.ui.form.fields.IValueField)

Aggregations

IValueField (org.eclipse.scout.rt.client.ui.form.fields.IValueField)7 ICompositeField (org.eclipse.scout.rt.client.ui.form.fields.ICompositeField)2 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)2 CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 ArrayList (java.util.ArrayList)1 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 IForm (org.eclipse.scout.rt.client.ui.form.IForm)1 IComposerField (org.eclipse.scout.rt.client.ui.form.fields.composer.IComposerField)1 ITableField (org.eclipse.scout.rt.client.ui.form.fields.tablefield.ITableField)1 PlatformError (org.eclipse.scout.rt.platform.exception.PlatformError)1 PlatformExceptionTranslator (org.eclipse.scout.rt.platform.exception.PlatformExceptionTranslator)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 Test (org.junit.Test)1