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;
}
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();
}
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();
}
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());
}
Aggregations