KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > explorer > CosTrading > gui > ServiceTypePanel


1 /*===========================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
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):Sylvain Leblanc.
23 Contributor(s): ______________________________________.
24
25 ===========================================================================*/

26
27 package org.objectweb.openccm.explorer.CosTrading.gui;
28
29 import java.awt.Color JavaDoc;
30
31 import javax.swing.Box JavaDoc;
32 import javax.swing.BoxLayout JavaDoc;
33 import javax.swing.JPanel JavaDoc;
34 import javax.swing.JScrollPane JavaDoc;
35 import javax.swing.JTable JavaDoc;
36 import javax.swing.border.TitledBorder JavaDoc;
37 import javax.swing.table.TableModel JavaDoc;
38
39 import org.omg.CosTradingRepos.ServiceTypeRepositoryPackage.TypeStruct;
40
41 /**
42  * Panel used to display the content of a trading service type.
43  *
44  * @author <a HREF="mailto:Sylvain.Leblanc@lifl.fr">Sylvain Leblanc</a>
45  * @version 0.1
46  */

47 public class ServiceTypePanel extends DefaultNodeViewPanel {
48
49     // ==================================================================
50
//
51
// Internal state.
52
//
53
// ==================================================================
54

55     protected TypeStruct type_;
56
57     // ==================================================================
58
//
59
// Constructors.
60
//
61
// ==================================================================
62

63     /**
64      * Default constructor.
65      */

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

77     /**
78      * Creates a Panel containing the service type properties.
79      *
80      * @return A Panel containing the service type properties.
81      */

82     protected JPanel JavaDoc addProperties() {
83         JPanel JavaDoc propertiesPanel = new JPanel JavaDoc();
84         propertiesPanel.setBackground(Color.white);
85         propertiesPanel.setBorder(new TitledBorder JavaDoc(null," Properties ",TitledBorder.CENTER,TitledBorder.TOP));
86         propertiesPanel.setLayout(new java.awt.GridLayout JavaDoc(1, 1));
87
88         Box JavaDoc box = Box.createVerticalBox();
89
90         box.add(Box.createVerticalGlue());
91         // Creates a JTable for properties
92
TableModel JavaDoc dataModel = new ServiceTypePropsTableModel(type_.props);
93         JTable JavaDoc table = new JTable JavaDoc(dataModel);
94         table.setBackground(Color.white);
95         table.setPreferredScrollableViewportSize(table.getMaximumSize());
96
97         JScrollPane JavaDoc scrollpane = new JScrollPane JavaDoc(table);
98         scrollpane.getViewport().setBackground(Color.white);
99         scrollpane.setBackground(Color.white);
100        
101         box.add(scrollpane);
102         box.add(Box.createVerticalGlue());
103
104         propertiesPanel.add(box);
105
106         return propertiesPanel;
107     }
108
109     /**
110      * Creates a Panel containing the service type interface.
111      *
112      * @return A Panel containing the service type interface.
113      */

114     protected JPanel JavaDoc addInterface() {
115         JPanel JavaDoc itfPanel = new JPanel JavaDoc();
116         itfPanel.setBackground(Color.white);
117         itfPanel.setBorder(new TitledBorder JavaDoc(null," IDL interface ",TitledBorder.CENTER,TitledBorder.TOP));
118
119         Box JavaDoc box = Box.createVerticalBox();
120         String JavaDoc if_name = type_.if_name;
121         box.add(new ItfGUI(if_name));
122         itfPanel.add(box);
123
124         return itfPanel;
125     }
126
127     /**
128      * Creates a Panel containing the service type super types.
129      *
130      * @return A Panel containing the service type super types.
131      */

132     protected JPanel JavaDoc addSuperTypes() {
133         JPanel JavaDoc stPanel = new JPanel JavaDoc();
134         stPanel.setBackground(Color.white);
135         stPanel.setBorder(new TitledBorder JavaDoc(null," Super types ",TitledBorder.CENTER,TitledBorder.TOP));
136
137         Box JavaDoc box = Box.createVerticalBox();
138         String JavaDoc[] st = type_.super_types;
139         box.add(new SuperTypesGUI(st));
140         stPanel.add(box);
141
142         return stPanel;
143     }
144
145     // ==================================================================
146
//
147
// Public methods.
148
//
149
// ==================================================================
150

151     /**
152      * Creates the content of the Panel.
153      */

154     public void onSetTreeView() {
155         if (getTreeView() != null) {
156             type_ = (TypeStruct)getTreeView().getSelectedObject();
157             if (type_ != null) {
158                 add(addSuperTypes());
159                 add(addInterface());
160                 add(addProperties());
161             }
162         }
163     }
164 }
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Popular Tags