KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > swing > panel > BasicCompositePanel


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): Jerome Moroy, Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26 package org.objectweb.util.explorer.swing.panel;
27
28 import java.awt.Color JavaDoc;
29 import java.util.Iterator JavaDoc;
30 import java.util.Vector JavaDoc;
31
32 import javax.swing.BoxLayout JavaDoc;
33 import javax.swing.JPanel JavaDoc;
34
35 import org.objectweb.util.explorer.api.Panel;
36 import org.objectweb.util.explorer.api.TreeView;
37 import org.objectweb.util.explorer.swing.api.CompositePanel;
38
39 /**
40  *
41  *
42  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>,
43  * <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>.
44  *
45  * @version 0.1
46  */

47 public class BasicCompositePanel
48      extends JPanel JavaDoc
49   implements CompositePanel, Panel JavaDoc
50 {
51
52     //==================================================================
53
//
54
// Internal States.
55
//
56
// ==================================================================
57

58     /** The list containing the inner panels */
59     protected Vector JavaDoc panelList_;
60     
61     // ==================================================================
62
//
63
// Constructors.
64
//
65
// ==================================================================
66

67     public BasicCompositePanel(){
68         panelList_ = new Vector JavaDoc();
69         setBackground(Color.white);
70         setLayout(new BoxLayout JavaDoc(this, BoxLayout.Y_AXIS));
71     }
72     
73     // ==================================================================
74
//
75
// Internal methods.
76
//
77
// ==================================================================
78

79     // ==================================================================
80
//
81
// Public methods for CompositePanel interface.
82
//
83
// ==================================================================
84

85     /* (non-Javadoc)
86      * @see org.objectweb.util.explorer.swing.api.CompositePanel#add(org.objectweb.util.explorer.api.Panel)
87      */

88     public void add(Panel JavaDoc panel) {
89         if(panel!=null){
90             panelList_.add(panel);
91         }
92     }
93
94     // ==================================================================
95
//
96
// Public methods for Panel interface.
97
//
98
// ==================================================================
99

100     /* (non-Javadoc)
101      * @see org.objectweb.util.explorer.api.Panel#selected(org.objectweb.util.explorer.api.TreeView)
102      */

103     public void selected(TreeView treeView) {
104         Iterator JavaDoc it = panelList_.iterator();
105         while (it.hasNext()) {
106             Panel JavaDoc element = (Panel JavaDoc) it.next();
107             element.selected(treeView);
108         }
109     }
110
111     /* (non-Javadoc)
112      * @see org.objectweb.util.explorer.api.Panel#getPanel()
113      */

114     public Object JavaDoc getPanel() {
115         Iterator JavaDoc it = panelList_.iterator();
116         while (it.hasNext()) {
117             Panel JavaDoc element = (Panel JavaDoc) it.next();
118             add((JPanel JavaDoc)element.getPanel());
119         }
120         return this;
121     }
122
123     /* (non-Javadoc)
124      * @see org.objectweb.util.explorer.api.Panel#unselected(org.objectweb.util.explorer.api.TreeView)
125      */

126     public void unselected(TreeView treeView) {
127         Iterator JavaDoc it = panelList_.iterator();
128         while (it.hasNext()) {
129             Panel JavaDoc element = (Panel JavaDoc) it.next();
130             element.unselected(treeView);
131         }
132     }
133
134 }
135
Popular Tags