1 | /* java.beans.FeatureDescriptor
|
---|
2 | Copyright (C) 1998 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | This file is part of GNU Classpath.
|
---|
5 |
|
---|
6 | GNU Classpath is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | GNU Classpath is distributed in the hope that it will be useful, but
|
---|
12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
---|
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
---|
19 | 02111-1307 USA.
|
---|
20 |
|
---|
21 | Linking this library statically or dynamically with other modules is
|
---|
22 | making a combined work based on this library. Thus, the terms and
|
---|
23 | conditions of the GNU General Public License cover the whole
|
---|
24 | combination.
|
---|
25 |
|
---|
26 | As a special exception, the copyright holders of this library give you
|
---|
27 | permission to link this library with independent modules to produce an
|
---|
28 | executable, regardless of the license terms of these independent
|
---|
29 | modules, and to copy and distribute the resulting executable under
|
---|
30 | terms of your choice, provided that you also meet, for each linked
|
---|
31 | independent module, the terms and conditions of the license of that
|
---|
32 | module. An independent module is a module which is not derived from
|
---|
33 | or based on this library. If you modify this library, you may extend
|
---|
34 | this exception to your version of the library, but you are not
|
---|
35 | obligated to do so. If you do not wish to do so, delete this
|
---|
36 | exception statement from your version. */
|
---|
37 |
|
---|
38 |
|
---|
39 | package java.beans;
|
---|
40 |
|
---|
41 | import java.util.*;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | ** FeatureDescriptor is the common superclass for all JavaBeans Descriptor classes.
|
---|
45 | ** JavaBeans descriptors are abstract descriptors of properties,
|
---|
46 | ** events, methods, beans, etc.<P>
|
---|
47 | **
|
---|
48 | ** <STRONG>Documentation Convention:</STRONG> for proper
|
---|
49 | ** Internalization of Beans inside an RAD tool, sometimes there
|
---|
50 | ** are two names for a property or method: a programmatic, or
|
---|
51 | ** locale-independent name, which can be used anywhere, and a
|
---|
52 | ** localized, display name, for ease of use. In the
|
---|
53 | ** documentation I will specify different String values as
|
---|
54 | ** either <EM>programmatic</EM> or <EM>localized</EM> to
|
---|
55 | ** make this distinction clear.
|
---|
56 | **
|
---|
57 | ** @author John Keiser
|
---|
58 | ** @since JDK1.1
|
---|
59 | ** @version 1.1.0, 31 May 1998
|
---|
60 | **/
|
---|
61 |
|
---|
62 | public class FeatureDescriptor {
|
---|
63 | String name;
|
---|
64 | String displayName;
|
---|
65 | String shortDescription;
|
---|
66 | boolean expert;
|
---|
67 | boolean hidden;
|
---|
68 |
|
---|
69 | Hashtable valueHash;
|
---|
70 |
|
---|
71 | /** Instantiate this FeatureDescriptor with appropriate default values.**/
|
---|
72 | public FeatureDescriptor() {
|
---|
73 | valueHash = new Hashtable();
|
---|
74 | }
|
---|
75 |
|
---|
76 | /** Get the programmatic name of this feature. **/
|
---|
77 | public String getName() {
|
---|
78 | return name;
|
---|
79 | }
|
---|
80 |
|
---|
81 | /** Set the programmatic name of this feature.
|
---|
82 | ** @param name the new name for this feature.
|
---|
83 | **/
|
---|
84 | public void setName(String name) {
|
---|
85 | this.name = name;
|
---|
86 | }
|
---|
87 |
|
---|
88 | /** Get the localized (display) name of this feature. **/
|
---|
89 | public String getDisplayName() {
|
---|
90 | return displayName;
|
---|
91 | }
|
---|
92 |
|
---|
93 | /** Set the localized (display) name of this feature.
|
---|
94 | ** @param displayName the new display name for this feature.
|
---|
95 | **/
|
---|
96 | public void setDisplayName(String displayName) {
|
---|
97 | this.displayName = displayName;
|
---|
98 | }
|
---|
99 |
|
---|
100 | /** Get the localized short description for this feature. **/
|
---|
101 | public String getShortDescription() {
|
---|
102 | return shortDescription;
|
---|
103 | }
|
---|
104 |
|
---|
105 | /** Set the localized short description for this feature.
|
---|
106 | ** @param shortDescription the new short description for this feature.
|
---|
107 | **/
|
---|
108 | public void setShortDescription(String shortDescription) {
|
---|
109 | this.shortDescription = shortDescription;
|
---|
110 | }
|
---|
111 |
|
---|
112 | /** Indicates whether this feature is for expert use only.
|
---|
113 | ** @return true if for use by experts only, or false if anyone can use it.
|
---|
114 | **/
|
---|
115 | public boolean isExpert() {
|
---|
116 | return expert;
|
---|
117 | }
|
---|
118 |
|
---|
119 | /** Set whether this feature is for expert use only.
|
---|
120 | ** @param expert true if for use by experts only, or false if anyone can use it.
|
---|
121 | **/
|
---|
122 | public void setExpert(boolean expert) {
|
---|
123 | this.expert = expert;
|
---|
124 | }
|
---|
125 |
|
---|
126 | /** Indicates whether this feature is for use by tools only.
|
---|
127 | ** If it is for use by tools only, then it should not be displayed.
|
---|
128 | ** @return true if tools only should use it, or false if anyone can see it.
|
---|
129 | **/
|
---|
130 | public boolean isHidden() {
|
---|
131 | return hidden;
|
---|
132 | }
|
---|
133 |
|
---|
134 | /** Set whether this feature is for use by tools only.
|
---|
135 | ** If it is for use by tools only, then it should not be displayed.
|
---|
136 | ** @param hidden true if tools only should use it, or false if anyone can see it.
|
---|
137 | **/
|
---|
138 | public void setHidden(boolean hidden) {
|
---|
139 | this.hidden = hidden;
|
---|
140 | }
|
---|
141 |
|
---|
142 |
|
---|
143 | /** Get an arbitrary value set with setValue().
|
---|
144 | ** @param name the programmatic name of the key.
|
---|
145 | ** @return the value associated with this name, or null if there is none.
|
---|
146 | **/
|
---|
147 | public Object getValue(String name) {
|
---|
148 | return valueHash.get(name);
|
---|
149 | }
|
---|
150 |
|
---|
151 | /** Set an arbitrary string-value pair with this feature.
|
---|
152 | ** @param name the programmatic name of the key.
|
---|
153 | ** @param value the value to associate with the name.
|
---|
154 | **/
|
---|
155 | public void setValue(String name, Object value) {
|
---|
156 | valueHash.put(name, value);
|
---|
157 | }
|
---|
158 |
|
---|
159 | /** Get a list of the programmatic key names set with setValue().
|
---|
160 | ** @return an Enumerator over all the programmatic key names associated
|
---|
161 | ** with this feature.
|
---|
162 | **/
|
---|
163 | public Enumeration attributeNames() {
|
---|
164 | return valueHash.keys();
|
---|
165 | }
|
---|
166 | }
|
---|