home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / Notes.jar / lotus / notes / internal / InfoPaneFieldItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-15  |  3.0 KB  |  96 lines

  1. package lotus.notes.internal;
  2.  
  3. import java.lang.reflect.Field;
  4. import java.lang.reflect.Modifier;
  5. import java.util.Enumeration;
  6.  
  7. class InfoPaneFieldItem implements InfoPaneItem {
  8.    private String name;
  9.    private String longName;
  10.    private InfoPaneVector vector;
  11.  
  12.    InfoPaneFieldItem(Field var1) {
  13.       this.name = var1.getName();
  14.       Class var2 = var1.getDeclaringClass();
  15.       boolean var3 = Modifier.isPublic(var2.getModifiers());
  16.       this.longName = var3 ? var1.toString() : this.name;
  17.       this.vector = new InfoPaneVector();
  18.  
  19.       try {
  20.          this.AddModifiers(var1);
  21.          this.AddType(var1);
  22.          if (var3) {
  23.             this.AddValue(var1);
  24.             return;
  25.          }
  26.       } catch (InfoPaneException var5) {
  27.          System.out.println("InfoPaneFieldItem constructor: " + var5);
  28.       }
  29.  
  30.    }
  31.  
  32.    public Enumeration GetEnumeration() {
  33.       return this.vector == null ? null : this.vector.elements();
  34.    }
  35.  
  36.    void AddModifiers(Field var1) throws InfoPaneException {
  37.       InfoPaneFieldSubItem var2 = new InfoPaneFieldSubItem(var1.getModifiers());
  38.       if (var2.HasSubCategory()) {
  39.          this.vector.Insert(var2);
  40.       }
  41.  
  42.    }
  43.  
  44.    void AddType(Field var1) throws InfoPaneException {
  45.       InfoPaneFieldSubItem var2 = new InfoPaneFieldSubItem(var1.getType());
  46.       this.vector.Insert(var2);
  47.    }
  48.  
  49.    void AddValue(Field var1) throws InfoPaneException {
  50.       if (Modifier.isFinal(var1.getModifiers())) {
  51.          try {
  52.             InfoPaneFieldSubItem var2 = new InfoPaneFieldSubItem(var1.get((Object)null));
  53.             this.vector.Insert(var2);
  54.          } catch (IllegalAccessException var3) {
  55.          }
  56.       }
  57.    }
  58.  
  59.    public boolean HasSubCategory() {
  60.       return this.vector != null && this.vector.size() > 0;
  61.    }
  62.  
  63.    public String GetName() {
  64.       return this.name;
  65.    }
  66.  
  67.    public String GetLongName() {
  68.       return this.longName;
  69.    }
  70.  
  71.    public boolean HasLongName() {
  72.       return this.longName != null && this.name != null && this.longName.length() > this.name.length();
  73.    }
  74.  
  75.    public boolean CanPaste() {
  76.       return true;
  77.    }
  78.  
  79.    public void Print(String var1, boolean var2) {
  80.       if (var2 && this.HasLongName() && this.CanPaste()) {
  81.          System.out.println(var1 + this.GetLongName());
  82.       } else {
  83.          System.out.println(var1 + this.GetName());
  84.       }
  85.  
  86.       if (this.HasSubCategory()) {
  87.          Enumeration var3 = this.GetEnumeration();
  88.  
  89.          while(var3.hasMoreElements()) {
  90.             ((InfoPaneItem)var3.nextElement()).Print(var1 + "  ", var2);
  91.          }
  92.       }
  93.  
  94.    }
  95. }
  96.