use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class TableEventBuffer method identicalEventHashCode.
/**
* Computes a hash value for identical table events. This method must be kept in sync with
* {@link #isIdenticalEvent(TableEvent, TableEvent)}.
*/
protected int identicalEventHashCode(TableEvent event) {
final int prime = 31;
int result = 1;
result = prime * result + event.getType();
result = prime * result + (event.isConsumed() ? 1231 : 1237);
result = prime * result + (event.isSortInMemoryAllowed() ? 1231 : 1237);
List<ITableRow> rows = event.getRows();
result = prime * result + ((rows == null) ? 0 : rows.hashCode());
List<IMenu> popupMenus = event.getPopupMenus();
result = prime * result + ((popupMenus == null) ? 0 : popupMenus.hashCode());
TransferObject dragObject = event.getDragObject();
result = prime * result + ((dragObject == null) ? 0 : dragObject.hashCode());
TransferObject dropObject = event.getDropObject();
result = prime * result + ((dropObject == null) ? 0 : dropObject.hashCode());
TransferObject copyObject = event.getCopyObject();
result = prime * result + ((copyObject == null) ? 0 : copyObject.hashCode());
Collection<IColumn<?>> columns = event.getColumns();
result = prime * result + ((columns == null) ? 0 : columns.hashCode());
return result;
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class TableRowDataMapper method exportTableRowData.
@Override
public void exportTableRowData(ITableRow row, AbstractTableRowData rowData) {
for (IColumn column : m_columnSet.getColumns()) {
if (m_ignoredColumns.contains(column)) {
continue;
}
Object value = column.getValue(row);
FastPropertyDescriptor propertyDesc = m_propertyDescriptorByColumn.get(column);
if (propertyDesc != null) {
try {
Method columnWriteMethod = propertyDesc.getWriteMethod();
Object dto = getDataContainer(rowData, columnWriteMethod.getDeclaringClass());
columnWriteMethod.invoke(dto, value);
} catch (Exception t) {
LOG.warn("Error writing row data property for column [{}]", column.getClass().getName(), t);
}
} else {
rowData.setCustomValue(column.getColumnId(), value);
}
}
rowData.setRowState(row.getStatus());
exportCustomValues(row, rowData);
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnMandatoryTest method testFieldNotMandatoryInColumn.
/**
* Tests, if a field is not mandatory in a non-mandatory column
*/
@Test
public void testFieldNotMandatoryInColumn() {
MandatoryTestTable testTable = new MandatoryTestTable();
testTable.addRowByArray(getTestRow());
IColumn col = testTable.getNonMandatoryTestColumn();
IFormField field = col.prepareEdit(testTable.getRow(0));
assertFalse(col.isMandatory());
assertFalse(field.isMandatory());
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class ColumnMandatoryTest method testMandatoryErrorIfNoValue.
/**
* Tests, if a field is mandatory by setting value
*/
@Test
public void testMandatoryErrorIfNoValue() {
MandatoryTestTable testTable = new MandatoryTestTable();
testTable.addRowByArray(getTestRow());
IColumn mandatoryCol = testTable.getMandatoryTestColumn();
IFormField field = mandatoryCol.prepareEdit(testTable.getRow(0));
assertTrue(mandatoryCol.isMandatory());
assertTrue(field.isMandatory());
assertTrue(field.isContentValid());
}
use of org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn in project scout.rt by eclipse.
the class JsonTableTest method testColumnStructureChangedEvent_dispose.
/**
* If column structure changes, old columns are disposed and the new ones attached
*/
@Test
public void testColumnStructureChangedEvent_dispose() throws JSONException {
TableWith3Cols table = new TableWith3Cols();
table.fill(2);
table.initTable();
table.resetColumns();
IColumn column0 = table.getColumnSet().getColumn(0);
IColumn column1 = table.getColumnSet().getColumn(1);
IColumn column2 = table.getColumnSet().getColumn(2);
column0.setVisible(false);
JsonTable<ITable> jsonTable = UiSessionTestUtility.newJsonAdapter(m_uiSession, table, null);
jsonTable.toJson();
String column0Id = jsonTable.getColumnId(column0);
String column1Id = jsonTable.getColumnId(column1);
String column2Id = jsonTable.getColumnId(column2);
assertNull(column0Id);
assertNotNull(column1Id);
assertNotNull(column2Id);
column0.setVisible(true);
column2.setVisible(false);
JsonResponse response = m_uiSession.currentJsonResponse();
response.fireProcessBufferedEvents();
String newColumn0Id = jsonTable.getColumnId(column0);
String newColumn1Id = jsonTable.getColumnId(column1);
String newColumn2Id = jsonTable.getColumnId(column2);
assertNotNull(newColumn0Id);
assertNotNull(newColumn1Id);
Assert.assertNotEquals(column1Id, newColumn1Id);
assertNull(newColumn2Id);
}
Aggregations