KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > explorer > core > panel > lib > BasicCompositePanelDescription


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.core.panel.lib;
27
28 import java.util.Iterator JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Vector JavaDoc;
31
32 import org.objectweb.util.explorer.core.panel.api.CompositePanelDescription;
33 import org.objectweb.util.explorer.core.panel.api.PanelDescription;
34
35 /**
36  *
37  *
38  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jérôme Moroy</a>,
39  * <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>.
40  *
41  * @version 0.1
42  */

43 public class BasicCompositePanelDescription
44      extends AbstractPanelDescription
45   implements CompositePanelDescription
46 {
47
48     //==================================================================
49
//
50
// Internal States.
51
//
52
// ==================================================================
53

54     protected List JavaDoc panels_ = null;
55     
56     // ==================================================================
57
//
58
// Constructors.
59
//
60
// ==================================================================
61

62     public BasicCompositePanelDescription(){
63         panels_ = new Vector JavaDoc();
64     }
65     
66     // ==================================================================
67
//
68
// Internal methods.
69
//
70
// ==================================================================
71

72     // ==================================================================
73
//
74
// Public methods for CompositePanelDescription interface.
75
//
76
// ==================================================================
77

78     /* (non-Javadoc)
79      * @see org.objectweb.util.explorer.core.panel.api.PanelDescription#getPanelType()
80      */

81     public String JavaDoc getPanelType() {
82         return COMPOSITE_PANEL;
83     }
84     
85     /* (non-Javadoc)
86      * @see org.objectweb.util.explorer.core.panel.api.CompositePanelDescription#addPanelDescription(org.objectweb.util.explorer.core.panel.api.PanelDescription)
87      */

88     public void addPanelDescription(PanelDescription panelDesc) {
89         if(panelDesc!=null && !panelDesc.isEmpty()){
90             if(panelDesc.inheritTypePanel())
91                 inheritTypePanel_ = true;
92             try{
93                 CompositePanelDescription source = (CompositePanelDescription)panelDesc;
94                 addPanelDescriptions(source.getPanelDescriptions());
95             } catch(ClassCastException JavaDoc e){
96                 panels_.add(panelDesc);
97             }
98         }
99     }
100
101     /* (non-Javadoc)
102      * @see org.objectweb.util.explorer.core.panel.api.CompositePanelDescription#addPanelDescriptions(org.objectweb.util.explorer.core.panel.api.PanelDescription[])
103      */

104     public void addPanelDescriptions(PanelDescription[] panelDescs) {
105         if(panelDescs != null){
106             for (int i = 0; i < panelDescs.length; i++) {
107                 addPanelDescription(panelDescs[i]);
108             }
109         }
110     }
111
112     /* (non-Javadoc)
113      * @see org.objectweb.util.explorer.core.panel.api.CompositePanelDescription#getPanelDescriptions()
114      */

115     public PanelDescription[] getPanelDescriptions() {
116         return (PanelDescription[])panels_.toArray(new PanelDescription[panels_.size()]);
117     }
118
119     
120     /* (non-Javadoc)
121      * @see org.objectweb.util.explorer.core.common.api.Description#isEmpty()
122      */

123     public boolean isEmpty() {
124         return panels_.isEmpty();
125     }
126     
127     /**
128      * Return a String representation of a BasicPanelDescription
129      */

130     public String JavaDoc toString(){
131         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
132         buf.append("BasicCompositePanelDescription[panels=");
133         Iterator JavaDoc it = panels_.iterator();
134         while (it.hasNext()) {
135             buf.append(it.next() + ", ");
136         }
137         buf.append("]");
138         return buf.toString();
139     }
140 }
141
142
143
Popular Tags