예제 #1
0
  private void rowChanged(int row, boolean insert) {
    // make sure we access the right column value
    int crow = m_rows.getColumnRow(row, getColumnIndex());

    if (m_index instanceof IntIntSortedMap) {
      IntIntSortedMap map = (IntIntSortedMap) m_index;
      int key = m_col.getInt(row);
      if (insert) map.put(key, row);
      else map.remove(key, row);
    } else if (m_index instanceof LongIntSortedMap) {
      LongIntSortedMap map = (LongIntSortedMap) m_index;
      long key = m_col.getLong(crow);
      if (insert) map.put(key, row);
      else map.remove(key, row);
    } else if (m_index instanceof FloatIntSortedMap) {
      FloatIntSortedMap map = (FloatIntSortedMap) m_index;
      float key = m_col.getFloat(crow);
      if (insert) map.put(key, row);
      else map.remove(key, row);
    } else if (m_index instanceof DoubleIntSortedMap) {
      DoubleIntSortedMap map = (DoubleIntSortedMap) m_index;
      double key = m_col.getDouble(crow);
      if (insert) map.put(key, row);
      else map.remove(key, row);
    } else if (m_index instanceof BooleanIntSortedMap) {
      BooleanIntSortedMap map = (BooleanIntSortedMap) m_index;
      boolean key = m_col.getBoolean(crow);
      if (insert) map.put(key, row);
      else map.remove(key, row);
    } else if (m_index instanceof ObjectIntSortedMap) {
      ObjectIntSortedMap map = (ObjectIntSortedMap) m_index;
      Object key = m_col.get(crow);
      if (insert) map.put(key, row);
      else map.remove(key, row);
    } else {
      throw new IllegalStateException();
    }
  }
예제 #2
0
 /**
  * @see prefuse.data.event.ColumnListener#columnChanged(prefuse.data.column.Column, int, boolean)
  */
 public void columnChanged(Column src, int idx, boolean prev) {
   int row = m_rows.getTableRow(idx, getColumnIndex());
   if (row < 0) return; // invalid row value
   ((BooleanIntSortedMap) m_index).remove(prev, row);
   ((BooleanIntSortedMap) m_index).put(src.getBoolean(idx), row);
 }