private void restoreSortingSelection(int[] selection,int lead,ModelChange change){
  for (int i=selection.length - 1; i >= 0; i--) {
    selection[i]=convertRowIndexToView(selection[i],change);
  }
  lead=convertRowIndexToView(lead,change);
  if (selection.length == 0 || (selection.length == 1 && selection[0] == getSelectedRow())) {
    return;
  }
  selectionModel.setValueIsAdjusting(true);
  selectionModel.clearSelection();
  for (int i=selection.length - 1; i >= 0; i--) {
    if (selection[i] != -1) {
      selectionModel.addSelectionInterval(selection[i],selection[i]);
    }
  }
  SwingUtilities2.setLeadAnchorWithoutSelection(selectionModel,lead,lead);
  selectionModel.setValueIsAdjusting(false);
}

private void restoreSortingSelection ( int [ ] selection , int lead , ModelChange change ) { for ( int i = selection . length - 1 ; i >= 0 ; i -- ) { selection [ i ] = convertRowIndexToView ( selection [ i ] , change ) ; } lead = convertRowIndexToView ( lead , change ) ; if ( selection . length == 0 || ( selection . length == 1 && selection [ 0 ] == getSelectedRow ( ) ) ) { return ; } selectionModel . setValueIsAdjusting ( true ) ; selectionModel . clearSelection ( ) ; for ( int i = selection . length - 1 ; i >= 0 ; i -- ) { if ( selection [ i ] != - 1 ) { selectionModel . addSelectionInterval ( selection [ i ] , selection [ i ] ) ; } } SwingUtilities2 . setLeadAnchorWithoutSelection ( selectionModel , lead , lead ) ; selectionModel . setValueIsAdjusting ( false ) ; }
restores the selection after a model event / sort order changes . all coordinates are in terms of the model .
