home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / beans / FeatureDescriptor.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  2.2 KB  |  108 lines

  1. package java.beans;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Hashtable;
  5.  
  6. public class FeatureDescriptor {
  7.    private boolean expert;
  8.    private boolean hidden;
  9.    private String shortDescription;
  10.    private String name;
  11.    private String displayName;
  12.    private Hashtable table;
  13.  
  14.    public FeatureDescriptor() {
  15.    }
  16.  
  17.    public String getName() {
  18.       return this.name;
  19.    }
  20.  
  21.    public void setName(String var1) {
  22.       this.name = var1;
  23.    }
  24.  
  25.    public String getDisplayName() {
  26.       return this.displayName == null ? this.getName() : this.displayName;
  27.    }
  28.  
  29.    public void setDisplayName(String var1) {
  30.       this.displayName = var1;
  31.    }
  32.  
  33.    public boolean isExpert() {
  34.       return this.expert;
  35.    }
  36.  
  37.    public void setExpert(boolean var1) {
  38.       this.expert = var1;
  39.    }
  40.  
  41.    public boolean isHidden() {
  42.       return this.hidden;
  43.    }
  44.  
  45.    public void setHidden(boolean var1) {
  46.       this.hidden = var1;
  47.    }
  48.  
  49.    public String getShortDescription() {
  50.       return this.shortDescription == null ? this.getDisplayName() : this.shortDescription;
  51.    }
  52.  
  53.    public void setShortDescription(String var1) {
  54.       this.shortDescription = var1;
  55.    }
  56.  
  57.    public void setValue(String var1, Object var2) {
  58.       if (this.table == null) {
  59.          this.table = new Hashtable();
  60.       }
  61.  
  62.       this.table.put(var1, var2);
  63.    }
  64.  
  65.    public Object getValue(String var1) {
  66.       return this.table == null ? null : this.table.get(var1);
  67.    }
  68.  
  69.    public Enumeration attributeNames() {
  70.       if (this.table == null) {
  71.          this.table = new Hashtable();
  72.       }
  73.  
  74.       return this.table.keys();
  75.    }
  76.  
  77.    FeatureDescriptor(FeatureDescriptor var1, FeatureDescriptor var2) {
  78.       this.expert = var1.expert | var2.expert;
  79.       this.hidden = var1.hidden | var2.hidden;
  80.       this.name = var2.name;
  81.       this.shortDescription = var1.shortDescription;
  82.       if (var2.shortDescription != null) {
  83.          this.shortDescription = var2.shortDescription;
  84.       }
  85.  
  86.       this.displayName = var1.displayName;
  87.       if (var2.displayName != null) {
  88.          this.displayName = var2.displayName;
  89.       }
  90.  
  91.       this.addTable(var1.table);
  92.       this.addTable(var2.table);
  93.    }
  94.  
  95.    private void addTable(Hashtable var1) {
  96.       if (var1 != null) {
  97.          Enumeration var2 = var1.keys();
  98.  
  99.          while(var2.hasMoreElements()) {
  100.             String var3 = (String)var2.nextElement();
  101.             Object var4 = var1.get(var3);
  102.             this.setValue(var3, var4);
  103.          }
  104.  
  105.       }
  106.    }
  107. }
  108.