glazedlists
glazedlists copied to clipboard
TableComparatorChooser should accept also an EventList
It would be convenient if TableComparatorChooser had an overloaded constructor
that accepts an EventList and wraps it on the fly into a SortedList using a
dummy Comparator, that is, a comparator that always returns 0.
In my opinion it's quite a common pattern for bean based lists. You have a list
of beans that are not comparable, and want to show them into a table as they
are. At first they are not sorted, but the user can decide to sort them clicking
on column headers.
Of course I can code the above every time, or create an utility class to do
that, but it would be just better to make have this behaviour in the
TableComparatorChooser constructor ![]()
This is possible, but not before we fix
GH-193: EventTableModel should support changing the EventList
The fix would do the following:
- if constructed with a SortedList, use that to sort
- if constructed with something else, replace the JTable's EventTableModel's EventList source with a
sorted version of that source
This would also allow TableComparatorChooser to be constructed with just a JTable and no EventList!
That constructor would fail if the JTable's model was not an EventTableModel.
Depends on: GH-193