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 / InfoPaneClassItem.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-15  |  4.7 KB  |  165 lines

  1. package lotus.notes.internal;
  2.  
  3. import java.lang.reflect.Constructor;
  4. import java.lang.reflect.Field;
  5. import java.lang.reflect.Method;
  6. import java.util.Enumeration;
  7. import java.util.Vector;
  8.  
  9. class InfoPaneClassItem implements InfoPaneItem {
  10.    private String name;
  11.    private String midName;
  12.    private String longName;
  13.  
  14.    InfoPaneClassItem(String var1, String var2) {
  15.       this.longName = var2;
  16.       this.midName = After(this.longName, ' ');
  17.       this.name = After(this.midName, '.');
  18.    }
  19.  
  20.    static String After(String var0, char var1) {
  21.       return var0.substring(var0.lastIndexOf(var1) + 1);
  22.    }
  23.  
  24.    public boolean HasSubCategory() {
  25.       return !this.midName.equals("java.io.Serializable") && !this.midName.equals("java.lang.Cloneable") && !this.midName.equals("java.rmi.Remote") && !this.midName.equals("java.util.EventListener") || this.GetEnumeration().hasMoreElements();
  26.    }
  27.  
  28.    public String GetName() {
  29.       return this.name;
  30.    }
  31.  
  32.    public String GetLongName() {
  33.       return this.longName;
  34.    }
  35.  
  36.    public Enumeration GetEnumeration() {
  37.       InfoPaneVector var1 = new InfoPaneVector();
  38.  
  39.       try {
  40.          Class var2 = Class.forName(this.midName);
  41.          if (var2 != null) {
  42.             this.AddModifier(var2, var1);
  43.             this.AddConstructors(var2, var1);
  44.             this.AddFields(var2, var1);
  45.             this.AddInterfaces(var2, var1);
  46.             this.AddMethods(var2, var1);
  47.             this.AddSuperclass(var2, var1);
  48.          }
  49.       } catch (ClassNotFoundException var3) {
  50.          System.out.println("InfoPaneClassItem.GetEnumeration: " + var3 + " -- could not load " + this.longName);
  51.          ((Throwable)var3).printStackTrace();
  52.       } catch (LinkageError var4) {
  53.          System.out.println("InfoClassItem.GetEnumeration:  " + var4 + " -- could not load " + this.longName);
  54.          ((Throwable)var4).printStackTrace();
  55.       } catch (InfoPaneException var5) {
  56.          System.out.println("InfoPaneClassItem.GetEnumeration: " + var5 + " -- could not load " + this.longName);
  57.          ((Throwable)var5).printStackTrace();
  58.       }
  59.  
  60.       return ((Vector)var1).elements();
  61.    }
  62.  
  63.    void AddModifier(Class var1, InfoPaneVector var2) throws InfoPaneException {
  64.       if (!var1.isInterface()) {
  65.          InfoPaneClassSubItem var3 = new InfoPaneClassSubItem(var1.getModifiers());
  66.          if (var3.HasSubCategory()) {
  67.             var2.Insert(var3);
  68.          }
  69.       }
  70.  
  71.    }
  72.  
  73.    void AddFields(Class var1, InfoPaneVector var2) throws InfoPaneException {
  74.       Field[] var3 = var1.getFields();
  75.       if (var3 != null) {
  76.          InfoPaneClassSubItem var4 = new InfoPaneClassSubItem("InfoPane_Constants");
  77.          InfoPaneClassSubItem var5 = new InfoPaneClassSubItem("InfoPane_Fields");
  78.          InfoPaneClassSubItem.AddFields(var4, var5, var3);
  79.          if (var4.HasSubCategory()) {
  80.             var2.Insert(var4);
  81.          }
  82.  
  83.          if (var5.HasSubCategory()) {
  84.             var2.Insert(var5);
  85.          }
  86.       }
  87.  
  88.    }
  89.  
  90.    void AddInterfaces(Class var1, InfoPaneVector var2) throws InfoPaneException {
  91.       Class[] var3 = var1.getInterfaces();
  92.       if (var3 != null) {
  93.          InfoPaneClassSubItem var4 = new InfoPaneClassSubItem(var3, var1.isInterface());
  94.          if (var4.HasSubCategory()) {
  95.             var2.Insert(var4);
  96.          }
  97.       }
  98.  
  99.    }
  100.  
  101.    void AddConstructors(Class var1, InfoPaneVector var2) throws InfoPaneException {
  102.       Constructor[] var3 = var1.getConstructors();
  103.       if (var3 != null) {
  104.          InfoPaneClassSubItem var4 = new InfoPaneClassSubItem(var3);
  105.          if (var4.HasSubCategory()) {
  106.             var2.Insert(var4);
  107.          }
  108.       }
  109.  
  110.    }
  111.  
  112.    void AddMethods(Class var1, InfoPaneVector var2) throws InfoPaneException {
  113.       Method[] var3 = var1.getMethods();
  114.       if (var3 != null) {
  115.          InfoPaneClassSubItem var4 = new InfoPaneClassSubItem("InfoPane_Methods");
  116.          InfoPaneClassSubItem var5 = new InfoPaneClassSubItem("InfoPane_Static_Methods");
  117.          InfoPaneClassSubItem.AddMethods(var4, var5, var3, var1.isInterface());
  118.          if (var4.HasSubCategory()) {
  119.             var2.Insert(var4);
  120.          }
  121.  
  122.          if (var5.HasSubCategory()) {
  123.             var2.Insert(var5);
  124.          }
  125.       }
  126.  
  127.    }
  128.  
  129.    void AddSuperclass(Class var1, InfoPaneVector var2) throws InfoPaneException {
  130.       Class var3 = var1.getSuperclass();
  131.       if (var3 != null) {
  132.          InfoPaneClassSubItem var4 = new InfoPaneClassSubItem(var3);
  133.          if (var4.HasSubCategory()) {
  134.             var2.Insert(var4);
  135.          }
  136.       }
  137.  
  138.    }
  139.  
  140.    public boolean HasLongName() {
  141.       return true;
  142.    }
  143.  
  144.    public boolean CanPaste() {
  145.       return true;
  146.    }
  147.  
  148.    public void Print(String var1, boolean var2) {
  149.       if (var2 && this.HasLongName() && this.CanPaste()) {
  150.          System.out.println(var1 + this.GetLongName());
  151.       } else {
  152.          System.out.println(var1 + this.GetName());
  153.       }
  154.  
  155.       if (this.HasSubCategory()) {
  156.          Enumeration var3 = this.GetEnumeration();
  157.  
  158.          while(var3.hasMoreElements()) {
  159.             ((InfoPaneItem)var3.nextElement()).Print(var1 + "  ", var2);
  160.          }
  161.       }
  162.  
  163.    }
  164. }
  165.