home *** CD-ROM | disk | FTP | other *** search
- package java.beans;
-
- import java.util.Enumeration;
- import java.util.Hashtable;
-
- public class FeatureDescriptor {
- private boolean expert;
- private boolean hidden;
- private String shortDescription;
- private String name;
- private String displayName;
- private Hashtable table;
-
- public FeatureDescriptor() {
- }
-
- FeatureDescriptor(FeatureDescriptor x, FeatureDescriptor y) {
- this.expert = x.expert | y.expert;
- this.hidden = x.hidden | y.hidden;
- this.name = y.name;
- this.shortDescription = x.shortDescription;
- if (y.shortDescription != null) {
- this.shortDescription = y.shortDescription;
- }
-
- this.displayName = x.displayName;
- if (y.displayName != null) {
- this.displayName = y.displayName;
- }
-
- this.addTable(x.table);
- this.addTable(y.table);
- }
-
- private void addTable(Hashtable t) {
- if (t != null) {
- Enumeration keys = t.keys();
-
- while(keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- Object value = t.get(key);
- this.setValue(key, value);
- }
-
- }
- }
-
- public Enumeration attributeNames() {
- if (this.table == null) {
- this.table = new Hashtable();
- }
-
- return this.table.keys();
- }
-
- public String getDisplayName() {
- return this.displayName == null ? this.getName() : this.displayName;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getShortDescription() {
- return this.shortDescription == null ? this.getDisplayName() : this.shortDescription;
- }
-
- public Object getValue(String attributeName) {
- return this.table == null ? null : this.table.get(attributeName);
- }
-
- public boolean isExpert() {
- return this.expert;
- }
-
- public boolean isHidden() {
- return this.hidden;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
- public void setExpert(boolean expert) {
- this.expert = expert;
- }
-
- public void setHidden(boolean hidden) {
- this.hidden = hidden;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setShortDescription(String text) {
- this.shortDescription = text;
- }
-
- public void setValue(String attributeName, Object value) {
- if (this.table == null) {
- this.table = new Hashtable();
- }
-
- this.table.put(attributeName, value);
- }
- }
-