KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > explorer > panel > ComponentGraph


1 /*====================================================================
2
3 Objectweb Explorer Framework
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): ________________________________.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.objectweb.fractal.explorer.panel;
27
28 import java.awt.Color JavaDoc;
29 import javax.swing.JPanel JavaDoc;
30
31 import org.objectweb.fractal.api.Component;
32 import org.objectweb.util.explorer.api.Panel;
33 import org.objectweb.util.explorer.api.TreeView;
34 import org.objectweb.fractal.explorer.graph.FractalGraph;
35
36 /**
37  *
38  * @version 0.2
39  */

40 public class ComponentGraph
41   implements Panel JavaDoc
42 {
43
44     //==================================================================
45
//
46
// Internal states.
47
//
48
//==================================================================
49

50     /** The panel in which the component graph will be drawn. */
51     protected JPanel JavaDoc panel_ = null;
52
53     //==================================================================
54
//
55
// Constructors.
56
//
57
//==================================================================
58

59     /**
60      * Default constructor.
61      * It creates a panel and fixes the background color to white color.
62      */

63     public ComponentGraph(){
64         panel_ = new JPanel JavaDoc();
65         panel_.setBackground(Color.white);
66     }
67
68     //==================================================================
69
//
70
// Internal methods.
71
//
72
//==================================================================
73

74     //==================================================================
75
//
76
// Public methods for Panel interface.
77
//
78
//==================================================================
79

80     /* (non-Javadoc)
81      * @see org.objectweb.util.browser.api.Panel#selected(org.objectweb.util.browser.api.TreeView)
82      */

83     public void selected(TreeView treeView) {
84         // Obtains the Fractal Component which is selected with the mouse
85
Component component = (Component)treeView.getSelectedObject();
86         
87         // Display in the panel
88
FractalGraph fractalGraph = new FractalGraph();
89         panel_.add(fractalGraph.getFractalGraph(component));
90     }
91
92     /* (non-Javadoc)
93      * @see org.objectweb.util.browser.api.Panel#getPanel()
94      */

95     public Object JavaDoc getPanel() {
96         return panel_;
97     }
98     
99
100     /* (non-Javadoc)
101      * @see org.objectweb.util.browser.api.Panel#unselected(org.objectweb.util.browser.api.TreeView)
102      */

103     public void unselected(TreeView arg0) {
104         // Nothing to do!
105
}
106
107 }
108
Popular Tags