private int[] getElementsRows(final Collection<? extends T> elements) { final int[] rows = new int[elements.size()]; int index = 0; for (final T element : elements) { rows[index++] = myTable.convertRowIndexToView(myTableModel.getElementRow(element)); } return rows; }
public void selectElements(Collection<? extends T> elements) { if (elements.size() == 0) { myTable.clearSelection(); return; } final int[] rows = getElementsRows(elements); TableUtil.selectRows(myTable, rows); TableUtil.scrollSelectionToVisible(myTable); myTable.requestFocus(); }