KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

40     public Graph getGraph() {
41         return m_graph;
42     }
43     
44     // ------------------------------------------------------------------------
45
// If only we had multiple inheritance or categories....
46
// Instead we must re-implement the entire Node interface.
47

48     /**
49      * @see prefuse.data.Node#getInDegree()
50      */

51     public int getInDegree() {
52         return m_graph.getInDegree(this);
53     }
54
55     /**
56      * @see prefuse.data.Node#getOutDegree()
57      */

58     public int getOutDegree() {
59         return m_graph.getOutDegree(this);
60     }
61
62     /**
63      * @see prefuse.data.Node#getDegree()
64      */

65     public int getDegree() {
66         return m_graph.getDegree(this);
67     }
68
69     /**
70      * @see prefuse.data.Node#inEdges()
71      */

72     public Iterator JavaDoc inEdges() {
73         return m_graph.inEdges(this);
74     }
75
76     /**
77      * @see prefuse.data.Node#outEdges()
78      */

79     public Iterator JavaDoc outEdges() {
80         return m_graph.outEdges(this);
81     }
82     
83     /**
84      * @see prefuse.data.Node#edges()
85      */

86     public Iterator JavaDoc edges() {
87         return m_graph.edges(this);
88     }
89     
90     /**
91      * @see prefuse.data.Node#inNeighbors()
92      */

93     public Iterator JavaDoc inNeighbors() {
94         return m_graph.inNeighbors(this);
95     }
96     
97     /**
98      * @see prefuse.data.Node#outNeighbors()
99      */

100     public Iterator JavaDoc outNeighbors() {
101         return m_graph.outNeighbors(this);
102     }
103     
104     /**
105      * @see prefuse.data.Node#neighbors()
106      */

107     public Iterator JavaDoc neighbors() {
108         return m_graph.neighbors(this);
109     }
110
111     // ------------------------------------------------------------------------
112

113     /**
114      * @see prefuse.data.Node#getParent()
115      */

116     public Node getParent() {
117         return m_graph.getSpanningTree().getParent(this);
118     }
119
120     /**
121      * @see prefuse.data.Node#getParentEdge()
122      */

123     public Edge getParentEdge() {
124         return m_graph.getSpanningTree().getParentEdge(this);
125     }
126     
127     /**
128      * @see prefuse.data.Node#getChildCount()
129      */

130     public int getChildCount() {
131         return m_graph.getSpanningTree().getChildCount(m_row);
132     }
133
134     /**
135      * @see prefuse.data.Node#getChildIndex(prefuse.data.Node)
136      */

137     public int getChildIndex(Node child) {
138         return m_graph.getSpanningTree().getChildIndex(this, child);
139     }
140     
141     /**
142      * @see prefuse.data.Node#getChild(int)
143      */

144     public Node getChild(int idx) {
145         return m_graph.getSpanningTree().getChild(this, idx);
146     }
147     
148     /**
149      * @see prefuse.data.Node#getFirstChild()
150      */

151     public Node getFirstChild() {
152         return m_graph.getSpanningTree().getFirstChild(this);
153     }
154     
155     /**
156      * @see prefuse.data.Node#getLastChild()
157      */

158     public Node getLastChild() {
159         return m_graph.getSpanningTree().getLastChild(this);
160     }
161     
162     /**
163      * @see prefuse.data.Node#getPreviousSibling()
164      */

165     public Node getPreviousSibling() {
166         return m_graph.getSpanningTree().getPreviousSibling(this);
167     }
168     
169     /**
170      * @see prefuse.data.Node#getNextSibling()
171      */

172     public Node getNextSibling() {
173         return m_graph.getSpanningTree().getNextSibling(this);
174     }
175     
176     /**
177      * @see prefuse.data.Node#children()
178      */

179     public Iterator JavaDoc children() {
180         return m_graph.getSpanningTree().children(this);
181     }
182
183     /**
184      * @see prefuse.data.Node#childEdges()
185      */

186     public Iterator JavaDoc childEdges() {
187         return m_graph.getSpanningTree().childEdges(this);
188     }
189
190     /**
191      * @see prefuse.data.Node#getDepth()
192      */

193     public int getDepth() {
194         return m_graph.getSpanningTree().getDepth(m_row);
195     }
196     
197 } // end of class TableNodeItem
198
Popular Tags