private void restoreSelection(ModelChange change){
  syncingSelection=true;
  if (lastModelSelection != null) {
    restoreSortingSelection(lastModelSelection,modelLeadIndex,change);
    lastModelSelection=null;
  }
 else   if (modelSelection != null) {
    ListSelectionModel viewSelection=getSelectionModel();
    viewSelection.setValueIsAdjusting(true);
    viewSelection.clearSelection();
    int min=modelSelection.getMinSelectionIndex();
    int max=modelSelection.getMaxSelectionIndex();
    int viewIndex;
    for (int modelIndex=min; modelIndex <= max; modelIndex++) {
      if (modelSelection.isSelectedIndex(modelIndex)) {
        viewIndex=convertRowIndexToView(modelIndex);
        if (viewIndex != -1) {
          viewSelection.addSelectionInterval(viewIndex,viewIndex);
        }
      }
    }
    int viewLeadIndex=modelSelection.getLeadSelectionIndex();
    if (viewLeadIndex != -1 && !modelSelection.isSelectionEmpty()) {
      viewLeadIndex=convertRowIndexToView(viewLeadIndex);
    }
    SwingUtilities2.setLeadAnchorWithoutSelection(viewSelection,viewLeadIndex,viewLeadIndex);
    viewSelection.setValueIsAdjusting(false);
  }
  syncingSelection=false;
}

private void restoreSelection ( ModelChange change ) { syncingSelection = true ; if ( lastModelSelection != null ) { restoreSortingSelection ( lastModelSelection , modelLeadIndex , change ) ; lastModelSelection = null ; } else if ( modelSelection != null ) { ListSelectionModel viewSelection = getSelectionModel ( ) ; viewSelection . setValueIsAdjusting ( true ) ; viewSelection . clearSelection ( ) ; int min = modelSelection . getMinSelectionIndex ( ) ; int max = modelSelection . getMaxSelectionIndex ( ) ; int viewIndex ; for ( int modelIndex = min ; modelIndex <= max ; modelIndex ++ ) { if ( modelSelection . isSelectedIndex ( modelIndex ) ) { viewIndex = convertRowIndexToView ( modelIndex ) ; if ( viewIndex != - 1 ) { viewSelection . addSelectionInterval ( viewIndex , viewIndex ) ; } } } int viewLeadIndex = modelSelection . getLeadSelectionIndex ( ) ; if ( viewLeadIndex != - 1 && ! modelSelection . isSelectionEmpty ( ) ) { viewLeadIndex = convertRowIndexToView ( viewLeadIndex ) ; } SwingUtilities2 . setLeadAnchorWithoutSelection ( viewSelection , viewLeadIndex , viewLeadIndex ) ; viewSelection . setValueIsAdjusting ( false ) ; } syncingSelection = false ; }
restores the selection from that in terms of the model .
