Search in sources :

Example 6 with IValidateContentDescriptor

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

the class AbstractTableField method validateContent.

@Override
public IValidateContentDescriptor validateContent() {
    IValidateContentDescriptor desc = super.validateContent();
    // super check
    if (desc != null) {
        return desc;
    }
    ITable table = getTable();
    // check cells
    ValidateTableFieldDescriptor tableDesc = null;
    TreeSet<String> columnNames = new TreeSet<String>();
    if (table != null) {
        for (ITableRow row : table.getRows()) {
            for (IColumn col : table.getColumns()) {
                if (!col.isContentValid(row)) {
                    if (tableDesc == null) {
                        tableDesc = new ValidateTableFieldDescriptor(this, row, col);
                    }
                    columnNames.add(getColumnName(col));
                }
            }
        }
        table.ensureInvalidColumnsVisible();
    }
    if (tableDesc != null) {
        tableDesc.setDisplayText(TEXTS.get("TableName") + " " + getLabel() + ": " + CollectionUtility.format(columnNames));
    }
    return tableDesc;
}
Also used : IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) TreeSet(java.util.TreeSet) IValidateContentDescriptor(org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow)

Aggregations

IValidateContentDescriptor (org.eclipse.scout.rt.client.ui.form.fields.IValidateContentDescriptor)6 Cell (org.eclipse.scout.rt.client.ui.basic.cell.Cell)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)1 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)1