public void insertIndexInterval(int index,int length,boolean before){
  int insMinIndex=(before) ? index : index + 1;
  int insMaxIndex=(insMinIndex + length) - 1;
  for (int i=maxIndex; i >= insMinIndex; i--) {
    setState(i + length,value.get(i));
  }
  boolean setInsertedValues=((getSelectionMode() == SINGLE_SELECTION) ? false : value.get(index));
  for (int i=insMinIndex; i <= insMaxIndex; i++) {
    setState(i,setInsertedValues);
  }
  int leadIndex=this.leadIndex;
  if (leadIndex > index || (before && leadIndex == index)) {
    leadIndex=this.leadIndex + length;
  }
  int anchorIndex=this.anchorIndex;
  if (anchorIndex > index || (before && anchorIndex == index)) {
    anchorIndex=this.anchorIndex + length;
  }
  if (leadIndex != this.leadIndex || anchorIndex != this.anchorIndex) {
    updateLeadAnchorIndices(anchorIndex,leadIndex);
  }
  fireValueChanged();
}

public void insertIndexInterval ( int index , int length , boolean before ) { int insMinIndex = ( before ) ? index : index + 1 ; int insMaxIndex = ( insMinIndex + length ) - 1 ; for ( int i = maxIndex ; i >= insMinIndex ; i -- ) { setState ( i + length , value . get ( i ) ) ; } boolean setInsertedValues = ( ( getSelectionMode ( ) == SINGLE_SELECTION ) ? false : value . get ( index ) ) ; for ( int i = insMinIndex ; i <= insMaxIndex ; i ++ ) { setState ( i , setInsertedValues ) ; } int leadIndex = this . leadIndex ; if ( leadIndex > index || ( before && leadIndex == index ) ) { leadIndex = this . leadIndex + length ; } int anchorIndex = this . anchorIndex ; if ( anchorIndex > index || ( before && anchorIndex == index ) ) { anchorIndex = this . anchorIndex + length ; } if ( leadIndex != this . leadIndex || anchorIndex != this . anchorIndex ) { updateLeadAnchorIndices ( anchorIndex , leadIndex ) ; } fireValueChanged ( ) ; }
insert length indices beginning before / after index . if the value at index is itself selected and the selection mode is not single_selection , set all of the newly inserted items as selected . otherwise leave them unselected . this method is typically called to sync the selection model with a corresponding change in the data model .
