コード例 #1
0
    public void remove(int i) {
      int s = getSelectedIndex();
      if (s != -1) {
        filters.remove(i);
        fireIntervalRemoved(this, i, i);

        if (i < s) {
          selection.setSelectionInterval(s - 1, s - 1);
        }
        if (i == s) {
          selection.setSelectionInterval(100, 0);
        }
      }
    }
コード例 #2
0
 public FilterModel(FilterRepository rep) {
   filters = new ArrayList<TaskFilter>(rep.size() * 2);
   int selectedi = 0;
   for (TaskFilter f : rep.getFilters()) {
     if (f == rep.getActive()) selection.setSelectionInterval(selectedi, selectedi);
     filters.add((TaskFilter) f.clone());
     selectedi++;
   }
 }
コード例 #3
0
 @Override
 public void setSelectionInterval(final int index0, final int index1) {
   if (isSelectedIndex(index0) && !this.gestureStarted) {
     super.removeSelectionInterval(index0, index1);
   } else {
     super.setSelectionInterval(index0, index1);
   }
   this.gestureStarted = true;
 }
コード例 #4
0
 public void addPath(String path) {
   if (path == null) return;
   data.add(path);
   sort();
   fireTableDataChanged();
   int idx = data.indexOf(path);
   if (idx >= 0) {
     selectionModel.setSelectionInterval(idx, idx);
   }
 }
コード例 #5
0
 public void addStyle(String style) {
   if (style == null) return;
   data.add(style);
   sort();
   fireTableDataChanged();
   int idx = data.indexOf(style);
   if (idx >= 0) {
     selectionModel.setSelectionInterval(idx, idx);
   }
 }
コード例 #6
0
 public void updatePath(int pos, String path) {
   if (path == null) return;
   if (pos < 0 || pos >= getRowCount()) return;
   data.set(pos, path);
   sort();
   fireTableDataChanged();
   int idx = data.indexOf(path);
   if (idx >= 0) {
     selectionModel.setSelectionInterval(idx, idx);
   }
 }