home *** CD-ROM | disk | FTP | other *** search
/ Internet CD 2005 August / MICD_2005_08.iso / Multimedia / Twist / TwistEval.exe / Main / webhelp0.cab / treeview / TreeView.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-06-19  |  16.7 KB  |  1,398 lines

  1. package treeview;
  2.  
  3. import hhapplet.BsscFontFixPatch;
  4. import hhapplet.ResourceLib;
  5. import java.applet.Applet;
  6. import java.awt.Button;
  7. import java.awt.Color;
  8. import java.awt.Component;
  9. import java.awt.Container;
  10. import java.awt.Event;
  11. import java.awt.Font;
  12. import java.awt.FontMetrics;
  13. import java.awt.Graphics;
  14. import java.awt.Image;
  15. import java.awt.LayoutManager;
  16. import java.awt.Panel;
  17. import java.awt.Rectangle;
  18. import java.awt.Scrollbar;
  19.  
  20. public class TreeView extends Panel implements ImageSetSource {
  21.    protected int m_nLabelOffset;
  22.    protected ImageSet m_isImages;
  23.    protected ImageSet m_isConnectors;
  24.    protected TreeViewNode m_tvnRoot;
  25.    protected boolean m_bLayoutComplete;
  26.    protected boolean m_bUseButtons;
  27.    protected boolean m_bUseLines;
  28.    protected boolean m_bRootsConnected;
  29.    protected Applet m_applet;
  30.    protected TreeViewNode m_tvnCurrentSelection;
  31.    protected Image m_imgDoubleBuffer;
  32.    protected Rectangle m_rectDisplayArea;
  33.    protected Scrollbar m_sbHorizontal;
  34.    protected Scrollbar m_sbVertical;
  35.    protected Button m_btnScrollerCorner;
  36.    protected int m_nInsetX;
  37.    protected int m_nInsetY;
  38.    protected int m_nConnectorWidth;
  39.    protected int m_nIndent;
  40.    protected int m_nIconWidth;
  41.    protected int m_nIconHeight;
  42.    protected int m_nCellHeight;
  43.    protected int m_nFontBaseOffset;
  44.    private boolean m_bNetscapeScrollers;
  45.    private boolean m_bLayedOutByMouseOver;
  46.    private boolean m_bCompletelyFilled;
  47.    private int m_nHorizPosPixels;
  48.    private int m_nVerticalPosPixels;
  49.    private int m_nImageWidth;
  50.    private int m_nImageHeight;
  51.    public static final int LEAF = 0;
  52.    public static final int BRANCH_COLLAPSED = 1;
  53.    public static final int BRANCH_EXPANDED = 2;
  54.    public static final int LEAF_SELECTED = 3;
  55.    public static final int BRANCH_COLLAPSED_SELECTED = 4;
  56.    public static final int BRANCH_EXPANDED_SELECTED = 5;
  57.    public static final int MIN_NUMBER_IMAGES = 3;
  58.    public static final int MIN_NUMBER_IMAGES_SELECTED = 6;
  59.    protected static final int HEIGHT_HORIZONTAL_SB = 16;
  60.    protected static final int WIDTH_VERTICAL_SB = 16;
  61.    protected static final int ICON_VERTICAL_PADDING = 1;
  62.    protected long c_lnDoubleClickWindow;
  63.    private boolean m_bIsNS3Win32;
  64.    private boolean m_bIsNSWin16;
  65.    private boolean m_bIsUnix;
  66.    private long m_lnLastClickTime;
  67.    private boolean m_bIsMac;
  68.    private boolean m_bNeedTreeSize;
  69.    protected boolean m_bMaxWidthIsValid;
  70.    protected boolean m_bMaxHeightIsValid;
  71.    private int m_nMaxWidth;
  72.    private int m_nMaxHeight;
  73.    private boolean m_bUseDoubleBuffer;
  74.    private Object m_Cursor;
  75.  
  76.    public boolean mouseEnter(Event var1, int var2, int var3) {
  77.       if (var1.target != this.m_sbHorizontal && var1.target != this.m_sbVertical) {
  78.          if (!this.m_bLayoutComplete) {
  79.             this.mylayout();
  80.          }
  81.  
  82.          if (this.m_applet != null) {
  83.             TreeViewNode var4 = this.nodeAtLocation(var2, var3);
  84.             if (var4 != null && this.m_bCompletelyFilled) {
  85.                this.m_applet.showStatus(var4.getLabel());
  86.             }
  87.          }
  88.  
  89.          return false;
  90.       } else {
  91.          return super.mouseEnter(var1, var2, var3);
  92.       }
  93.    }
  94.  
  95.    public boolean gotFocus(Event var1, Object var2) {
  96.       if (this.m_tvnCurrentSelection == null) {
  97.          this.setSelectionToTop();
  98.          ((Component)this).repaint();
  99.       }
  100.  
  101.       return true;
  102.    }
  103.  
  104.    public void MoveSelectionDown() {
  105.       this.MoveSelectionDown(true);
  106.    }
  107.  
  108.    public void MoveSelectionDown(boolean var1) {
  109.       if (this.m_tvnCurrentSelection.nextNode(true) != null) {
  110.          this.m_tvnCurrentSelection.select(false);
  111.          this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.nextNode(true);
  112.          this.m_tvnCurrentSelection.select(true);
  113.          this.EnsureDisplayed(this.m_tvnCurrentSelection);
  114.          if (var1) {
  115.             this.InternalSelectionHasChanged();
  116.          }
  117.  
  118.          ((Component)this).repaint();
  119.       }
  120.    }
  121.  
  122.    public void ScrollSubTreeIntoView(TreeViewNode var1) {
  123.       if (var1 != null) {
  124.          int var2 = this.GetNodePosition(var1);
  125.          if (var2 < this.m_sbVertical.getValue()) {
  126.             this.m_sbVertical.setValue(var2);
  127.          } else {
  128.             int var3 = this.GetOpenChildSiblingCount((TreeViewNode)((SiblingChildTree)var1).getChild());
  129.             int var4 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
  130.             if (var3 > 0) {
  131.                if (var3 >= var4 - 1) {
  132.                   this.m_sbVertical.setValue(var2);
  133.                } else if (this.m_sbVertical.getValue() < var2 - (var4 - var3)) {
  134.                   this.m_sbVertical.setValue(var2 - (var4 - var3 - 1));
  135.                }
  136.             }
  137.          }
  138.  
  139.          this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
  140.       }
  141.    }
  142.  
  143.    public int getLabelOffset() {
  144.       return this.m_nLabelOffset;
  145.    }
  146.  
  147.    public void setLabelOffset(int var1) {
  148.       this.m_nLabelOffset = var1;
  149.    }
  150.  
  151.    public void CollapseTree() {
  152.       this.m_bMaxHeightIsValid = false;
  153.       this.m_bMaxWidthIsValid = false;
  154.       this.m_tvnCurrentSelection.collapseTree();
  155.       this.mylayout();
  156.       ((Component)this).repaint();
  157.    }
  158.  
  159.    protected int getMaxWidth(TreeViewNode var1, int var2, boolean var3) {
  160.       if (!this.m_bMaxWidthIsValid) {
  161.          this.m_nMaxWidth = this.getMaxSubTreeWidth(var1, var2, var3);
  162.       }
  163.  
  164.       return this.m_nMaxWidth;
  165.    }
  166.  
  167.    public void expandAll() {
  168.       this.m_bMaxHeightIsValid = false;
  169.       this.m_bMaxWidthIsValid = false;
  170.  
  171.       try {
  172.          this.m_tvnRoot.expandTree();
  173.       } catch (NullPointerException var2) {
  174.          ((Throwable)var2).printStackTrace();
  175.       }
  176.    }
  177.  
  178.    public TreeViewNode getCurrentSelection() {
  179.       return this.m_tvnCurrentSelection;
  180.    }
  181.  
  182.    public int GetNodePosition(TreeViewNode var1) {
  183.       TreeViewNode var2 = this.m_tvnRoot;
  184.  
  185.       for(int var3 = 0; var2 != null; var2 = var2.nextNode(true)) {
  186.          if (var1 == var2) {
  187.             return var3;
  188.          }
  189.  
  190.          if (var2.getLabel() != null) {
  191.             ++var3;
  192.          }
  193.       }
  194.  
  195.       return -1;
  196.    }
  197.  
  198.    public void Sync(TreeViewNode var1) {
  199.       if (var1 != null) {
  200.          try {
  201.             while(!this.m_bLayoutComplete) {
  202.                Thread.sleep(100L);
  203.             }
  204.          } catch (InterruptedException var3) {
  205.             ((Throwable)var3).printStackTrace();
  206.          }
  207.  
  208.          TreeViewNode var2 = (TreeViewNode)((SiblingChildTree)var1).getParent();
  209.  
  210.          while(var2 != null && var2.m_bCollapsed) {
  211.             if (var2.m_bCollapsed) {
  212.                var2.m_bCollapsed = false;
  213.                var2 = (TreeViewNode)((SiblingChildTree)var2).getParent();
  214.             }
  215.          }
  216.  
  217.          if (this.m_tvnCurrentSelection != null) {
  218.             this.m_tvnCurrentSelection.select(false);
  219.          }
  220.  
  221.          this.m_tvnCurrentSelection = var1;
  222.          this.m_tvnCurrentSelection.select(true);
  223.          this.mylayout();
  224.          this.EnsureDisplayed(this.m_tvnCurrentSelection);
  225.          this.InternalSelectionHasChanged();
  226.          ((Component)this).repaint();
  227.       }
  228.  
  229.    }
  230.  
  231.    public synchronized void mylayout() {
  232.       this.m_bLayoutComplete = false;
  233.       this.m_rectDisplayArea.reshape(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
  234.       if (this.m_rectDisplayArea.width >= 1 && this.m_rectDisplayArea.height >= 1) {
  235.          try {
  236.             if (this.m_bNeedTreeSize) {
  237.                this.sizeTree(this.m_tvnRoot);
  238.             }
  239.  
  240.             int var1 = this.getMaxWidth(this.m_tvnRoot, 0, true);
  241.             int var2 = this.getMaxHeight(this.m_tvnRoot, 0, true) / this.m_nCellHeight;
  242.             if (var2 >= 1) {
  243.                if (var1 + 1 > this.m_rectDisplayArea.width) {
  244.                   Rectangle var10000 = this.m_rectDisplayArea;
  245.                   var10000.height -= 16;
  246.                }
  247.  
  248.                int var3 = this.m_rectDisplayArea.height / this.m_nCellHeight;
  249.                if (var2 > var3) {
  250.                   Rectangle var6 = this.m_rectDisplayArea;
  251.                   var6.width -= 16;
  252.                }
  253.  
  254.                this.rods_reshape(this.m_sbHorizontal, 0, this.m_rectDisplayArea.height, this.m_rectDisplayArea.width, 16);
  255.                this.m_sbHorizontal.setValues(this.m_nHorizPosPixels, this.m_rectDisplayArea.width, 0, var1 - (this.m_bNetscapeScrollers ? this.m_rectDisplayArea.width : 0));
  256.                this.rods_reshape(this.m_sbVertical, this.m_rectDisplayArea.width, 0, 16, this.m_rectDisplayArea.height);
  257.                int var4 = this.m_nVerticalPosPixels / this.m_nCellHeight;
  258.                if (var4 + var3 > var2) {
  259.                   var4 = var2 - var3;
  260.                }
  261.  
  262.                if (var4 < 0) {
  263.                   var4 = 0;
  264.                }
  265.  
  266.                this.m_sbVertical.setValues(var4, var3 - 1, 0, var2 - (this.m_bNetscapeScrollers ? var3 : 1));
  267.                this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
  268.                this.rods_reshape(this.m_btnScrollerCorner, this.m_rectDisplayArea.width, this.m_rectDisplayArea.height, 16, 16);
  269.                if (this.m_rectDisplayArea.height < 0) {
  270.                   this.m_rectDisplayArea.height = 0;
  271.                }
  272.  
  273.                if (this.m_rectDisplayArea.width < 0) {
  274.                   this.m_rectDisplayArea.width = 0;
  275.                }
  276.  
  277.                if (this.m_imgDoubleBuffer != null && (this.m_nImageWidth != this.m_rectDisplayArea.width || this.m_nImageHeight != this.m_rectDisplayArea.height)) {
  278.                   this.m_imgDoubleBuffer.flush();
  279.                   this.m_imgDoubleBuffer = null;
  280.                }
  281.  
  282.                if (this.m_imgDoubleBuffer == null) {
  283.                   this.m_imgDoubleBuffer = ((Component)this).createImage(this.m_rectDisplayArea.width, this.m_rectDisplayArea.height);
  284.                   this.m_nImageWidth = this.m_rectDisplayArea.width;
  285.                   this.m_nImageHeight = this.m_rectDisplayArea.height;
  286.                }
  287.  
  288.                this.m_bLayoutComplete = true;
  289.             }
  290.          } catch (Exception var5) {
  291.             ((Throwable)var5).printStackTrace();
  292.             this.m_imgDoubleBuffer = null;
  293.          }
  294.       }
  295.    }
  296.  
  297.    protected void sizeTree(TreeViewNode var1) {
  298.       for(TreeViewNode var2 = var1; var2 != null; var2 = (TreeViewNode)((SiblingChildTree)var2).getSibling()) {
  299.          this.sizeNode(var2);
  300.          this.sizeTree((TreeViewNode)((SiblingChildTree)var2).getChild());
  301.       }
  302.  
  303.       this.m_bNeedTreeSize = false;
  304.    }
  305.  
  306.    public void setSelectionToTop() {
  307.       if (this.m_tvnCurrentSelection != null) {
  308.          this.m_tvnCurrentSelection.select(false);
  309.       }
  310.  
  311.       for(this.m_tvnCurrentSelection = this.m_tvnRoot; this.m_tvnCurrentSelection != null && this.m_tvnCurrentSelection.getLabel() == null; this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.nextNode(true)) {
  312.       }
  313.  
  314.       if (this.m_tvnCurrentSelection != null) {
  315.          this.m_tvnCurrentSelection.select(true);
  316.       }
  317.  
  318.    }
  319.  
  320.    public int getCellHeight() {
  321.       return this.m_nCellHeight;
  322.    }
  323.  
  324.    public void setCellHeight(int var1) {
  325.       if (var1 < this.m_nIconHeight + 1) {
  326.          this.m_nCellHeight = this.m_nIconHeight + 1;
  327.       } else {
  328.          this.m_nCellHeight = var1;
  329.       }
  330.    }
  331.  
  332.    public void layout() {
  333.       if (this.m_bLayoutComplete) {
  334.          this.mylayout();
  335.       }
  336.  
  337.    }
  338.  
  339.    public boolean IsDisplayed(TreeViewNode var1) {
  340.       TreeViewNode var2 = this.GetFirstDisplayedNode();
  341.  
  342.       for(int var3 = this.m_rectDisplayArea.height / this.m_nCellHeight; var2 != null && var3 > 0; var2 = var2.nextNode(true)) {
  343.          if (var2.getLabel() != null) {
  344.             --var3;
  345.          }
  346.  
  347.          if (var1 == var2) {
  348.             return true;
  349.          }
  350.       }
  351.  
  352.       return false;
  353.    }
  354.  
  355.    protected void toggleOpenCloseNode(TreeViewNode var1) {
  356.       this.m_bMaxHeightIsValid = false;
  357.       this.m_bMaxWidthIsValid = false;
  358.       var1.setCollapsedState(!var1.getCollapsedState());
  359.       if (var1.getCollapsedState()) {
  360.          this.m_tvnCurrentSelection.select(false);
  361.  
  362.          for(TreeViewNode var2 = (TreeViewNode)this.m_tvnCurrentSelection.getParent(); var2 != null; var2 = (TreeViewNode)((SiblingChildTree)var2).getParent()) {
  363.             if (var2.getCollapsedState()) {
  364.                this.m_tvnCurrentSelection = var2;
  365.             }
  366.          }
  367.  
  368.          this.m_tvnCurrentSelection.select(true);
  369.          this.InternalSelectionHasChanged();
  370.          int var5 = this.getMaxHeight(this.m_tvnRoot, 0, true) / this.m_nCellHeight - 1;
  371.          int var3 = this.m_rectDisplayArea.height / this.m_nCellHeight;
  372.          int var4 = this.m_nVerticalPosPixels / this.m_nCellHeight;
  373.          if (var4 + var3 > var5) {
  374.             var4 = Math.max(var5 - var3, 0);
  375.          }
  376.  
  377.          this.m_nVerticalPosPixels = var4 * this.m_nCellHeight;
  378.       } else {
  379.          this.mylayout();
  380.          this.ScrollSubTreeIntoView(this.m_tvnCurrentSelection);
  381.       }
  382.    }
  383.  
  384.    public TreeViewNode nextVisibleNode() {
  385.       try {
  386.          return this.m_tvnRoot.nextNode(true);
  387.       } catch (NullPointerException var2) {
  388.          ((Throwable)var2).printStackTrace();
  389.          return null;
  390.       }
  391.    }
  392.  
  393.    public TreeViewNode previousVisibleNode() {
  394.       try {
  395.          return this.m_tvnRoot.prevNode(true);
  396.       } catch (NullPointerException var1) {
  397.          return null;
  398.       }
  399.    }
  400.  
  401.    public void setTopIndex(int var1) {
  402.       int var2 = this.m_rectDisplayArea.height / this.m_nCellHeight;
  403.       int var3 = this.getMaxHeight(this.m_tvnRoot, 0, true) / this.m_nCellHeight - 1;
  404.       this.m_nVerticalPosPixels = var1 * this.m_nCellHeight;
  405.       this.m_sbVertical.setValues(var1, var2 - 1, 0, var3 - (this.m_bNetscapeScrollers ? var2 : 1));
  406.       ((Component)this).paintAll(((Component)this).getGraphics());
  407.    }
  408.  
  409.    public void MoveSelectionHome() {
  410.       this.setSelectionToTop();
  411.       this.m_sbVertical.setValue(0);
  412.       this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
  413.       ((Component)this).repaint();
  414.    }
  415.  
  416.    public void CollapseBranch() {
  417.       this.m_bMaxHeightIsValid = false;
  418.       this.m_bMaxWidthIsValid = false;
  419.       this.m_tvnCurrentSelection.setCollapsedState(true);
  420.       this.mylayout();
  421.       ((Component)this).repaint();
  422.    }
  423.  
  424.    public boolean mouseExit(Event var1, int var2, int var3) {
  425.       if (var1.target != this.m_sbHorizontal && var1.target != this.m_sbVertical) {
  426.          if (this.m_applet != null && this.m_bCompletelyFilled) {
  427.             this.m_applet.showStatus("");
  428.          }
  429.  
  430.          return false;
  431.       } else {
  432.          return super.mouseExit(var1, var2, var3);
  433.       }
  434.    }
  435.  
  436.    public void setFilled(boolean var1) {
  437.       this.m_bCompletelyFilled = var1;
  438.       this.m_bLayoutComplete = false;
  439.       this.m_bNeedTreeSize = true;
  440.       this.m_bMaxHeightIsValid = false;
  441.       this.m_bMaxWidthIsValid = false;
  442.       ((Component)this).repaint();
  443.    }
  444.  
  445.    public void setApplet(Applet var1) {
  446.       this.m_applet = var1;
  447.    }
  448.  
  449.    protected void rods_reshape(Component var1, int var2, int var3, int var4, int var5) {
  450.       var1.move(var2, var3);
  451.       var1.resize(var4, var5);
  452.    }
  453.  
  454.    public boolean getUseLines() {
  455.       return this.m_bUseLines;
  456.    }
  457.  
  458.    public TreeViewNode getRoot() {
  459.       return this.m_tvnRoot;
  460.    }
  461.  
  462.    public void setRoot(TreeViewNode var1) {
  463.       this.m_tvnRoot = var1;
  464.       this.setSelectionToTop();
  465.    }
  466.  
  467.    public void setUseLines(boolean var1) {
  468.       this.m_bUseLines = var1;
  469.    }
  470.  
  471.    protected void InternalSelectionHasChanged() {
  472.    }
  473.  
  474.    protected int drawConnector(Graphics var1, TreeViewNode var2, int var3, int var4) {
  475.       if (this.m_bUseButtons && this.m_bUseLines) {
  476.          Image var18 = null;
  477.          Object var6 = null;
  478.  
  479.          try {
  480.             if (((SiblingChildTree)var2).getChild() != null) {
  481.                if (var2.getCollapsedState()) {
  482.                   var18 = this.m_isConnectors.getImage(5);
  483.                } else {
  484.                   var18 = this.m_isConnectors.getImage(6);
  485.                }
  486.             }
  487.          } catch (IndexOutOfBoundsException var12) {
  488.             ((Throwable)var12).printStackTrace();
  489.             var18 = null;
  490.          } catch (NullPointerException var13) {
  491.             ((Throwable)var13).printStackTrace();
  492.             var18 = null;
  493.          }
  494.  
  495.          try {
  496.             if (((SiblingChildTree)var2).getParent() == null) {
  497.                if (this.m_bRootsConnected) {
  498.                   if (((SiblingChildTree)var2).getSiblingLeft() == null) {
  499.                      if (((SiblingChildTree)var2).getSibling() == null) {
  500.                         var19 = this.m_isConnectors.getImage(1);
  501.                      } else {
  502.                         var19 = this.m_isConnectors.getImage(2);
  503.                      }
  504.                   } else if (((SiblingChildTree)var2).getSibling() == null) {
  505.                      var19 = this.m_isConnectors.getImage(4);
  506.                   } else {
  507.                      var19 = this.m_isConnectors.getImage(3);
  508.                   }
  509.                } else {
  510.                   var19 = this.m_isConnectors.getImage(1);
  511.                }
  512.             } else if (((SiblingChildTree)var2).getSiblingLeft() == null && ((SiblingChildTree)var2).getParent() != null && ((TreeViewNode)((SiblingChildTree)var2).getParent()).getLabel() == null) {
  513.                var19 = this.m_isConnectors.getImage(2);
  514.             } else if (((SiblingChildTree)var2).getSibling() == null) {
  515.                var19 = this.m_isConnectors.getImage(4);
  516.             } else {
  517.                var19 = this.m_isConnectors.getImage(3);
  518.             }
  519.          } catch (IndexOutOfBoundsException var14) {
  520.             ((Throwable)var14).printStackTrace();
  521.             var19 = null;
  522.          } catch (NullPointerException var15) {
  523.             ((Throwable)var15).printStackTrace();
  524.             var19 = null;
  525.          }
  526.  
  527.          if (var19 != null) {
  528.             var1.drawImage(var19, var3, var4, this);
  529.          }
  530.  
  531.          if (var18 != null) {
  532.             var1.drawImage(var18, var3, var4, this);
  533.          }
  534.  
  535.          var3 += this.m_nConnectorWidth;
  536.       } else if (this.m_bUseButtons) {
  537.          Image var5 = null;
  538.  
  539.          try {
  540.             if (((SiblingChildTree)var2).getChild() != null) {
  541.                if (var2.getCollapsedState()) {
  542.                   var5 = this.m_isConnectors.getImage(5);
  543.                } else {
  544.                   var5 = this.m_isConnectors.getImage(6);
  545.                }
  546.             }
  547.          } catch (IndexOutOfBoundsException var10) {
  548.             ((Throwable)var10).printStackTrace();
  549.             var5 = null;
  550.          } catch (NullPointerException var11) {
  551.             ((Throwable)var11).printStackTrace();
  552.             var5 = null;
  553.          }
  554.  
  555.          if (var5 != null) {
  556.             var1.drawImage(var5, var3, var4, this);
  557.          }
  558.  
  559.          var3 += this.m_nConnectorWidth;
  560.       } else if (this.m_bUseLines) {
  561.          Object var16 = null;
  562.  
  563.          try {
  564.             if (((SiblingChildTree)var2).getParent() == null) {
  565.                if (this.m_bRootsConnected) {
  566.                   if (((SiblingChildTree)var2).getSiblingLeft() == null) {
  567.                      if (((SiblingChildTree)var2).getSibling() == null) {
  568.                         var17 = this.m_isConnectors.getImage(1);
  569.                      } else {
  570.                         var17 = this.m_isConnectors.getImage(2);
  571.                      }
  572.                   } else if (((SiblingChildTree)var2).getSibling() == null) {
  573.                      var17 = this.m_isConnectors.getImage(4);
  574.                   } else {
  575.                      var17 = this.m_isConnectors.getImage(3);
  576.                   }
  577.                } else {
  578.                   var17 = this.m_isConnectors.getImage(1);
  579.                }
  580.             } else if (((SiblingChildTree)var2).getSibling() == null) {
  581.                var17 = this.m_isConnectors.getImage(4);
  582.             } else {
  583.                var17 = this.m_isConnectors.getImage(3);
  584.             }
  585.          } catch (IndexOutOfBoundsException var8) {
  586.             ((Throwable)var8).printStackTrace();
  587.             var17 = null;
  588.          } catch (NullPointerException var9) {
  589.             ((Throwable)var9).printStackTrace();
  590.             var17 = null;
  591.          }
  592.  
  593.          if (var17 != null) {
  594.             var1.drawImage(var17, var3, var4, this);
  595.          }
  596.  
  597.          var3 += this.m_nConnectorWidth;
  598.       }
  599.  
  600.       return var3;
  601.    }
  602.  
  603.    protected void paintBorder(Graphics var1) {
  604.       Rectangle var2 = this.m_rectDisplayArea;
  605.       Color var3 = ((Component)this).getBackground();
  606.       Color var4 = var3.darker();
  607.       Color var5 = var4.darker();
  608.       Color var6 = var5.darker();
  609.       var1.setColor(var5);
  610.       var1.drawLine(0, 0, var2.width - 1, 0);
  611.       var1.drawLine(0, 0, 0, var2.height - 1);
  612.       var1.setColor(var6);
  613.       var1.drawLine(1, 1, var2.width - 2, 1);
  614.       var1.drawLine(1, 1, 1, var2.height - 2);
  615.       var1.setColor(var4);
  616.       var1.drawLine(var2.width - 2, 1, var2.width - 2, var2.height - 2);
  617.       var1.drawLine(1, var2.height - 2, var2.width - 2, var2.height - 2);
  618.       var1.setColor(var3);
  619.       var1.drawLine(var2.width - 1, 1, var2.width - 1, var2.height - 1);
  620.       var1.drawLine(0, var2.height - 1, var2.width - 1, var2.height - 1);
  621.    }
  622.  
  623.    public void collapseAll() {
  624.       this.m_bMaxHeightIsValid = false;
  625.       this.m_bMaxWidthIsValid = false;
  626.  
  627.       try {
  628.          this.m_tvnRoot.collapseTree();
  629.       } catch (NullPointerException var2) {
  630.          ((Throwable)var2).printStackTrace();
  631.       }
  632.    }
  633.  
  634.    public int getIconHeight() {
  635.       return this.m_nIconHeight;
  636.    }
  637.  
  638.    public void setIconHeight(int var1) {
  639.       if (var1 < 0) {
  640.          var1 = 0;
  641.       }
  642.  
  643.       this.m_nIconHeight = var1;
  644.       if (var1 > this.m_nCellHeight - 1) {
  645.          this.m_nCellHeight = var1 + 1;
  646.       }
  647.  
  648.    }
  649.  
  650.    public void ScrollRight() {
  651.       this.m_sbHorizontal.setValue(this.m_sbHorizontal.getValue() + 1);
  652.       this.m_nHorizPosPixels = this.m_sbHorizontal.getValue();
  653.       ((Component)this).repaint();
  654.    }
  655.  
  656.    protected int getMaxSubTreeHeight(TreeViewNode var1, int var2, boolean var3) {
  657.       int var4 = var2;
  658.  
  659.       for(TreeViewNode var5 = var1; var5 != null; var5 = (TreeViewNode)((SiblingChildTree)var5).getSibling()) {
  660.          var4 += var5.getHeight();
  661.          if (!var3 || !var5.getCollapsedState()) {
  662.             var4 = this.getMaxSubTreeHeight((TreeViewNode)((SiblingChildTree)var5).getChild(), var4, var3);
  663.          }
  664.       }
  665.  
  666.       return var4;
  667.    }
  668.  
  669.    public int getIndent() {
  670.       return this.m_nIndent;
  671.    }
  672.  
  673.    public void setIndent(int var1) {
  674.       this.m_nIndent = var1;
  675.    }
  676.  
  677.    public boolean getRootsConnected() {
  678.       return this.m_bRootsConnected;
  679.    }
  680.  
  681.    public void setRootsConnected(boolean var1) {
  682.       this.m_bRootsConnected = var1;
  683.    }
  684.  
  685.    public boolean handleEvent(Event var1) {
  686.       switch (var1.id) {
  687.          case 401:
  688.             switch (var1.key) {
  689.                case 10:
  690.                   this.m_tvnCurrentSelection.doAction();
  691.                   return super.handleEvent(var1);
  692.                case 43:
  693.                   this.ExpandBranch();
  694.                   return super.handleEvent(var1);
  695.                case 45:
  696.                   this.CollapseBranch();
  697.                   return super.handleEvent(var1);
  698.                default:
  699.                   return super.handleEvent(var1);
  700.             }
  701.          case 402:
  702.             if (System.getProperty("java.vendor").startsWith("Netscape") && System.getProperty("java.version").equalsIgnoreCase("1.1.2") && System.getProperty("os.name").startsWith("Mac")) {
  703.                this.m_tvnCurrentSelection.doAction();
  704.             }
  705.             break;
  706.          case 403:
  707.             switch (var1.key) {
  708.                case 10:
  709.                   this.m_tvnCurrentSelection.doAction();
  710.                   return super.handleEvent(var1);
  711.                case 1000:
  712.                   this.MoveSelectionHome();
  713.                   return super.handleEvent(var1);
  714.                case 1001:
  715.                   this.MoveSelectionEnd();
  716.                   return super.handleEvent(var1);
  717.                case 1002:
  718.                   this.MoveSelectionPgUp();
  719.                   return super.handleEvent(var1);
  720.                case 1003:
  721.                   this.MoveSelectionPgDn();
  722.                   return super.handleEvent(var1);
  723.                case 1004:
  724.                   this.MoveSelectionUp();
  725.                   return super.handleEvent(var1);
  726.                case 1005:
  727.                   this.MoveSelectionDown();
  728.                   return super.handleEvent(var1);
  729.                case 1006:
  730.                   if (this.m_tvnCurrentSelection.getChild() != null && !this.m_tvnCurrentSelection.getCollapsedState()) {
  731.                      if ((var1.modifiers & 1) == 1) {
  732.                         this.CollapseTree();
  733.                      } else {
  734.                         this.CollapseBranch();
  735.                      }
  736.  
  737.                      return super.handleEvent(var1);
  738.                   } else {
  739.                      if (this.m_tvnCurrentSelection.getParent() != null) {
  740.                         this.MoveSelectionToParent();
  741.                         return super.handleEvent(var1);
  742.                      }
  743.  
  744.                      return super.handleEvent(var1);
  745.                   }
  746.                case 1007:
  747.                   if (!this.m_tvnCurrentSelection.getCollapsedState()) {
  748.                      if (this.m_tvnCurrentSelection.getChild() != null) {
  749.                         this.MoveSelectionDown();
  750.                         return super.handleEvent(var1);
  751.                      }
  752.  
  753.                      return super.handleEvent(var1);
  754.                   } else {
  755.                      if ((var1.modifiers & 1) == 1) {
  756.                         this.ExpandTree();
  757.                      } else {
  758.                         this.ExpandBranch();
  759.                      }
  760.  
  761.                      return super.handleEvent(var1);
  762.                   }
  763.                default:
  764.                   return super.handleEvent(var1);
  765.             }
  766.          case 501:
  767.             if (var1.target != this.m_sbHorizontal && var1.target != this.m_sbVertical && this.m_rectDisplayArea.inside(var1.x, var1.y)) {
  768.                int var2 = var1.x + this.m_nHorizPosPixels;
  769.                byte var3 = 11;
  770.                TreeViewNode var4 = this.nodeAtLocation(var1.x, var1.y);
  771.                if (var4 != null) {
  772.                   boolean var5 = !this.m_bIsMac && var1.clickCount % 2 == 0;
  773.                   if (this.m_bIsUnix || this.m_bIsMac || this.m_bIsNSWin16) {
  774.                      long var6 = System.currentTimeMillis();
  775.                      if (this.m_lnLastClickTime > var6 - this.c_lnDoubleClickWindow) {
  776.                         var5 = true;
  777.                         this.m_lnLastClickTime = 0L;
  778.                      } else {
  779.                         this.m_lnLastClickTime = var6;
  780.                      }
  781.                   }
  782.  
  783.                   if (this.m_bIsMac && !var5) {
  784.                      var1.clickCount = 1;
  785.                   }
  786.  
  787.                   if (((SiblingChildTree)var4).getChild() != null && var2 > var4.getBounds().x && (var2 < var4.getBounds().x + var3 || var5)) {
  788.                      ((Component)this).requestFocus();
  789.                      if (this.m_tvnCurrentSelection != null) {
  790.                         this.m_tvnCurrentSelection.select(false);
  791.                      }
  792.  
  793.                      this.m_tvnCurrentSelection = var4;
  794.                      this.m_tvnCurrentSelection.select(true);
  795.                      this.InternalSelectionHasChanged();
  796.                      var4.doAction();
  797.                      this.toggleOpenCloseNode(var4);
  798.                      this.mylayout();
  799.                      ((Component)this).requestFocus();
  800.                      ((Component)this).repaint();
  801.                   } else if (var2 > var4.getBounds().x + var3 && var1.clickCount < 2) {
  802.                      if (this.m_tvnCurrentSelection != null) {
  803.                         this.m_tvnCurrentSelection.select(false);
  804.                      }
  805.  
  806.                      this.m_tvnCurrentSelection = var4;
  807.                      this.m_tvnCurrentSelection.select(true);
  808.                      this.InternalSelectionHasChanged();
  809.                      var4.doAction();
  810.                      ((Component)this).repaint();
  811.                   }
  812.  
  813.                   if (var5) {
  814.                      var4.doDblClick();
  815.                   }
  816.                }
  817.             }
  818.             break;
  819.          case 601:
  820.          case 602:
  821.          case 603:
  822.          case 604:
  823.          case 605:
  824.             if (var1.target == this.m_sbHorizontal) {
  825.                this.m_nHorizPosPixels = this.m_sbHorizontal.getValue();
  826.             } else if (var1.target == this.m_sbVertical) {
  827.                this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
  828.             }
  829.  
  830.             ((Component)this).repaint();
  831.       }
  832.  
  833.       return super.handleEvent(var1);
  834.    }
  835.  
  836.    public void MoveSelectionToParent() {
  837.       if (this.m_tvnCurrentSelection.getParent() != null) {
  838.          if (this.m_tvnCurrentSelection.getParent() != this.m_tvnRoot) {
  839.             this.m_tvnCurrentSelection.select(false);
  840.             this.m_tvnCurrentSelection = (TreeViewNode)this.m_tvnCurrentSelection.getParent();
  841.             this.m_tvnCurrentSelection.select(true);
  842.             this.EnsureDisplayed(this.m_tvnCurrentSelection);
  843.             this.InternalSelectionHasChanged();
  844.             ((Component)this).repaint();
  845.          }
  846.       }
  847.    }
  848.  
  849.    public void ExpandTree() {
  850.       this.m_bMaxHeightIsValid = false;
  851.       this.m_bMaxWidthIsValid = false;
  852.       this.m_tvnCurrentSelection.expandTree();
  853.       this.mylayout();
  854.       ((Component)this).repaint();
  855.    }
  856.  
  857.    protected int paintTree(Graphics var1, TreeViewNode var2, int var3, int var4, Rectangle var5) {
  858.       TreeViewNode var6 = var2;
  859.  
  860.       while(var6 != null) {
  861.          int var7 = var3;
  862.          int var8 = var4;
  863.          if (var6.getLabel() != null) {
  864.             if (var5.inside(var3, var4) || var5.inside(var3, var4 + this.m_nCellHeight)) {
  865.                this.paintNode(var1, var6, var3, var4);
  866.             }
  867.  
  868.             var7 = var3 + this.m_nIndent;
  869.             var8 = var4 + this.m_nCellHeight;
  870.          }
  871.  
  872.          if (!var6.getCollapsedState()) {
  873.             var4 = this.paintTree(var1, (TreeViewNode)((SiblingChildTree)var6).getChild(), var7, var8, var5);
  874.          } else {
  875.             var4 = var8;
  876.          }
  877.  
  878.          var6 = (TreeViewNode)((SiblingChildTree)var6).getSibling();
  879.          if (var8 > var5.y + var5.height) {
  880.             var6 = null;
  881.          }
  882.       }
  883.  
  884.       return var4;
  885.    }
  886.  
  887.    protected TreeViewNode nodeAtLocation(int var1, int var2) {
  888.       if (!this.m_rectDisplayArea.inside(var1, var2)) {
  889.          return null;
  890.       } else {
  891.          int var3 = var2 + this.m_nVerticalPosPixels;
  892.  
  893.          for(TreeViewNode var4 = this.m_tvnRoot; var4 != null; var4 = var4.nextNode(true)) {
  894.             Rectangle var5 = var4.getBounds();
  895.             if (var3 > var5.y && var3 <= var5.y + var5.height && var4.getLabel() != null) {
  896.                return var4;
  897.             }
  898.          }
  899.  
  900.          return null;
  901.       }
  902.    }
  903.  
  904.    public void ScrollLeft() {
  905.       this.m_sbHorizontal.setValue(this.m_sbHorizontal.getValue() - 1);
  906.       this.m_nHorizPosPixels = this.m_sbHorizontal.getValue();
  907.       ((Component)this).repaint();
  908.    }
  909.  
  910.    public boolean mouseMove(Event var1, int var2, int var3) {
  911.       if (var1.target != this.m_sbHorizontal && var1.target != this.m_sbVertical) {
  912.          if (!this.m_bLayoutComplete) {
  913.             this.mylayout();
  914.          }
  915.  
  916.          if (this.m_applet != null) {
  917.             TreeViewNode var4 = this.nodeAtLocation(var2, var3);
  918.             if (var4 != null) {
  919.                if (this.m_bCompletelyFilled) {
  920.                   this.m_applet.showStatus(var4.getLabel());
  921.                }
  922.             } else if (this.m_bCompletelyFilled) {
  923.                this.m_applet.showStatus("");
  924.             }
  925.          }
  926.  
  927.          return false;
  928.       } else {
  929.          return super.mouseMove(var1, var2, var3);
  930.       }
  931.    }
  932.  
  933.    protected void sizeNode(TreeViewNode var1) {
  934.       if (var1 != null) {
  935.          FontMetrics var2 = ((Component)this).getFontMetrics(((Component)this).getFont());
  936.          int var3 = 0;
  937.          if (this.m_bUseButtons || this.m_bUseLines) {
  938.             var3 = this.m_nIconWidth;
  939.          }
  940.  
  941.          if (var1.getCurrentImage() != null) {
  942.             var3 += this.m_nIconWidth + this.m_nLabelOffset;
  943.          }
  944.  
  945.          if (var1.getLabel() != null) {
  946.             var3 += var2.stringWidth(var1.getLabel() + ' ');
  947.          } else if (var1.getCurrentImage() != null) {
  948.             var3 -= this.m_nLabelOffset;
  949.          }
  950.  
  951.          var1.setBounds(0, 0, var3, this.m_nCellHeight);
  952.       }
  953.    }
  954.  
  955.    public TreeViewNode nextNode(boolean var1) {
  956.       try {
  957.          return (TreeViewNode)this.m_tvnRoot.prevNode();
  958.       } catch (NullPointerException var2) {
  959.          return null;
  960.       }
  961.    }
  962.  
  963.    public TreeViewNode previousNode(boolean var1) {
  964.       try {
  965.          return (TreeViewNode)this.m_tvnRoot.prevNode();
  966.       } catch (NullPointerException var2) {
  967.          return null;
  968.       }
  969.    }
  970.  
  971.    public void ExpandBranch() {
  972.       this.m_bMaxHeightIsValid = false;
  973.       this.m_bMaxWidthIsValid = false;
  974.       this.m_tvnCurrentSelection.setCollapsedState(false);
  975.       this.mylayout();
  976.       this.ScrollSubTreeIntoView(this.m_tvnCurrentSelection);
  977.       ((Component)this).repaint();
  978.    }
  979.  
  980.    public void update(Graphics var1) {
  981.       if (!this.m_bLayoutComplete) {
  982.          this.mylayout();
  983.       }
  984.  
  985.       this.paint(var1);
  986.    }
  987.  
  988.    public void ResetCursor() {
  989.    }
  990.  
  991.    public int getXInset() {
  992.       return this.m_nInsetX;
  993.    }
  994.  
  995.    public void setXInset(int var1) {
  996.       if (var1 < 0) {
  997.          var1 = 0;
  998.       }
  999.  
  1000.    }
  1001.  
  1002.    public void MoveSelectionUp() {
  1003.       this.MoveSelectionUp(true);
  1004.    }
  1005.  
  1006.    public ImageSet getConnectors() {
  1007.       return this.m_isConnectors;
  1008.    }
  1009.  
  1010.    public void setConnectors(ImageSet var1) {
  1011.       this.m_isConnectors = var1;
  1012.    }
  1013.  
  1014.    public int getIconWidth() {
  1015.       return this.m_nIconWidth;
  1016.    }
  1017.  
  1018.    public void setIconWidth(int var1) {
  1019.       if (var1 < 0) {
  1020.          var1 = 0;
  1021.       }
  1022.  
  1023.       this.m_nIconWidth = var1;
  1024.    }
  1025.  
  1026.    public void MoveSelectionUp(boolean var1) {
  1027.       if (this.m_tvnCurrentSelection.prevNode(true) != null) {
  1028.          if (this.m_tvnCurrentSelection.prevNode(true) != this.m_tvnRoot) {
  1029.             this.m_tvnCurrentSelection.select(false);
  1030.             this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.prevNode(true);
  1031.             this.m_tvnCurrentSelection.select(true);
  1032.             this.EnsureDisplayed(this.m_tvnCurrentSelection);
  1033.             if (var1) {
  1034.                this.InternalSelectionHasChanged();
  1035.             }
  1036.  
  1037.             ((Component)this).repaint();
  1038.          }
  1039.       }
  1040.    }
  1041.  
  1042.    protected int getMaxSubTreeWidth(TreeViewNode var1, int var2, boolean var3) {
  1043.       int var4 = 0;
  1044.  
  1045.       for(TreeViewNode var5 = var1; var5 != null; var5 = (TreeViewNode)((SiblingChildTree)var5).getSibling()) {
  1046.          if (var5.getWidth() + var2 > var4) {
  1047.             var4 = var5.getWidth() + var2;
  1048.          }
  1049.  
  1050.          if (!var3 || !var5.getCollapsedState()) {
  1051.             int var6 = this.getMaxSubTreeWidth((TreeViewNode)((SiblingChildTree)var5).getChild(), var2 + this.m_nIndent, var3);
  1052.             if (var6 > var4) {
  1053.                var4 = var6;
  1054.             }
  1055.          }
  1056.       }
  1057.  
  1058.       return var4;
  1059.    }
  1060.  
  1061.    public boolean isFocusTraversable() {
  1062.       return true;
  1063.    }
  1064.  
  1065.    protected int getMaxHeight(TreeViewNode var1, int var2, boolean var3) {
  1066.       if (!this.m_bMaxHeightIsValid) {
  1067.          this.m_nMaxHeight = this.getMaxSubTreeHeight(var1, var2, var3);
  1068.       }
  1069.  
  1070.       return this.m_nMaxHeight;
  1071.    }
  1072.  
  1073.    public int getYInset() {
  1074.       return this.m_nInsetY;
  1075.    }
  1076.  
  1077.    public void setYInset(int var1) {
  1078.       if (var1 < 0) {
  1079.          var1 = 0;
  1080.       }
  1081.  
  1082.    }
  1083.  
  1084.    public void MoveSelectionPgDn() {
  1085.       int var1 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
  1086.  
  1087.       for(int var2 = 0; var2 < var1; ++var2) {
  1088.          this.MoveSelectionDown(false);
  1089.       }
  1090.  
  1091.       this.InternalSelectionHasChanged();
  1092.       ((Component)this).repaint();
  1093.    }
  1094.  
  1095.    public TreeView() {
  1096.       this((ImageSet)null, (TreeViewNode)null);
  1097.    }
  1098.  
  1099.    public TreeView(ImageSet var1) {
  1100.       this(var1, (TreeViewNode)null);
  1101.    }
  1102.  
  1103.    public TreeView(TreeViewNode var1) {
  1104.       this((ImageSet)null, var1);
  1105.    }
  1106.  
  1107.    public TreeView(ImageSet var1, TreeViewNode var2) {
  1108.       this.m_nLabelOffset = 6;
  1109.       this.m_bLayoutComplete = false;
  1110.       this.m_bUseButtons = true;
  1111.       this.m_bUseLines = false;
  1112.       this.m_bRootsConnected = true;
  1113.       this.m_applet = null;
  1114.       this.m_sbHorizontal = new Scrollbar(0);
  1115.       this.m_sbVertical = new Scrollbar(1);
  1116.       this.m_btnScrollerCorner = new Button();
  1117.       this.m_nInsetX = 5;
  1118.       this.m_nInsetY = 1;
  1119.       this.m_nConnectorWidth = 16;
  1120.       this.m_nIndent = 7 + this.m_nConnectorWidth;
  1121.       this.m_nIconWidth = 16;
  1122.       this.m_nIconHeight = 16;
  1123.       this.m_nCellHeight = this.m_nIconHeight + 1;
  1124.       this.m_nFontBaseOffset = this.m_nIconHeight;
  1125.       this.m_bNetscapeScrollers = false;
  1126.       this.m_bLayedOutByMouseOver = false;
  1127.       this.m_bCompletelyFilled = false;
  1128.       this.m_nHorizPosPixels = 0;
  1129.       this.m_nVerticalPosPixels = 0;
  1130.       this.m_nImageWidth = 0;
  1131.       this.m_nImageHeight = 0;
  1132.       this.c_lnDoubleClickWindow = 500L;
  1133.       this.m_bIsNS3Win32 = false;
  1134.       this.m_bIsNSWin16 = false;
  1135.       this.m_bIsUnix = false;
  1136.       this.m_lnLastClickTime = 0L;
  1137.       this.m_bIsMac = false;
  1138.       this.m_bNeedTreeSize = true;
  1139.       this.m_bMaxWidthIsValid = false;
  1140.       this.m_bMaxHeightIsValid = false;
  1141.       this.m_nMaxWidth = 0;
  1142.       this.m_nMaxHeight = 0;
  1143.       this.m_bUseDoubleBuffer = true;
  1144.       this.m_Cursor = null;
  1145.  
  1146.       try {
  1147.          if (System.getProperty("java.vendor").startsWith("Netscape")) {
  1148.             if (System.getProperty("java.version").startsWith("1.0") && System.getProperty("os.name").startsWith("Windows") && System.getProperty("os.version").startsWith("4")) {
  1149.                this.m_bIsNS3Win32 = true;
  1150.             } else if (System.getProperty("os.name").startsWith("16-bit Windows")) {
  1151.                this.c_lnDoubleClickWindow = 1500L;
  1152.                this.m_bIsNSWin16 = true;
  1153.             }
  1154.          }
  1155.       } finally {
  1156.          ;
  1157.       }
  1158.  
  1159.       this.m_tvnRoot = var2;
  1160.       this.m_isImages = var1;
  1161.       this.m_isConnectors = new TreeViewConnectorImageSet();
  1162.       this.m_imgDoubleBuffer = null;
  1163.       this.m_rectDisplayArea = new Rectangle();
  1164.       ((Container)this).setLayout((LayoutManager)null);
  1165.  
  1166.       try {
  1167.          String var3 = System.getProperty("os.name");
  1168.          if (!var3.startsWith("Windows")) {
  1169.             this.m_bIsMac = var3.startsWith("Mac");
  1170.             this.m_bIsUnix = !this.m_bIsMac;
  1171.          }
  1172.       } finally {
  1173.          ;
  1174.       }
  1175.  
  1176.       int var15 = BsscFontFixPatch.GetFontSize();
  1177.       ((Component)this).setFont(new Font(BsscFontFixPatch.GetFontName(), 0, var15));
  1178.       FontMetrics var4 = ((Component)this).getFontMetrics(((Component)this).getFont());
  1179.       int var5 = var4.getLeading() + var4.getAscent() + var4.getDescent();
  1180.       this.setCellHeight(var5);
  1181.       if (var5 < this.m_nCellHeight) {
  1182.          this.m_nFontBaseOffset = (this.m_nCellHeight + var5) / 2 - var4.getDescent();
  1183.       } else {
  1184.          this.m_nFontBaseOffset = this.m_nCellHeight - var4.getDescent();
  1185.       }
  1186.  
  1187.       this.setSelectionToTop();
  1188.       Scrollbar var6 = new Scrollbar();
  1189.       var6.setValues(0, 3, 0, 10);
  1190.       var6.setValue(10);
  1191.       this.m_bNetscapeScrollers = var6.getValue() == 10;
  1192.       this.m_sbHorizontal.setLineIncrement(16);
  1193.       if (this.m_sbHorizontal.getPageIncrement() < 128) {
  1194.          this.m_sbHorizontal.setPageIncrement(128);
  1195.       }
  1196.  
  1197.       this.m_sbHorizontal.setBackground(new Color(192, 192, 192));
  1198.       ((Container)this).add(this.m_sbHorizontal);
  1199.       this.m_sbVertical.setBackground(new Color(192, 192, 192));
  1200.       ((Container)this).add(this.m_sbVertical);
  1201.       this.m_btnScrollerCorner.enable(false);
  1202.       ((Container)this).add(this.m_btnScrollerCorner);
  1203.    }
  1204.  
  1205.    public void EnsureDisplayed(TreeViewNode var1) {
  1206.       int var2 = this.m_rectDisplayArea.height / this.m_nCellHeight;
  1207.       if (!this.IsDisplayed(var1)) {
  1208.          int var3 = this.GetNodePosition(var1);
  1209.          if (var3 < this.m_sbVertical.getValue()) {
  1210.             this.m_sbVertical.setValue(var3);
  1211.          } else {
  1212.             this.m_sbVertical.setValue(var3 - var2 + 1);
  1213.          }
  1214.  
  1215.          if (this.m_bIsMac) {
  1216.             try {
  1217.                Thread.sleep(10L);
  1218.             } catch (InterruptedException var4) {
  1219.             }
  1220.          }
  1221.  
  1222.          this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
  1223.       }
  1224.    }
  1225.  
  1226.    public int GetOpenChildSiblingCount(TreeViewNode var1) {
  1227.       int var2 = 0;
  1228.       if (var1 == null) {
  1229.          return 0;
  1230.       } else {
  1231.          if (var1.getLabel() != null) {
  1232.             ++var2;
  1233.          }
  1234.  
  1235.          if (!var1.getCollapsedState()) {
  1236.             TreeViewNode var3 = (TreeViewNode)((SiblingChildTree)var1).getChild();
  1237.             if (var3 != null) {
  1238.                var2 += this.GetOpenChildSiblingCount(var3);
  1239.             }
  1240.          }
  1241.  
  1242.          TreeViewNode var4 = (TreeViewNode)((SiblingChildTree)var1).getSibling();
  1243.          if (var4 != null) {
  1244.             var2 += this.GetOpenChildSiblingCount(var4);
  1245.          }
  1246.  
  1247.          return var2;
  1248.       }
  1249.    }
  1250.  
  1251.    public void paint(Graphics var1) {
  1252.       try {
  1253.          if (!this.m_bLayoutComplete) {
  1254.             String var2 = ResourceLib.GetRes("LoadingContents");
  1255.             var1.drawChars(var2.toCharArray(), 0, var2.length(), 0, 10);
  1256.             this.mylayout();
  1257.          }
  1258.  
  1259.          if (this.m_bUseDoubleBuffer && this.m_imgDoubleBuffer == null) {
  1260.             return;
  1261.          }
  1262.  
  1263.          if (this.m_bIsNS3Win32) {
  1264.             var1.dispose();
  1265.          }
  1266.  
  1267.          Object var6 = null;
  1268.          Graphics var7;
  1269.          if (this.m_bUseDoubleBuffer) {
  1270.             var7 = this.m_imgDoubleBuffer.getGraphics();
  1271.          } else {
  1272.             var7 = ((Component)this).getGraphics();
  1273.          }
  1274.  
  1275.          var7.setFont(((Component)this).getFont());
  1276.          var7.setColor(((Component)this).getBackground());
  1277.          var7.fillRect(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
  1278.          var7.setColor(((Component)this).getForeground());
  1279.          var7.translate(-this.m_nHorizPosPixels, -this.m_nVerticalPosPixels);
  1280.  
  1281.          try {
  1282.             Rectangle var3 = new Rectangle(this.m_rectDisplayArea.x, this.m_rectDisplayArea.y, this.m_rectDisplayArea.width, this.m_rectDisplayArea.height);
  1283.             var3.y += this.m_nVerticalPosPixels;
  1284.             this.paintTree(var7, this.m_tvnRoot, this.m_nInsetX, this.m_nInsetY, var3);
  1285.          } catch (NullPointerException var4) {
  1286.             ((Throwable)var4).printStackTrace();
  1287.          }
  1288.  
  1289.          if (this.m_bUseDoubleBuffer) {
  1290.             var7.dispose();
  1291.             var7 = this.m_imgDoubleBuffer.getGraphics();
  1292.          } else {
  1293.             var7.translate(this.m_nHorizPosPixels, this.m_nVerticalPosPixels);
  1294.          }
  1295.  
  1296.          this.paintBorder(var7);
  1297.          if (this.m_bUseDoubleBuffer) {
  1298.             if (this.m_bIsNS3Win32) {
  1299.                var7.dispose();
  1300.                var1 = ((Component)this).getGraphics();
  1301.             }
  1302.  
  1303.             var1.drawImage(this.m_imgDoubleBuffer, 0, 0, this);
  1304.             return;
  1305.          }
  1306.       } catch (Exception var5) {
  1307.          ((Throwable)var5).printStackTrace();
  1308.       }
  1309.  
  1310.    }
  1311.  
  1312.    protected void paintNode(Graphics var1, TreeViewNode var2, int var3, int var4) {
  1313.       var2.moveBounds(var3, var4);
  1314.       var3 = this.drawConnector(var1, var2, var3, var4);
  1315.       if (var2.getCurrentImage() != null) {
  1316.          var1.drawImage(var2.getCurrentImage(), var3, var4 + 1, this.m_nIconWidth, this.m_nIconHeight, this);
  1317.          var3 += this.m_nIconWidth + this.m_nLabelOffset;
  1318.       }
  1319.  
  1320.       if (var2.getLabel() != null) {
  1321.          this.drawText(var1, var2, var3, var4);
  1322.       }
  1323.  
  1324.    }
  1325.  
  1326.    public void MoveSelectionEnd() {
  1327.       this.m_tvnCurrentSelection.select(false);
  1328.  
  1329.       while(this.m_tvnCurrentSelection.nextNode(true) != null) {
  1330.          this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.nextNode(true);
  1331.       }
  1332.  
  1333.       this.m_tvnCurrentSelection.select(true);
  1334.       this.m_sbVertical.setValue(this.m_sbVertical.getMaximum());
  1335.       this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
  1336.       this.InternalSelectionHasChanged();
  1337.       ((Component)this).repaint();
  1338.    }
  1339.  
  1340.    public void MoveSelectionPgUp() {
  1341.       int var1 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
  1342.  
  1343.       for(int var2 = 0; var2 < var1; ++var2) {
  1344.          this.MoveSelectionUp(false);
  1345.       }
  1346.  
  1347.       this.InternalSelectionHasChanged();
  1348.       ((Component)this).repaint();
  1349.    }
  1350.  
  1351.    TreeViewNode GetFirstDisplayedNode() {
  1352.       TreeViewNode var1 = this.m_tvnRoot;
  1353.  
  1354.       for(int var2 = this.m_sbVertical.getValue(); var1 != null && var2 > 0; var1 = var1.nextNode(true)) {
  1355.          if (var1.getLabel() != null) {
  1356.             --var2;
  1357.          }
  1358.       }
  1359.  
  1360.       return var1;
  1361.    }
  1362.  
  1363.    public void SetWaitCursor() {
  1364.    }
  1365.  
  1366.    public boolean getUseButtons() {
  1367.       return this.m_bUseButtons;
  1368.    }
  1369.  
  1370.    public void setUseButtons(boolean var1) {
  1371.       this.m_bUseButtons = var1;
  1372.    }
  1373.  
  1374.    public ImageSet getImages() {
  1375.       return this.m_isImages;
  1376.    }
  1377.  
  1378.    public void setImages(ImageSet var1) {
  1379.       this.m_isImages = var1;
  1380.    }
  1381.  
  1382.    protected void drawText(Graphics var1, TreeViewNode var2, int var3, int var4) {
  1383.       var4 += this.m_nFontBaseOffset;
  1384.       if (var2.isSelected()) {
  1385.          var1.setColor(new Color(0, 0, 128));
  1386.          Rectangle var5 = var2.getBounds();
  1387.          int var6 = var5.width + var5.x - var3;
  1388.          var1.fillRect(var3, var5.y, var6, var5.height);
  1389.          var1.setColor(Color.white);
  1390.       } else {
  1391.          var1.setColor(((Component)this).getForeground());
  1392.       }
  1393.  
  1394.       var1.setFont(((Component)this).getFont());
  1395.       var1.drawString(var2.getLabel(), var3, var4);
  1396.    }
  1397. }
  1398.