<Swing Dev> Review request for 6894632: Removing rows from a DefaultTableModel with a RowSorter deselectes last row
Semyon Sadetsky
semyon.sadetsky at oracle.com
Mon Mar 2 14:47:04 UTC 2015
Hello,
Please review the fix:
http://cr.openjdk.java.net/~alexsch/semyon-sadetsky/6894632/webrev.01/
for bug: https://bugs.openjdk.java.net/browse/JDK-6894632
The thing is the sorter logic uses its internal data structures to
restore selection when the table model has been changed.
For performance reason this internal data is created only upon the table
sort call. If sortable JTable is initialized with no sort order
specified the table sort is not executed and table remains unsorted as
JTable without sorting capability.
When the model of table in such state is changed the corresponding event
handler logic still called the sorter to transform selection. But since
the sorter internal cache was empty the transformation failed in cases
when the selection index exceeds the new table rows count.
Now with the fix the sorter is updated with table model change event
only if the table is really sorted.
More information about the swing-dev
mailing list