Search in sources :

Example 46 with IColumn

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

Example 47 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class OrganizeColumnsFormRegressionTest method givenAProfilesTable.

private void givenAProfilesTable() {
    ITable table = mock(ITable.class);
    OrganizeColumnsForm form = new OrganizeColumnsForm(table);
    profilesTable = form.getProfilesTableField().getTable();
    profilesTable.addTableListener(new TableListener() {

        @Override
        public void tableChangedBatch(List<? extends TableEvent> batch) {
            for (TableEvent e : batch) {
                tableChanged(e);
            }
        }

        @Override
        public void tableChanged(TableEvent e) {
            if (e.getType() == TableEvent.TYPE_REQUEST_FOCUS_IN_CELL) {
                IColumn focusedColumn = CollectionUtility.firstElement(e.getColumns());
                ITableRow focusedRow = CollectionUtility.firstElement(e.getRows());
                if (focusedColumn.equals(profilesTable.getConfigNameColumn())) {
                    lastFocusedRowIndex.setValue(focusedRow.getRowIndex());
                }
            }
        }
    });
    profilesTable.deselectAllRows();
}
Also used : TableEvent(org.eclipse.scout.rt.client.ui.basic.table.TableEvent) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) TableListener(org.eclipse.scout.rt.client.ui.basic.table.TableListener)

Example 48 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class ShowInvisibleColumnsFormTest method testModifyHandler.

@Test
public void testModifyHandler() {
    ShowInvisibleColumnsForm form = getForm();
    form.startModify();
    ColumnsTableField tableField = form.getColumnsTableField();
    Table table = tableField.getTable();
    List<IColumn<?>> columns = table.getKeyColumn().getValues();
    assertEquals(Arrays.asList(m_column3, m_column1), columns);
    form.touch();
    form.doClose();
}
Also used : Table(org.eclipse.scout.rt.client.ui.basic.table.organizer.ShowInvisibleColumnsForm.MainBox.GroupBox.ColumnsTableField.Table) ITable(org.eclipse.scout.rt.client.ui.basic.table.ITable) ColumnsTableField(org.eclipse.scout.rt.client.ui.basic.table.organizer.ShowInvisibleColumnsForm.MainBox.GroupBox.ColumnsTableField) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) Test(org.junit.Test)

Example 49 with IColumn

use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.

the class ColumnMandatoryTest method testValidationOnMandatoryColumn.

/**
 * Tests, if a field is mandatory in a mandatory column
 */
@Test
public void testValidationOnMandatoryColumn() {
    MandatoryTestTable testTable = new MandatoryTestTable();
    testTable.addRowByArray(getEmptyTestRow());
    IColumn mandatoryCol = testTable.getMandatoryTestColumn();
    IFormField field = mandatoryCol.prepareEdit(testTable.getRow(0));
    assertFalse(field.isContentValid());
}
Also used : IFormField(org.eclipse.scout.rt.client.ui.form.fields.IFormField) IColumn(org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn) Test(org.junit.Test)

Aggregations

IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)49 ArrayList (java.util.ArrayList)10 TreeMap (java.util.TreeMap)8 CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)7 Test (org.junit.Test)6 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)5 JSONObject (org.json.JSONObject)5 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)4 IFormField (org.eclipse.scout.rt.client.ui.form.fields.IFormField)4 INumberColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.INumberColumn)3 HashMap (java.util.HashMap)2 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 Method (java.lang.reflect.Method)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 ClientUIPreferences (org.eclipse.scout.rt.client.ui.ClientUIPreferences)1 IKeyStroke (org.eclipse.scout.rt.client.ui.action.keystroke.IKeyStroke)1