home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 29 / CDT29.iso / e-Mail / WorldClient Pro 2.2.3 / wcsetup.exe / WEBHELP.ZIP / treeview / TreeView.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-10-21  |  15.7 KB  |  1,313 lines

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