glazedlists icon indicating copy to clipboard operation
glazedlists copied to clipboard

TableComparatorChooser should accept also an EventList

Open hbrands opened this issue 20 years ago • 2 comments

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

[GLAZEDLISTS-180] created by aaime

hbrands avatar Feb 08 '05 07:02 hbrands

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.

by jessewilson

hbrands avatar Feb 08 '05 12:02 hbrands

Depends on: GH-193

hbrands avatar Mar 11 '17 17:03 hbrands