01: package prefuse.data.util;
02:
03: import prefuse.data.CascadedTable;
04: import prefuse.data.Table;
05:
06: /**
07: * RowManager instance that additionally takes into account tables which
08: * inherit from a parent table but can also have their own, dedicated
09: * columns.
10: *
11: * @author <a href="http://jheer.org">jeffrey heer</a>
12: */
13: public class CascadedRowManager extends FilteredRowManager {
14:
15: /**
16: * Create a new CascadedRowManager.
17: * @param table the table to manage
18: */
19: public CascadedRowManager(Table table) {
20: super (table);
21: }
22:
23: /**
24: * @see prefuse.data.util.RowManager#getColumnRow(int, int)
25: */
26: public int getColumnRow(int row, int col) {
27: if (!isValidRow(row))
28: return -1;
29: else if (col >= ((CascadedTable) getTable())
30: .getLocalColumnCount())
31: return ((CascadedTable) m_table).getParentTable()
32: .getColumnRow(getParentRow(row), col);
33: else
34: return row;
35: }
36:
37: /**
38: * @see prefuse.data.util.RowManager#getTableRow(int, int)
39: */
40: public int getTableRow(int columnRow, int col) {
41: int row;
42: if (col < ((CascadedTable) getTable()).getLocalColumnCount()) {
43: row = columnRow;
44: } else {
45: row = getChildRow(columnRow);
46: }
47: return isValidRow(row) ? row : -1;
48: }
49:
50: } // end of class CascadedRowManager
|