KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > prefuse > visual > tuple > TableDecoratorItem


1 package prefuse.visual.tuple;
2
3 import prefuse.data.Graph;
4 import prefuse.data.Table;
5 import prefuse.visual.DecoratorItem;
6 import prefuse.visual.VisualItem;
7 import prefuse.visual.VisualTable;
8
9 /**
10  * DecoratorItem implementation that uses data values from a backing
11  * VisualTable.
12  *
13  * @author <a HREF="http://jheer.org">jeffrey heer</a>
14  */

15 public class TableDecoratorItem extends TableVisualItem
16     implements DecoratorItem
17 {
18     /**
19      * Initialize a new TableDecoratorItem for the given table and row. This
20      * method is used by the appropriate TupleManager instance, and should
21      * not be called directly by client code, unless by a client-supplied
22      * custom TupleManager.
23      * @param table the data Table
24      * @param graph ignored by this class
25      * @param row the table row index
26      */

27     protected void init(Table table, Graph graph, int row) {
28         m_table = table;
29         m_row = m_table.isValidRow(row) ? row : -1;
30     }
31     
32     /**
33      * @see prefuse.visual.DecoratorItem#getDecoratedItem()
34      */

35     public VisualItem getDecoratedItem() {
36         VisualTable vt = (VisualTable)getTable();
37         int prow = vt.getParentRow(getRow());
38         return (VisualItem)vt.getParentTable().getTuple(prow);
39     }
40
41 } // end of class TableDecoratorItem
42
Popular Tags