2003-12-04 Michael Koch <konqueror@gmx.de>
[official-gcc.git] / libjava / java / beans / FeatureDescriptor.java
blob68141cf2f4495f74ce8c4e8dde6c3e933d72e0da
1 /* java.beans.FeatureDescriptor
2 Copyright (C) 1998 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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.
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.
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. */
39 package java.beans;
41 import java.util.Enumeration;
42 import java.util.Hashtable;
44 /**
45 * FeatureDescriptor is the common superclass for all JavaBeans Descriptor
46 * classes. JavaBeans descriptors are abstract descriptors of properties,
47 * events, methods, beans, etc.<P>
49 * <STRONG>Documentation Convention:</STRONG> for proper
50 * Internalization of Beans inside an RAD tool, sometimes there
51 * are two names for a property or method: a programmatic, or
52 * locale-independent name, which can be used anywhere, and a
53 * localized, display name, for ease of use. In the
54 * documentation I will specify different String values as
55 * either <EM>programmatic</EM> or <EM>localized</EM> to
56 * make this distinction clear.
58 * @author John Keiser
59 * @since 1.1
60 * @version 1.1.0, 31 May 1998
63 public class FeatureDescriptor
65 String name;
66 String displayName;
67 String shortDescription;
68 boolean expert;
69 boolean hidden;
70 boolean preferred;
72 Hashtable valueHash;
74 /**
75 * Instantiate this FeatureDescriptor with appropriate default values.
77 public FeatureDescriptor()
79 valueHash = new Hashtable();
82 /**
83 * Get the programmatic name of this feature.
85 public String getName()
87 return name;
90 /**
91 * Set the programmatic name of this feature.
93 * @param name the new name for this feature.
95 public void setName(String name)
97 this.name = name;
101 * Get the localized (display) name of this feature.
103 public String getDisplayName()
105 return displayName;
109 * Set the localized (display) name of this feature.
111 * @param displayName the new display name for this feature.
113 public void setDisplayName(String displayName)
115 this.displayName = displayName;
119 * Get the localized short description for this feature.
121 public String getShortDescription()
123 return shortDescription;
127 * Set the localized short description for this feature.
129 * @param shortDescription the new short description for this feature.
131 public void setShortDescription(String shortDescription)
133 this.shortDescription = shortDescription;
137 * Indicates whether this feature is for expert use only.
139 * @return true if for use by experts only,
140 * or false if anyone can use it.
142 public boolean isExpert()
144 return expert;
148 * Set whether this feature is for expert use only.
150 * @param expert true if for use by experts only,
151 * or false if anyone can use it.
153 public void setExpert(boolean expert)
155 this.expert = expert;
159 * Indicates whether this feature is for use by tools only.
160 * If it is for use by tools only, then it should not be displayed.
162 * @return true if tools only should use it,
163 * or false if anyone can see it.
165 public boolean isHidden()
167 return hidden;
171 * Set whether this feature is for use by tools only.
172 * If it is for use by tools only, then it should not be displayed.
174 * @param hidden true if tools only should use it,
175 * or false if anyone can see it.
177 public void setHidden(boolean hidden)
179 this.hidden = hidden;
182 public boolean isPreferred ()
184 return preferred;
187 public void setPreferred (boolean preferred)
189 this.preferred = preferred;
193 * Get an arbitrary value set with setValue().
195 * @param name the programmatic name of the key.
197 * @return the value associated with this name,
198 * or null if there is none.
200 public Object getValue(String name)
202 return valueHash.get(name);
206 * Set an arbitrary string-value pair with this feature.
208 * @param name the programmatic name of the key.
209 * @param value the value to associate with the name.
211 public void setValue(String name, Object value)
213 valueHash.put(name, value);
217 * Get a list of the programmatic key names set with setValue().
219 * @return an Enumerator over all the programmatic key names associated
220 * with this feature.
222 public Enumeration attributeNames()
224 return valueHash.keys();