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

  1. package lotus.notes.internal;
  2.  
  3. import java.util.Enumeration;
  4. import lotus.notes.JavaString;
  5.  
  6. class InfoPanePackageItem implements InfoPaneItem {
  7.    private InfoPaneVector vector;
  8.    private String name;
  9.  
  10.    InfoPanePackageItem(String var1) {
  11.       this.name = var1;
  12.       this.vector = new InfoPaneVector();
  13.    }
  14.  
  15.    InfoPanePackageSubItem FindPackageSub(String var1) {
  16.       return (InfoPanePackageSubItem)this.vector.Find(JavaString.resource.getString("InfoPane_" + var1));
  17.    }
  18.  
  19.    InfoPaneClassItem FindClass(String var1) {
  20.       return this.FindClassOrInterface("Classes", var1);
  21.    }
  22.  
  23.    InfoPaneClassItem FindInterface(String var1) {
  24.       return this.FindClassOrInterface("Interfaces", var1);
  25.    }
  26.  
  27.    InfoPaneClassItem FindClassOrInterface(String var1, String var2) {
  28.       InfoPanePackageSubItem var3 = this.FindPackageSub(var1);
  29.       return var3 == null ? null : var3.FindClass(var2);
  30.    }
  31.  
  32.    InfoPanePackageSubItem AddPackageSub(String var1) throws InfoPaneException {
  33.       return (InfoPanePackageSubItem)this.vector.Insert(new InfoPanePackageSubItem(var1));
  34.    }
  35.  
  36.    InfoPaneClassItem AddClass(String var1, String var2) throws InfoPaneException {
  37.       return this.AddClassOrInterface("Classes", var1, var2);
  38.    }
  39.  
  40.    InfoPaneClassItem AddInterface(String var1, String var2) throws InfoPaneException {
  41.       return this.AddClassOrInterface("Interfaces", var1, var2);
  42.    }
  43.  
  44.    InfoPaneClassItem AddClassOrInterface(String var1, String var2, String var3) throws InfoPaneException {
  45.       InfoPanePackageSubItem var4 = this.FindPackageSub(var1);
  46.       if (var4 == null) {
  47.          var4 = this.AddPackageSub(var1);
  48.       }
  49.  
  50.       return var4.AddClass(var2, var3);
  51.    }
  52.  
  53.    public boolean HasSubCategory() {
  54.       return this.vector != null && this.vector.size() > 0;
  55.    }
  56.  
  57.    public Enumeration GetEnumeration() {
  58.       if (this.vector == null) {
  59.          return null;
  60.       } else {
  61.          try {
  62.             this.vector.Sort();
  63.          } catch (InfoPaneException var2) {
  64.             System.out.println("InfoPanePackageItem.GetEnumeration: " + var2 + " -- could not sort vector in " + this.name);
  65.             ((Throwable)var2).printStackTrace();
  66.          }
  67.  
  68.          return this.vector.elements();
  69.       }
  70.    }
  71.  
  72.    public String GetName() {
  73.       return this.name;
  74.    }
  75.  
  76.    public String GetLongName() {
  77.       return "import " + this.name + ".*;";
  78.    }
  79.  
  80.    public boolean HasLongName() {
  81.       return true;
  82.    }
  83.  
  84.    public boolean CanPaste() {
  85.       return true;
  86.    }
  87.  
  88.    public void Print(String var1, boolean var2) {
  89.       if (var2 && this.HasLongName() && this.CanPaste()) {
  90.          System.out.println(var1 + this.GetLongName());
  91.       } else {
  92.          System.out.println(var1 + this.GetName());
  93.       }
  94.  
  95.       if (this.HasSubCategory()) {
  96.          Enumeration var3 = this.GetEnumeration();
  97.  
  98.          while(var3.hasMoreElements()) {
  99.             ((InfoPaneItem)var3.nextElement()).Print(var1 + "  ", var2);
  100.          }
  101.       }
  102.  
  103.    }
  104. }
  105.