SwingX 1.0.X
Sorting
There's 2 different ways to do sorting with Glazed Lists and JXTable, each with their own advantages and disadvantages.
Approach 1: EventListJXTableSorting
SortedList sortedList = ...
JXTable table = ...
EventListJXTableSorting sorting = EventListJXTableSorting.install(table, sortedList);
sorting.setMultipleColumnSort(true);
Benefits
Works with SwingX's existing table sort handlers
Drawbacks
Sort indicator icons are for a single column only
Approach 2: TableComparatorChooser
JXTable table = ...
table.setSortable(false);
table.getTableHeader().setDefaultRenderer(new JTableHeader().getDefaultRenderer());
Benefits
Uses sort indicator icons and gesture recognizers from Glazed Lists, which are better suited for the various look and feels
Leverage TableComparatorChooser features, such as multiple comparators per column and simple sorting state persistence
Drawbacks
The code to restore the default header renderer is ugly
Maintaining Selection
It is necessary to disable the SelectionMapper to use JXTable with Glazed Lists. Otherwise, the SelectionMapper competes with Glazed Lists' own selection management, and selection is left in an inconsistent state. To disable SelectionMapper:
JXTable table = ...Â
table.getSelectionMapper().setEnabled(false);