01: /*
02: * Jacareto Copyright (c) 2002-2005
03: * Applied Computer Science Research Group, Darmstadt University of
04: * Technology, Institute of Mathematics & Computer Science,
05: * Ludwigsburg University of Education, and Computer Based
06: * Learning Research Group, Aachen University. All rights reserved.
07: *
08: * Jacareto is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * Jacareto is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public
19: * License along with Jacareto; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: *
22: */
23:
24: package jacareto.cleverphl.gui;
25:
26: import jacareto.interactionmodel.InteractionModel;
27:
28: import java.awt.Insets;
29:
30: import javax.swing.JTree;
31: import javax.swing.event.TreeModelEvent;
32: import javax.swing.event.TreeModelListener;
33:
34: /**
35: * The JTree displaying the interaction model tree.
36: *
37: * @author <a href="mailto:markus.bois@web.de">Markus Bois</a>
38: * @version 1.0
39: */
40: public class InteractionModelTreeVisualization extends JTree implements
41: TreeModelListener {
42: /**
43: * Creates a new components tree visualization of the specified interaction-model.
44: *
45: * @param interactionModel the components
46: */
47: public InteractionModelTreeVisualization(
48: InteractionModel interactionModel) {
49: super (interactionModel.getTreeModel());
50: interactionModel.getTreeModel().addTreeModelListener(this );
51: expandRow(0);
52: }
53:
54: /**
55: * Returns the insets.
56: *
57: * @return the insets.
58: */
59: public Insets getInsets() {
60: return new Insets(5, 5, 5, 5);
61: }
62:
63: /**
64: * Invoked after nodes have been inserted into the tree.
65: *
66: * @param e DOCUMENT ME!
67: */
68: public void treeNodesInserted(TreeModelEvent e) {
69: expandRow(0);
70: }
71:
72: /**
73: * Invoked after a node (or a set of siblings) has changed in some way.
74: *
75: * @param e DOCUMENT ME!
76: */
77: public void treeNodesChanged(TreeModelEvent e) {
78: }
79:
80: /**
81: * Invoked after nodes have been removed from the tree.
82: *
83: * @param e DOCUMENT ME!
84: */
85: public void treeNodesRemoved(TreeModelEvent e) {
86: }
87:
88: /**
89: * Invoked after the tree has drastically changed structure from a given node down.
90: *
91: * @param e DOCUMENT ME!
92: */
93: public void treeStructureChanged(TreeModelEvent e) {
94: }
95: }
|