Search in sources :

Example 1 with TableListener

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

Aggregations

ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)1 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)1 TableEvent (org.eclipse.scout.rt.client.ui.basic.table.TableEvent)1 TableListener (org.eclipse.scout.rt.client.ui.basic.table.TableListener)1 IColumn (org.eclipse.scout.rt.client.ui.basic.table.columns.IColumn)1