KickJava   Java API By Example, From Geeks To Geeks.

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


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.JScrollPane JavaDoc;
35 import javax.swing.JTable JavaDoc;
36 import javax.swing.table.TableModel JavaDoc;
37
38 /** OMG Trading Service imports. */
39 import org.omg.CosTrading.RegisterPackage.OfferInfo;
40
41 /**
42  * Panel used to view content of
43  * org.omg.CosTrading.RegisterPackage.OfferInfo instances. Objects of
44  * this type are obtained by the <code>list_offer</code> method of the
45  * <code>org.omg.CosTrading.Admin</code> interface.
46  *
47  * @author <a HREF="mailto:Sylvain.Leblanc@lifl.fr">Sylvain Leblanc</a>
48  * @version 0.1
49  */

50 public class OfferInfoPanel
51      extends DefaultNodeViewPanel
52 {
53
54     // ==================================================================
55
//
56
// Internal state.
57
//
58
// ==================================================================
59

60     /** The OfferInfo to view. */
61     protected OfferInfo offerInfo_;
62
63     // ==================================================================
64
//
65
// Constructors.
66
//
67
// ==================================================================
68

69     /**
70      * Default constructor.
71      */

72     public OfferInfoPanel() {
73         setBackground(Color.white);
74         setLayout(new BoxLayout JavaDoc(this, BoxLayout.Y_AXIS));
75     }
76
77     // ==================================================================
78
//
79
// Internal methods.
80
//
81
// ==================================================================
82

83     // ==================================================================
84
//
85
// Public methods.
86
//
87
// ==================================================================
88

89     // ==================================================================
90
//
91
// Public methods for class DefaultNodeViewPanel.
92
//
93
// ==================================================================
94

95     /**
96      * Creates the content of the panel.
97      */

98     public void onSetTreeView() {
99         if (getTreeView() != null) {
100             offerInfo_ = (OfferInfo)getTreeView().getSelectedObject();
101             if (offerInfo_ != null) {
102                 
103                 javax.swing.JPanel JavaDoc pane = new javax.swing.JPanel JavaDoc();
104                 pane.setBackground(Color.white);
105                 pane.setBorder(new TitledBorder JavaDoc(null, " " + offerInfo_.type + " ",TitledBorder.CENTER,TitledBorder.TOP));
106
107                 // Creates a JTable for properties
108
TableModel JavaDoc dataModel = new OfferPropsTableModel(offerInfo_.properties);
109                 JTable JavaDoc table = new JTable JavaDoc(dataModel);
110                 table.setBackground(Color.white);
111                 
112                 // Adding a scroll pane to the JTable
113
JScrollPane JavaDoc scroll = new JScrollPane JavaDoc(table);
114                 scroll.setBackground(Color.white);
115                 scroll.getViewport().setBackground(Color.white);
116                
117                 // Adding the label and the scroll pane in the Panel
118
Box JavaDoc box = Box.createVerticalBox();
119                 box.add(scroll);
120
121                 pane.add(box);
122
123                 add(pane);
124             }
125         }
126     }
127 }
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Popular Tags