KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > packaging > widgets > PropertiesSimpleType


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): Christophe Contreras
23 Contributor(s): ___________________________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.packaging.widgets;
28
29 /**
30  * This is a widget allowing to select types from a list
31  * for the type attribute of a simple property
32  *
33  * @author <a HREF="mailto:Christophe.Contreras@lifl.fr">Christophe Contreras</a>
34  *
35  */

36 public class PropertiesSimpleType
37      extends org.objectweb.apollon.gui.bricks.AbstractBrick
38 {
39     // ==================================================================
40
//
41
// Internal state.
42
//
43
// ==================================================================
44

45     /** the swing scroll list */
46     private javax.swing.JComboBox JavaDoc scrolling_list;
47
48     // ==================================================================
49
//
50
// Constructors.
51
//
52
// ==================================================================
53

54     /**
55      * The default constructor.
56      */

57     public
58     PropertiesSimpleType ()
59     {
60         this("type");
61     }
62     
63     public
64     PropertiesSimpleType (String JavaDoc label)
65     {
66         super(label);
67         
68         // the possible values
69
String JavaDoc[] values
70          = {
71             "boolean"
72             ,"char"
73             ,"double"
74             ,"float"
75             ,"short"
76             ,"long"
77             ,"objref"
78             ,"octet"
79             ,"string"
80             ,"ulong"
81             ,"ushort"
82             ,"longlong"
83             ,"ulonglong"
84             ,"longdouble"
85             ,"wchar"
86             ,"wstring"
87             ,"fixed"
88             };
89
90         // inits the scroll list
91
scrolling_list = new javax.swing.JComboBox JavaDoc(values);
92
93         // sets a default value in the list
94
set("string");
95         scrolling_list.validate();
96
97         this.add(this.scrolling_list);
98     }
99
100     // ==================================================================
101
//
102
// Public methods.
103
//
104
// ==================================================================
105

106     /**
107      * The getter method
108      */

109     public String JavaDoc
110     get()
111     {
112         return (String JavaDoc)this.scrolling_list.getSelectedItem();
113     }
114
115     /**
116      * The setter method
117      */

118     public void
119     set (String JavaDoc line_text)
120     {
121         this.scrolling_list.setSelectedItem(line_text);
122     }
123
124 }
125
Popular Tags