KickJava   Java API By Example, From Geeks To Geeks.

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


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

15 public class TableEdgeItem extends TableVisualItem implements EdgeItem {
16
17     protected Graph m_graph;
18     
19     /**
20      * Initialize a new TableEdgeItem for the given graph, table, and row.
21      * This method is used by the appropriate TupleManager instance, and
22      * should not be called directly by client code, unless by a
23      * client-supplied custom TupleManager.
24      * @param table the backing VisualTable
25      * @param graph the backing VisualGraph
26      * @param row the row in the node table to which this Edge instance
27      * corresponds.
28      */

29     protected void init(Table table, Graph graph, int row) {
30         m_table = table;
31         m_graph = graph;
32         m_row = m_table.isValidRow(row) ? row : -1;
33     }
34     
35     /**
36      * @see prefuse.data.Edge#getGraph()
37      */

38     public Graph getGraph() {
39         return m_graph;
40     }
41     
42     /**
43      * @see prefuse.data.Edge#isDirected()
44      */

45     public boolean isDirected() {
46         return m_graph.isDirected();
47     }
48
49     /**
50      * @see prefuse.data.Edge#getSourceNode()
51      */

52     public Node getSourceNode() {
53         return m_graph.getSourceNode(this);
54     }
55
56     /**
57      * @see prefuse.data.Edge#getTargetNode()
58      */

59     public Node getTargetNode() {
60         return m_graph.getTargetNode(this);
61     }
62
63     /**
64      * @see prefuse.data.Edge#getAdjacentNode(prefuse.data.Node)
65      */

66     public Node getAdjacentNode(Node n) {
67         return m_graph.getAdjacentNode(this, n);
68     }
69     
70     /**
71      * @see prefuse.visual.EdgeItem#getSourceItem()
72      */

73     public NodeItem getSourceItem() {
74         return (NodeItem)getSourceNode();
75     }
76
77     /**
78      * @see prefuse.visual.EdgeItem#getTargetItem()
79      */

80     public NodeItem getTargetItem() {
81         return (NodeItem)getTargetNode();
82     }
83
84     /**
85      * @see prefuse.visual.EdgeItem#getAdjacentItem(prefuse.visual.NodeItem)
86      */

87     public NodeItem getAdjacentItem(NodeItem n) {
88         return (NodeItem)getAdjacentNode(n);
89     }
90
91 } // end of class TableEdgeItem
92
Popular Tags