KickJava   Java API By Example, From Geeks To Geeks.

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


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

26
27 package org.objectweb.openccm.explorer.CosTrading.gui;
28
29 /** The Java API's imports */
30 import java.awt.Color JavaDoc;
31 import javax.swing.BoxLayout JavaDoc;
32 import javax.swing.Box JavaDoc;
33 import javax.swing.border.TitledBorder JavaDoc;
34 import javax.swing.table.TableModel JavaDoc;
35 import javax.swing.JLabel JavaDoc;
36 import javax.swing.JPanel JavaDoc;
37 import javax.swing.JTable JavaDoc;
38 import javax.swing.JScrollPane JavaDoc;
39
40 /** OMG Trading Service imports. */
41 import org.omg.CosTrading.ProxyPackage.ProxyInfo;
42
43 /**
44  * Panel used to view content of
45  * <code>org.omg.CosTrading.ProxyPackage.ProxyInfo</code>
46  * instances. Objects of this type are obtained by the
47  * <code>list_proxies</code> method of the
48  * <code>org.omg.CosTrading.Admin</code> interface. This panel should
49  * be completed with displaying proxy info with policies to pass on.
50  *
51  * @author <a HREF="mailto:Sylvain.Leblanc@lifl.fr">Sylvain Leblanc</a>
52  * @version 0.1
53  */

54 public class ProxyInfoPanel
55      extends DefaultNodeViewPanel
56 {
57
58     // ==================================================================
59
//
60
// Internal state.
61
//
62
// ==================================================================
63

64     /** The Proxy offer to view. */
65     protected ProxyInfo proxyInfo_;
66
67     // ==================================================================
68
//
69
// Constructors.
70
//
71
// ==================================================================
72

73     /**
74      * Default constructor.
75      */

76     public ProxyInfoPanel() {
77         setBackground(Color.white);
78         setLayout(new BoxLayout JavaDoc(this, BoxLayout.Y_AXIS));
79     }
80
81     // ==================================================================
82
//
83
// Internal methods.
84
//
85
// ==================================================================
86

87     // ==================================================================
88
//
89
// Public methods.
90
//
91
// ==================================================================
92

93     // ==================================================================
94
//
95
// Public methods for class DefaultNodeViewPanel.
96
//
97
// ==================================================================
98

99     /**
100      * Creates the content of the Panel.
101      */

102     public void onSetTreeView() {
103         if (getTreeView() != null) {
104             proxyInfo_ = (ProxyInfo)getTreeView().getSelectedObject();
105             if (proxyInfo_ != null) {
106                 
107                 // Creates Service type label
108
JLabel JavaDoc st = new JLabel JavaDoc("Service Type: " + proxyInfo_.type);
109                 
110                 // Creates Properties table
111
TableModel JavaDoc dataModel = new OfferPropsTableModel(proxyInfo_.properties);
112                 JTable JavaDoc table = new JTable JavaDoc(dataModel);
113                 table.setBackground(Color.white);
114                 
115                 // Creates table related scroll pane
116
JScrollPane JavaDoc scroll = new JScrollPane JavaDoc(table);
117                 scroll.getViewport().setBackground(Color.white);
118                 scroll.setBackground(Color.white);
119
120                 Box JavaDoc props_box = Box.createVerticalBox();
121                 props_box.add(Box.createVerticalGlue());
122                 props_box.add(scroll);
123                 props_box.add(Box.createVerticalGlue());
124
125                 JPanel JavaDoc propertiesPanel = new JPanel JavaDoc();
126                 propertiesPanel.setBackground(Color.white);
127                 propertiesPanel.setBorder(new TitledBorder JavaDoc(null," Properties ",TitledBorder.CENTER,TitledBorder.TOP));
128                 propertiesPanel.setLayout(new java.awt.GridLayout JavaDoc(1, 1));
129                 propertiesPanel.add(props_box);
130
131                 // Creates match all label
132
JLabel JavaDoc match = new JLabel JavaDoc("If match all: " + proxyInfo_.if_match_all);
133                 
134                 // Creates recipe label
135
JLabel JavaDoc recipe = new JLabel JavaDoc("Constraint recipe: " + proxyInfo_.recipe);
136                 
137                 // Adds all labels to the box
138
Box JavaDoc box = Box.createVerticalBox();
139                 box.add(st);
140                 box.add(Box.createVerticalStrut(10));
141                 box.add(propertiesPanel);
142                 box.add(Box.createVerticalStrut(10));
143                 box.add(match);
144                 box.add(Box.createVerticalStrut(10));
145                 box.add(recipe);
146                 
147                 add(box);
148             }
149         }
150     }
151 }
152
Popular Tags