<Swing Dev> Review request for 6894632: Removing rows from a DefaultTableModel with a RowSorter deselectes last row

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Wed Mar 4 08:54:51 UTC 2015


  Is it possible that getSortKeys() methods returns some sort keys where 
the first has unsorted sort order but others do not.

  Thanks,
  Alexandr.

On 3/2/2015 5:47 PM, Semyon Sadetsky wrote:
> 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