示例#1
0
  @Override
  public void removeSelectionInterval(int index0, int index1) {
    System.err.println("DSM: removeSelectionInterval(" + index0 + " - " + index1 + ")");

    int start = Math.min(index0, index1);
    int end = Math.max(index0, index1);
    boolean oldValue = getValueIsAdjusting();

    setValueIsAdjusting(true);

    for (int i = start; i <= end; i++) {
      int modelIndex = sortedModel.convertRowIndexToModel(i);
      delegate.removeSelectionInterval(modelIndex, modelIndex);
    }

    setValueIsAdjusting(oldValue);
    fireSelectionChanged(
        new ListSelectionEvent(this, 0, sortedModel.getRowCount() - 1, getValueIsAdjusting()));
  }
示例#2
0
  private void addSelectionInterval(int index0, int index1, boolean clear) {
    System.err.println(
        "DSM: addSelectionInterval(" + index0 + " - " + index1 + ": clear = " + clear + ")");

    int start = Math.min(index0, index1);
    int end = Math.max(index0, index1);
    boolean oldValue = getValueIsAdjusting();

    setValueIsAdjusting(true);

    if (clear) {
      delegate.clearSelection();
    }

    for (int i = start; i <= end; i++) {
      int modelIndex = sortedModel.convertRowIndexToModel(i);
      delegate.addSelectionInterval(modelIndex, modelIndex);
    }

    setValueIsAdjusting(oldValue);
    fireSelectionChanged(
        new ListSelectionEvent(this, 0, sortedModel.getRowCount() - 1, getValueIsAdjusting()));
  }
示例#3
0
 @Override
 public void setLeadSelectionIndex(int index) {
   delegate.setLeadSelectionIndex(sortedModel.convertRowIndexToModel(index));
 }
示例#4
0
 @Override
 public boolean isSelectedIndex(int index) {
   return delegate.isSelectedIndex(sortedModel.convertRowIndexToModel(index));
 }