Search in sources :

Example 1 with ITableRowDataMapper

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

the class ContentAssistFieldTable method setLookupRows.

@Override
public void setLookupRows(List<? extends ILookupRow<LOOKUP_KEY>> lookupRows) {
    List<ITableRow> rows = new ArrayList<ITableRow>();
    for (ILookupRow<LOOKUP_KEY> lookupRow : lookupRows) {
        ITableRow row = createRow();
        // Note: we should use a ComparableLookupRow here because restoreSelection does not work
        // since LookupRow does not implement equals/hashCode [awe]
        row.getCellForUpdate(getKeyColumn()).setValue(lookupRow);
        rows.add(row);
        row.setEnabled(lookupRow.isEnabled());
        AbstractTableRowData tableRowBean = lookupRow.getAdditionalTableRowData();
        if (tableRowBean != null) {
            ITableRowDataMapper mapper = createTableRowDataMapper(tableRowBean.getClass());
            mapper.importTableRowData(row, tableRowBean);
        }
    }
    try {
        setTableChanging(true);
        replaceRows(rows);
    } finally {
        setTableChanging(false);
    }
}
Also used : AbstractTableRowData(org.eclipse.scout.rt.shared.data.basic.table.AbstractTableRowData) ArrayList(java.util.ArrayList) ITableRow(org.eclipse.scout.rt.client.ui.basic.table.ITableRow) ITableRowDataMapper(org.eclipse.scout.rt.client.ui.basic.table.ITableRowDataMapper)

Aggregations

ArrayList (java.util.ArrayList)1 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 ITableRowDataMapper (org.eclipse.scout.rt.client.ui.basic.table.ITableRowDataMapper)1 AbstractTableRowData (org.eclipse.scout.rt.shared.data.basic.table.AbstractTableRowData)1