@Override public void sorterChanged(RowSorterEvent e) { if (e.getType() == Type.SORT_ORDER_CHANGED) { @SuppressWarnings("unchecked") List<? extends SortKey> sortKeys = e.getSource().getSortKeys(); Object[] keys = new Object[sortKeys.size()]; boolean[] directions = new boolean[sortKeys.size()]; int index = 0; for (SortKey s : sortKeys) { keys[index] = SwingTable.this.keys[s.getColumn()]; directions[index] = s.getSortOrder() == SortOrder.ASCENDING; index++; } if (list instanceof Sortable) { ((Sortable) list).sort(keys, directions); } setOffset(0); } }
protected void updateViewSelectionModel(RowSorterEvent e) { if (e.getType() == Type.SORTED) { rebuildViewSelectionModel(); } }