KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > core > panel > DefaultCompositePanel


1 /*====================================================================
2
3 Objectweb Browser Framework
4 Copyright (C) 2000-2003 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): Philippe Merle, Jerome Moroy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

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

48 public class DefaultCompositePanel
49      extends JPanel JavaDoc
50   implements Composite, Panel JavaDoc {
51
52     //==================================================================
53
//
54
// Internal states.
55
//
56
//==================================================================
57

58     /** The list containing the inner panels */
59     protected Vector JavaDoc panelList_;
60     
61 // protected Box boxPanel_;
62

63     //==================================================================
64
//
65
// Constructor.
66
//
67
//==================================================================
68

69     /**
70      * Default Constructor
71      */

72     public DefaultCompositePanel(){
73         panelList_ = new Vector JavaDoc();
74         setBackground(Color.white);
75         setLayout(new BoxLayout JavaDoc(this, BoxLayout.Y_AXIS));
76
77 // boxPanel_ = Box.createVerticalBox();
78
// add(boxPanel_);
79
}
80
81     //==================================================================
82
//
83
// No internal method.
84
//
85
//==================================================================
86

87     //==================================================================
88
//
89
// Public methods for Composite interface.
90
//
91
//==================================================================
92

93     /**
94      * Overriding methods
95      * @see org.objectweb.util.browser.core.api.Composite#add(org.objectweb.util.browser.api.Panel)
96      */

97     public void add(Panel JavaDoc panel) {
98         if(panel!=null){
99             panelList_.add(panel);
100         }
101     }
102
103     //==================================================================
104
//
105
// Public methods for Panel interface.
106
//
107
//==================================================================
108

109     /**
110      * Overriding methods
111      * @see org.objectweb.util.browser.api.Panel#selected(org.objectweb.util.browser.api.TreeView)
112      */

113     public void selected(TreeView treeView) {
114         Iterator JavaDoc it = panelList_.iterator();
115         while (it.hasNext()) {
116             Panel JavaDoc element = (Panel JavaDoc) it.next();
117             element.selected(treeView);
118         }
119     }
120
121     /**
122      * Overriding methods
123      * @see org.objectweb.util.browser.api.Panel#getPanel()
124      */

125     public JPanel JavaDoc getPanel() {
126         Iterator JavaDoc it = panelList_.iterator();
127 // boxPanel_.add(Box.createVerticalGlue());
128
while (it.hasNext()) {
129             Panel JavaDoc element = (Panel JavaDoc) it.next();
130 // boxPanel_.add(element.getPanel());
131
add(element.getPanel());
132         }
133 // boxPanel_.add(Box.createVerticalGlue());
134
return this;
135     }
136
137     /**
138      * Overriding methods
139      * @see org.objectweb.util.browser.api.Panel#unselected(org.objectweb.util.browser.api.TreeView)
140      */

141     public void unselected(TreeView treeView) {
142         Iterator JavaDoc it = panelList_.iterator();
143         while (it.hasNext()) {
144             Panel JavaDoc element = (Panel JavaDoc) it.next();
145             element.unselected(treeView);
146         }
147     }
148
149 }
150
151
Popular Tags