home *** CD-ROM | disk | FTP | other *** search
- package treeview;
-
- import bssccom.BsscScrollbar;
- import hhapplet.BsscFontFixPatch;
- import hhapplet.ResourceLib;
- import java.applet.Applet;
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Cursor;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.LayoutManager;
- import java.awt.Panel;
- import java.awt.Rectangle;
- import java.awt.Scrollbar;
-
- public class TreeView extends Panel implements ImageSetSource {
- protected int m_nLabelOffset;
- protected ImageSet m_isImages;
- protected ImageSet m_isConnectors;
- protected TreeViewNode m_tvnRoot;
- protected boolean m_bLayoutComplete;
- protected boolean m_bUseButtons;
- protected boolean m_bUseLines;
- protected boolean m_bRootsConnected;
- protected Applet m_applet;
- protected TreeViewNode m_tvnCurrentSelection;
- protected Image m_imgDoubleBuffer;
- protected Rectangle m_rectDisplayArea;
- protected Scrollbar m_sbHorizontal;
- protected Scrollbar m_sbVertical;
- protected BsscScrollbar m_sbBsscHorizontal;
- protected BsscScrollbar m_sbBsscVertical;
- protected boolean m_bIsClumsyNS4;
- protected Button m_btnScrollerCorner;
- protected int m_nInsetX;
- protected int m_nInsetY;
- protected int m_nConnectorWidth;
- protected int m_nIndent;
- protected int m_nIconWidth;
- protected int m_nIconHeight;
- protected int m_nCellHeight;
- protected int m_nFontBaseOffset;
- private boolean m_bNetscapeScrollers;
- private boolean m_bLayedOutByMouseOver;
- private boolean m_bCompletelyFilled;
- private int m_nHorizPosPixels;
- private int m_nVerticalPosPixels;
- private int m_nImageWidth;
- private int m_nImageHeight;
- public static final int LEAF = 0;
- public static final int BRANCH_COLLAPSED = 1;
- public static final int BRANCH_EXPANDED = 2;
- public static final int LEAF_SELECTED = 3;
- public static final int BRANCH_COLLAPSED_SELECTED = 4;
- public static final int BRANCH_EXPANDED_SELECTED = 5;
- public static final int MIN_NUMBER_IMAGES = 3;
- public static final int MIN_NUMBER_IMAGES_SELECTED = 6;
- protected static final int HEIGHT_HORIZONTAL_SB = 16;
- protected static final int WIDTH_VERTICAL_SB = 16;
- protected static final int ICON_VERTICAL_PADDING = 1;
- protected long c_lnDoubleClickWindow;
- private boolean m_bIsNS3Win32;
- private boolean m_bIsNSWin16;
- private boolean m_bIsUnix;
- private long m_lnLastClickTime;
- private boolean m_bIsMac;
- private boolean m_bNeedTreeSize;
- protected boolean m_bMaxWidthIsValid;
- protected boolean m_bMaxHeightIsValid;
- private int m_nMaxWidth;
- private int m_nMaxHeight;
- private boolean m_bUseDoubleBuffer;
- private Object m_Cursor;
-
- public boolean mouseEnter(Event var1, int var2, int var3) {
- if (this.m_bIsClumsyNS4) {
- if (var1.target == this.m_sbBsscHorizontal || var1.target == this.m_sbBsscVertical) {
- return super.mouseEnter(var1, var2, var3);
- }
- } else if (var1.target == this.m_sbHorizontal || var1.target == this.m_sbVertical) {
- return super.mouseEnter(var1, var2, var3);
- }
-
- if (!this.m_bLayoutComplete) {
- this.mylayout();
- }
-
- if (this.m_applet != null) {
- TreeViewNode var4 = this.nodeAtLocation(var2, var3);
- if (var4 != null && this.m_bCompletelyFilled) {
- this.m_applet.showStatus(var4.getLabel());
- }
- }
-
- return false;
- }
-
- public boolean gotFocus(Event var1, Object var2) {
- if (this.m_tvnCurrentSelection == null) {
- this.setSelectionToTop();
- ((Component)this).repaint();
- }
-
- return true;
- }
-
- public void MoveSelectionDown() {
- this.MoveSelectionDown(true);
- }
-
- public void MoveSelectionDown(boolean var1) {
- if (this.m_tvnCurrentSelection.nextNode(true) != null) {
- this.m_tvnCurrentSelection.select(false);
- this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.nextNode(true);
- this.m_tvnCurrentSelection.select(true);
- this.EnsureDisplayed(this.m_tvnCurrentSelection);
- if (var1) {
- this.InternalSelectionHasChanged();
- }
-
- ((Component)this).repaint();
- }
- }
-
- public void ScrollSubTreeIntoView(TreeViewNode var1) {
- if (var1 != null) {
- int var2 = this.GetNodePosition(var1);
- if (this.m_bIsClumsyNS4) {
- if (var2 < this.m_sbBsscVertical.getValue()) {
- this.m_sbBsscVertical.setValue(var2);
- } else {
- int var5 = this.GetOpenChildSiblingCount((TreeViewNode)((SiblingChildTree)var1).getChild());
- int var6 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
- if (var5 > 0) {
- if (var5 >= var6 - 1) {
- this.m_sbBsscVertical.setValue(var2);
- } else if (this.m_sbBsscVertical.getValue() < var2 - (var6 - var5)) {
- this.m_sbBsscVertical.setValue(var2 - (var6 - var5 - 1));
- }
- }
- }
-
- this.m_nVerticalPosPixels = this.m_sbBsscVertical.getValue() * this.m_nCellHeight;
- } else {
- if (var2 < this.m_sbVertical.getValue()) {
- this.m_sbVertical.setValue(var2);
- } else {
- int var3 = this.GetOpenChildSiblingCount((TreeViewNode)((SiblingChildTree)var1).getChild());
- int var4 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
- if (var3 > 0) {
- if (var3 >= var4 - 1) {
- this.m_sbVertical.setValue(var2);
- } else if (this.m_sbVertical.getValue() < var2 - (var4 - var3)) {
- this.m_sbVertical.setValue(var2 - (var4 - var3 - 1));
- }
- }
- }
-
- this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
- }
- }
- }
-
- public int getLabelOffset() {
- return this.m_nLabelOffset;
- }
-
- public void setLabelOffset(int var1) {
- this.m_nLabelOffset = var1;
- }
-
- public void CollapseTree() {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
- this.m_tvnCurrentSelection.collapseTree();
- this.mylayout();
- ((Component)this).repaint();
- }
-
- protected int getMaxWidth(TreeViewNode var1, int var2, boolean var3) {
- if (!this.m_bMaxWidthIsValid) {
- this.m_nMaxWidth = this.getMaxSubTreeWidth(var1, var2, var3);
- }
-
- return this.m_nMaxWidth;
- }
-
- public void expandAll() {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
-
- try {
- this.m_tvnRoot.expandTree();
- } catch (NullPointerException var2) {
- ((Throwable)var2).printStackTrace();
- }
- }
-
- public TreeViewNode getCurrentSelection() {
- return this.m_tvnCurrentSelection;
- }
-
- public int GetNodePosition(TreeViewNode var1) {
- TreeViewNode var2 = this.m_tvnRoot;
-
- for(int var3 = 0; var2 != null; var2 = var2.nextNode(true)) {
- if (var1 == var2) {
- return var3;
- }
-
- if (var2.getLabel() != null) {
- ++var3;
- }
- }
-
- return -1;
- }
-
- public void Sync(TreeViewNode var1) {
- if (var1 != null) {
- try {
- while(!this.m_bLayoutComplete) {
- Thread.sleep(100L);
- }
- } catch (InterruptedException var3) {
- ((Throwable)var3).printStackTrace();
- }
-
- TreeViewNode var2 = (TreeViewNode)((SiblingChildTree)var1).getParent();
-
- while(var2 != null && var2.m_bCollapsed) {
- if (var2.m_bCollapsed) {
- var2.m_bCollapsed = false;
- var2 = (TreeViewNode)((SiblingChildTree)var2).getParent();
- }
- }
-
- if (this.m_tvnCurrentSelection != null) {
- this.m_tvnCurrentSelection.select(false);
- }
-
- this.m_tvnCurrentSelection = var1;
- this.m_tvnCurrentSelection.select(true);
- this.mylayout();
- this.EnsureDisplayed(this.m_tvnCurrentSelection);
- this.InternalSelectionHasChanged();
- ((Component)this).repaint();
- }
-
- }
-
- public synchronized void mylayout() {
- this.m_bLayoutComplete = false;
- this.m_rectDisplayArea.reshape(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
- if (this.m_rectDisplayArea.width >= 1 && this.m_rectDisplayArea.height >= 1) {
- try {
- if (this.m_bNeedTreeSize) {
- this.sizeTree(this.m_tvnRoot);
- }
-
- int var1 = this.getMaxWidth(this.m_tvnRoot, 0, true);
- int var2 = this.getMaxHeight(this.m_tvnRoot, 0, true) / this.m_nCellHeight;
- if (var2 >= 1) {
- if (var1 + 1 > this.m_rectDisplayArea.width) {
- Rectangle var10000 = this.m_rectDisplayArea;
- var10000.height -= 16;
- }
-
- int var3 = this.m_rectDisplayArea.height / this.m_nCellHeight;
- if (var2 > var3) {
- Rectangle var6 = this.m_rectDisplayArea;
- var6.width -= 16;
- }
-
- if (this.m_bIsClumsyNS4) {
- this.rods_reshape(this.m_sbBsscHorizontal, 0, this.m_rectDisplayArea.height, this.m_rectDisplayArea.width, 16);
- this.m_sbBsscHorizontal.setValues(this.m_nHorizPosPixels, this.m_rectDisplayArea.width, 0, var1 - (this.m_bNetscapeScrollers ? this.m_rectDisplayArea.width : 0));
- } else {
- this.rods_reshape(this.m_sbHorizontal, 0, this.m_rectDisplayArea.height, this.m_rectDisplayArea.width, 16);
- this.m_sbHorizontal.setValues(this.m_nHorizPosPixels, this.m_rectDisplayArea.width, 0, var1 - (this.m_bNetscapeScrollers ? this.m_rectDisplayArea.width : 0));
- }
-
- if (this.m_bIsClumsyNS4) {
- this.rods_reshape(this.m_sbBsscVertical, this.m_rectDisplayArea.width, 0, 16, this.m_rectDisplayArea.height);
- } else {
- this.rods_reshape(this.m_sbVertical, this.m_rectDisplayArea.width, 0, 16, this.m_rectDisplayArea.height);
- }
-
- int var4 = this.m_nVerticalPosPixels / this.m_nCellHeight;
- if (var4 + var3 > var2) {
- var4 = var2 - var3;
- }
-
- if (var4 < 0) {
- var4 = 0;
- }
-
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscVertical.setValues(var4, var3 - 1, 0, var2 - (this.m_bNetscapeScrollers ? var3 : 1));
- this.m_nVerticalPosPixels = this.m_sbBsscVertical.getValue() * this.m_nCellHeight;
- } else {
- this.m_sbVertical.setValues(var4, var3 - 1, 0, var2 - (this.m_bNetscapeScrollers ? var3 : 1));
- this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
- }
-
- this.rods_reshape(this.m_btnScrollerCorner, this.m_rectDisplayArea.width, this.m_rectDisplayArea.height, 16, 16);
- if (this.m_rectDisplayArea.height < 0) {
- this.m_rectDisplayArea.height = 0;
- }
-
- if (this.m_rectDisplayArea.width < 0) {
- this.m_rectDisplayArea.width = 0;
- }
-
- if (this.m_imgDoubleBuffer != null && (this.m_nImageWidth != this.m_rectDisplayArea.width || this.m_nImageHeight != this.m_rectDisplayArea.height)) {
- this.m_imgDoubleBuffer.flush();
- this.m_imgDoubleBuffer = null;
- }
-
- if (this.m_imgDoubleBuffer == null) {
- this.m_imgDoubleBuffer = ((Component)this).createImage(this.m_rectDisplayArea.width, this.m_rectDisplayArea.height);
- this.m_nImageWidth = this.m_rectDisplayArea.width;
- this.m_nImageHeight = this.m_rectDisplayArea.height;
- }
-
- this.m_bLayoutComplete = true;
- }
- } catch (Exception var5) {
- ((Throwable)var5).printStackTrace();
- this.m_imgDoubleBuffer = null;
- }
- }
- }
-
- protected void sizeTree(TreeViewNode var1) {
- for(TreeViewNode var2 = var1; var2 != null; var2 = (TreeViewNode)((SiblingChildTree)var2).getSibling()) {
- this.sizeNode(var2);
- this.sizeTree((TreeViewNode)((SiblingChildTree)var2).getChild());
- }
-
- this.m_bNeedTreeSize = false;
- }
-
- public void setSelectionToTop() {
- if (this.m_tvnCurrentSelection != null) {
- this.m_tvnCurrentSelection.select(false);
- }
-
- for(this.m_tvnCurrentSelection = this.m_tvnRoot; this.m_tvnCurrentSelection != null && this.m_tvnCurrentSelection.getLabel() == null; this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.nextNode(true)) {
- }
-
- if (this.m_tvnCurrentSelection != null) {
- this.m_tvnCurrentSelection.select(true);
- }
-
- }
-
- public int getCellHeight() {
- return this.m_nCellHeight;
- }
-
- public void setCellHeight(int var1) {
- if (var1 < this.m_nIconHeight + 1) {
- this.m_nCellHeight = this.m_nIconHeight + 1;
- } else {
- this.m_nCellHeight = var1;
- }
- }
-
- public void layout() {
- if (this.m_bLayoutComplete) {
- this.mylayout();
- }
-
- }
-
- public boolean IsDisplayed(TreeViewNode var1) {
- TreeViewNode var2 = this.GetFirstDisplayedNode();
-
- for(int var3 = this.m_rectDisplayArea.height / this.m_nCellHeight; var2 != null && var3 > 0; var2 = var2.nextNode(true)) {
- if (var2.getLabel() != null) {
- --var3;
- }
-
- if (var1 == var2) {
- return true;
- }
- }
-
- return false;
- }
-
- protected void toggleOpenCloseNode(TreeViewNode var1) {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
- var1.setCollapsedState(!var1.getCollapsedState());
- if (var1.getCollapsedState()) {
- this.m_tvnCurrentSelection.select(false);
-
- for(TreeViewNode var2 = (TreeViewNode)this.m_tvnCurrentSelection.getParent(); var2 != null; var2 = (TreeViewNode)((SiblingChildTree)var2).getParent()) {
- if (var2.getCollapsedState()) {
- this.m_tvnCurrentSelection = var2;
- }
- }
-
- this.m_tvnCurrentSelection.select(true);
- this.InternalSelectionHasChanged();
- int var5 = this.getMaxHeight(this.m_tvnRoot, 0, true) / this.m_nCellHeight - 1;
- int var3 = this.m_rectDisplayArea.height / this.m_nCellHeight;
- int var4 = this.m_nVerticalPosPixels / this.m_nCellHeight;
- if (var4 + var3 > var5) {
- var4 = Math.max(var5 - var3, 0);
- }
-
- this.m_nVerticalPosPixels = var4 * this.m_nCellHeight;
- } else {
- this.mylayout();
- this.ScrollSubTreeIntoView(this.m_tvnCurrentSelection);
- }
- }
-
- public TreeViewNode nextVisibleNode() {
- try {
- return this.m_tvnRoot.nextNode(true);
- } catch (NullPointerException var2) {
- ((Throwable)var2).printStackTrace();
- return null;
- }
- }
-
- public TreeViewNode previousVisibleNode() {
- try {
- return this.m_tvnRoot.prevNode(true);
- } catch (NullPointerException var1) {
- return null;
- }
- }
-
- public void setTopIndex(int var1) {
- int var2 = this.m_rectDisplayArea.height / this.m_nCellHeight;
- int var3 = this.getMaxHeight(this.m_tvnRoot, 0, true) / this.m_nCellHeight - 1;
- this.m_nVerticalPosPixels = var1 * this.m_nCellHeight;
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscVertical.setValues(var1, var2 - 1, 0, var3 - (this.m_bNetscapeScrollers ? var2 : 1));
- } else {
- this.m_sbVertical.setValues(var1, var2 - 1, 0, var3 - (this.m_bNetscapeScrollers ? var2 : 1));
- }
-
- ((Component)this).paintAll(((Component)this).getGraphics());
- }
-
- public void MoveSelectionHome() {
- this.setSelectionToTop();
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscVertical.setValue(0);
- this.m_nVerticalPosPixels = this.m_sbBsscVertical.getValue() * this.m_nCellHeight;
- } else {
- this.m_sbVertical.setValue(0);
- this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
- }
-
- ((Component)this).repaint();
- }
-
- public void CollapseBranch() {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
- this.m_tvnCurrentSelection.setCollapsedState(true);
- this.mylayout();
- ((Component)this).repaint();
- }
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- if (this.m_bIsClumsyNS4) {
- if (var1.target == this.m_sbBsscHorizontal || var1.target == this.m_sbBsscVertical) {
- return super.mouseExit(var1, var2, var3);
- }
- } else if (var1.target == this.m_sbHorizontal || var1.target == this.m_sbVertical) {
- return super.mouseExit(var1, var2, var3);
- }
-
- if (this.m_applet != null && this.m_bCompletelyFilled) {
- this.m_applet.showStatus("");
- }
-
- return false;
- }
-
- public void setFilled(boolean var1) {
- this.m_bCompletelyFilled = var1;
- this.m_bLayoutComplete = false;
- this.m_bNeedTreeSize = true;
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
- ((Component)this).repaint();
- }
-
- public void setApplet(Applet var1) {
- this.m_applet = var1;
- }
-
- protected void rods_reshape(Component var1, int var2, int var3, int var4, int var5) {
- var1.move(var2, var3);
- var1.resize(var4, var5);
- }
-
- public boolean getUseLines() {
- return this.m_bUseLines;
- }
-
- public TreeViewNode getRoot() {
- return this.m_tvnRoot;
- }
-
- public void setRoot(TreeViewNode var1) {
- this.m_tvnRoot = var1;
- this.setSelectionToTop();
- }
-
- public void setUseLines(boolean var1) {
- this.m_bUseLines = var1;
- }
-
- protected void InternalSelectionHasChanged() {
- }
-
- protected int drawConnector(Graphics var1, TreeViewNode var2, int var3, int var4) {
- if (this.m_bUseButtons && this.m_bUseLines) {
- Image var18 = null;
- Object var6 = null;
-
- try {
- if (((SiblingChildTree)var2).getChild() != null) {
- if (var2.getCollapsedState()) {
- var18 = this.m_isConnectors.getImage(5);
- } else {
- var18 = this.m_isConnectors.getImage(6);
- }
- }
- } catch (IndexOutOfBoundsException var12) {
- ((Throwable)var12).printStackTrace();
- var18 = null;
- } catch (NullPointerException var13) {
- ((Throwable)var13).printStackTrace();
- var18 = null;
- }
-
- try {
- if (((SiblingChildTree)var2).getParent() == null) {
- if (this.m_bRootsConnected) {
- if (((SiblingChildTree)var2).getSiblingLeft() == null) {
- if (((SiblingChildTree)var2).getSibling() == null) {
- var19 = this.m_isConnectors.getImage(1);
- } else {
- var19 = this.m_isConnectors.getImage(2);
- }
- } else if (((SiblingChildTree)var2).getSibling() == null) {
- var19 = this.m_isConnectors.getImage(4);
- } else {
- var19 = this.m_isConnectors.getImage(3);
- }
- } else {
- var19 = this.m_isConnectors.getImage(1);
- }
- } else if (((SiblingChildTree)var2).getSiblingLeft() == null && ((SiblingChildTree)var2).getParent() != null && ((TreeViewNode)((SiblingChildTree)var2).getParent()).getLabel() == null) {
- var19 = this.m_isConnectors.getImage(2);
- } else if (((SiblingChildTree)var2).getSibling() == null) {
- var19 = this.m_isConnectors.getImage(4);
- } else {
- var19 = this.m_isConnectors.getImage(3);
- }
- } catch (IndexOutOfBoundsException var14) {
- ((Throwable)var14).printStackTrace();
- var19 = null;
- } catch (NullPointerException var15) {
- ((Throwable)var15).printStackTrace();
- var19 = null;
- }
-
- if (var19 != null) {
- var1.drawImage(var19, var3, var4, this);
- }
-
- if (var18 != null) {
- var1.drawImage(var18, var3, var4, this);
- }
-
- var3 += this.m_nConnectorWidth;
- } else if (this.m_bUseButtons) {
- Image var5 = null;
-
- try {
- if (((SiblingChildTree)var2).getChild() != null) {
- if (var2.getCollapsedState()) {
- var5 = this.m_isConnectors.getImage(5);
- } else {
- var5 = this.m_isConnectors.getImage(6);
- }
- }
- } catch (IndexOutOfBoundsException var10) {
- ((Throwable)var10).printStackTrace();
- var5 = null;
- } catch (NullPointerException var11) {
- ((Throwable)var11).printStackTrace();
- var5 = null;
- }
-
- if (var5 != null) {
- var1.drawImage(var5, var3, var4, this);
- }
-
- var3 += this.m_nConnectorWidth;
- } else if (this.m_bUseLines) {
- Object var16 = null;
-
- try {
- if (((SiblingChildTree)var2).getParent() == null) {
- if (this.m_bRootsConnected) {
- if (((SiblingChildTree)var2).getSiblingLeft() == null) {
- if (((SiblingChildTree)var2).getSibling() == null) {
- var17 = this.m_isConnectors.getImage(1);
- } else {
- var17 = this.m_isConnectors.getImage(2);
- }
- } else if (((SiblingChildTree)var2).getSibling() == null) {
- var17 = this.m_isConnectors.getImage(4);
- } else {
- var17 = this.m_isConnectors.getImage(3);
- }
- } else {
- var17 = this.m_isConnectors.getImage(1);
- }
- } else if (((SiblingChildTree)var2).getSibling() == null) {
- var17 = this.m_isConnectors.getImage(4);
- } else {
- var17 = this.m_isConnectors.getImage(3);
- }
- } catch (IndexOutOfBoundsException var8) {
- ((Throwable)var8).printStackTrace();
- var17 = null;
- } catch (NullPointerException var9) {
- ((Throwable)var9).printStackTrace();
- var17 = null;
- }
-
- if (var17 != null) {
- var1.drawImage(var17, var3, var4, this);
- }
-
- var3 += this.m_nConnectorWidth;
- }
-
- return var3;
- }
-
- protected void paintBorder(Graphics var1) {
- Rectangle var2 = this.m_rectDisplayArea;
- Color var3 = ((Component)this).getBackground();
- Color var4 = var3.darker();
- Color var5 = var4.darker();
- Color var6 = var5.darker();
- var1.setColor(var5);
- var1.drawLine(0, 0, var2.width - 1, 0);
- var1.drawLine(0, 0, 0, var2.height - 1);
- var1.setColor(var6);
- var1.drawLine(1, 1, var2.width - 2, 1);
- var1.drawLine(1, 1, 1, var2.height - 2);
- var1.setColor(var4);
- var1.drawLine(var2.width - 2, 1, var2.width - 2, var2.height - 2);
- var1.drawLine(1, var2.height - 2, var2.width - 2, var2.height - 2);
- var1.setColor(var3);
- var1.drawLine(var2.width - 1, 1, var2.width - 1, var2.height - 1);
- var1.drawLine(0, var2.height - 1, var2.width - 1, var2.height - 1);
- }
-
- public void collapseAll() {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
-
- try {
- this.m_tvnRoot.collapseTree();
- } catch (NullPointerException var2) {
- ((Throwable)var2).printStackTrace();
- }
- }
-
- public int getIconHeight() {
- return this.m_nIconHeight;
- }
-
- public void setIconHeight(int var1) {
- if (var1 < 0) {
- var1 = 0;
- }
-
- this.m_nIconHeight = var1;
- if (var1 > this.m_nCellHeight - 1) {
- this.m_nCellHeight = var1 + 1;
- }
-
- }
-
- public void ScrollRight() {
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscHorizontal.setValue(this.m_sbBsscHorizontal.getValue() + 1);
- this.m_nHorizPosPixels = this.m_sbBsscHorizontal.getValue();
- } else {
- this.m_sbHorizontal.setValue(this.m_sbHorizontal.getValue() + 1);
- this.m_nHorizPosPixels = this.m_sbHorizontal.getValue();
- }
-
- ((Component)this).repaint();
- }
-
- protected int getMaxSubTreeHeight(TreeViewNode var1, int var2, boolean var3) {
- int var4 = var2;
-
- for(TreeViewNode var5 = var1; var5 != null; var5 = (TreeViewNode)((SiblingChildTree)var5).getSibling()) {
- var4 += var5.getHeight();
- if (!var3 || !var5.getCollapsedState()) {
- var4 = this.getMaxSubTreeHeight((TreeViewNode)((SiblingChildTree)var5).getChild(), var4, var3);
- }
- }
-
- return var4;
- }
-
- public int getIndent() {
- return this.m_nIndent;
- }
-
- public void setIndent(int var1) {
- this.m_nIndent = var1;
- }
-
- public boolean getRootsConnected() {
- return this.m_bRootsConnected;
- }
-
- public void setRootsConnected(boolean var1) {
- this.m_bRootsConnected = var1;
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 401:
- switch (var1.key) {
- case 10:
- this.m_tvnCurrentSelection.doAction();
- return super.handleEvent(var1);
- case 43:
- this.ExpandBranch();
- return super.handleEvent(var1);
- case 45:
- this.CollapseBranch();
- return super.handleEvent(var1);
- default:
- return super.handleEvent(var1);
- }
- case 402:
- if (System.getProperty("java.vendor").startsWith("Netscape") && System.getProperty("java.version").equalsIgnoreCase("1.1.2") && System.getProperty("os.name").startsWith("Mac")) {
- this.m_tvnCurrentSelection.doAction();
- }
- break;
- case 403:
- switch (var1.key) {
- case 10:
- this.m_tvnCurrentSelection.doAction();
- return super.handleEvent(var1);
- case 1000:
- this.MoveSelectionHome();
- return super.handleEvent(var1);
- case 1001:
- this.MoveSelectionEnd();
- return super.handleEvent(var1);
- case 1002:
- this.MoveSelectionPgUp();
- return super.handleEvent(var1);
- case 1003:
- this.MoveSelectionPgDn();
- return super.handleEvent(var1);
- case 1004:
- this.MoveSelectionUp();
- return super.handleEvent(var1);
- case 1005:
- this.MoveSelectionDown();
- return super.handleEvent(var1);
- case 1006:
- if (this.m_tvnCurrentSelection.getChild() != null && !this.m_tvnCurrentSelection.getCollapsedState()) {
- if ((var1.modifiers & 1) == 1) {
- this.CollapseTree();
- } else {
- this.CollapseBranch();
- }
-
- return super.handleEvent(var1);
- } else {
- if (this.m_tvnCurrentSelection.getParent() != null) {
- this.MoveSelectionToParent();
- return super.handleEvent(var1);
- }
-
- return super.handleEvent(var1);
- }
- case 1007:
- if (!this.m_tvnCurrentSelection.getCollapsedState()) {
- if (this.m_tvnCurrentSelection.getChild() != null) {
- this.MoveSelectionDown();
- return super.handleEvent(var1);
- }
-
- return super.handleEvent(var1);
- } else {
- if ((var1.modifiers & 1) == 1) {
- this.ExpandTree();
- } else {
- this.ExpandBranch();
- }
-
- return super.handleEvent(var1);
- }
- default:
- return super.handleEvent(var1);
- }
- case 501:
- if (this.m_bIsClumsyNS4) {
- if (var1.target == this.m_sbBsscHorizontal || var1.target == this.m_sbBsscVertical) {
- break;
- }
- } else if (var1.target == this.m_sbHorizontal || var1.target == this.m_sbVertical) {
- break;
- }
-
- if (this.m_rectDisplayArea.inside(var1.x, var1.y)) {
- int var2 = var1.x + this.m_nHorizPosPixels;
- byte var3 = 11;
- TreeViewNode var4 = this.nodeAtLocation(var1.x, var1.y);
- if (var4 != null) {
- boolean var5 = !this.m_bIsMac && var1.clickCount % 2 == 0;
- if (this.m_bIsUnix || this.m_bIsMac || this.m_bIsNSWin16) {
- long var6 = System.currentTimeMillis();
- if (this.m_lnLastClickTime > var6 - this.c_lnDoubleClickWindow) {
- var5 = true;
- this.m_lnLastClickTime = 0L;
- } else {
- this.m_lnLastClickTime = var6;
- }
- }
-
- if (this.m_bIsMac && !var5) {
- var1.clickCount = 1;
- }
-
- if (((SiblingChildTree)var4).getChild() != null && var2 > var4.getBounds().x && (var2 < var4.getBounds().x + var3 || var5)) {
- ((Component)this).requestFocus();
- if (this.m_tvnCurrentSelection != null) {
- this.m_tvnCurrentSelection.select(false);
- }
-
- this.m_tvnCurrentSelection = var4;
- this.m_tvnCurrentSelection.select(true);
- this.InternalSelectionHasChanged();
- var4.doAction();
- this.toggleOpenCloseNode(var4);
- this.mylayout();
- ((Component)this).requestFocus();
- ((Component)this).repaint();
- } else if (var2 > var4.getBounds().x + var3 && var1.clickCount < 2) {
- if (this.m_tvnCurrentSelection != null) {
- this.m_tvnCurrentSelection.select(false);
- }
-
- this.m_tvnCurrentSelection = var4;
- this.m_tvnCurrentSelection.select(true);
- this.InternalSelectionHasChanged();
- var4.doAction();
- ((Component)this).repaint();
- }
-
- if (var5) {
- var4.doDblClick();
- }
- }
- }
- break;
- case 601:
- case 602:
- case 603:
- case 604:
- case 605:
- if (this.m_bIsClumsyNS4) {
- if (var1.target == this.m_sbBsscHorizontal) {
- this.m_nHorizPosPixels = this.m_sbBsscHorizontal.getValue();
- } else if (var1.target == this.m_sbBsscVertical) {
- this.m_nVerticalPosPixels = this.m_sbBsscVertical.getValue() * this.m_nCellHeight;
- }
- } else if (var1.target == this.m_sbHorizontal) {
- this.m_nHorizPosPixels = this.m_sbHorizontal.getValue();
- } else if (var1.target == this.m_sbVertical) {
- this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
- }
-
- ((Component)this).repaint();
- }
-
- return super.handleEvent(var1);
- }
-
- public void MoveSelectionToParent() {
- if (this.m_tvnCurrentSelection.getParent() != null) {
- if (this.m_tvnCurrentSelection.getParent() != this.m_tvnRoot) {
- this.m_tvnCurrentSelection.select(false);
- this.m_tvnCurrentSelection = (TreeViewNode)this.m_tvnCurrentSelection.getParent();
- this.m_tvnCurrentSelection.select(true);
- this.EnsureDisplayed(this.m_tvnCurrentSelection);
- this.InternalSelectionHasChanged();
- ((Component)this).repaint();
- }
- }
- }
-
- public void ExpandTree() {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
- this.m_tvnCurrentSelection.expandTree();
- this.mylayout();
- ((Component)this).repaint();
- }
-
- protected int paintTree(Graphics var1, TreeViewNode var2, int var3, int var4, Rectangle var5) {
- TreeViewNode var6 = var2;
-
- while(var6 != null) {
- int var7 = var3;
- int var8 = var4;
- if (var6.getLabel() != null) {
- if (var5.inside(var3, var4) || var5.inside(var3, var4 + this.m_nCellHeight)) {
- this.paintNode(var1, var6, var3, var4);
- }
-
- var7 = var3 + this.m_nIndent;
- var8 = var4 + this.m_nCellHeight;
- }
-
- if (!var6.getCollapsedState()) {
- var4 = this.paintTree(var1, (TreeViewNode)((SiblingChildTree)var6).getChild(), var7, var8, var5);
- } else {
- var4 = var8;
- }
-
- var6 = (TreeViewNode)((SiblingChildTree)var6).getSibling();
- if (var8 > var5.y + var5.height) {
- var6 = null;
- }
- }
-
- return var4;
- }
-
- protected TreeViewNode nodeAtLocation(int var1, int var2) {
- if (!this.m_rectDisplayArea.inside(var1, var2)) {
- return null;
- } else {
- int var3 = var2 + this.m_nVerticalPosPixels;
-
- for(TreeViewNode var4 = this.m_tvnRoot; var4 != null; var4 = var4.nextNode(true)) {
- Rectangle var5 = var4.getBounds();
- if (var3 > var5.y && var3 <= var5.y + var5.height && var4.getLabel() != null) {
- return var4;
- }
- }
-
- return null;
- }
- }
-
- public void ScrollLeft() {
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscHorizontal.setValue(this.m_sbBsscHorizontal.getValue() - 1);
- this.m_nHorizPosPixels = this.m_sbBsscHorizontal.getValue();
- } else {
- this.m_sbHorizontal.setValue(this.m_sbHorizontal.getValue() - 1);
- this.m_nHorizPosPixels = this.m_sbHorizontal.getValue();
- }
-
- ((Component)this).repaint();
- }
-
- public boolean mouseMove(Event var1, int var2, int var3) {
- if (this.m_bIsClumsyNS4) {
- if (var1.target == this.m_sbBsscHorizontal || var1.target == this.m_sbBsscVertical) {
- return super.mouseMove(var1, var2, var3);
- }
- } else if (var1.target == this.m_sbHorizontal || var1.target == this.m_sbVertical) {
- return super.mouseMove(var1, var2, var3);
- }
-
- if (!this.m_bLayoutComplete) {
- this.mylayout();
- }
-
- if (this.m_applet != null) {
- TreeViewNode var4 = this.nodeAtLocation(var2, var3);
- if (var4 != null) {
- if (this.m_bCompletelyFilled) {
- this.m_applet.showStatus(var4.getLabel());
- }
- } else if (this.m_bCompletelyFilled) {
- this.m_applet.showStatus("");
- }
- }
-
- return false;
- }
-
- protected void sizeNode(TreeViewNode var1) {
- if (var1 != null) {
- FontMetrics var2 = ((Component)this).getFontMetrics(((Component)this).getFont());
- int var3 = 0;
- if (this.m_bUseButtons || this.m_bUseLines) {
- var3 = this.m_nIconWidth;
- }
-
- if (var1.getCurrentImage() != null) {
- var3 += this.m_nIconWidth + this.m_nLabelOffset;
- }
-
- if (var1.getLabel() != null) {
- var3 += var2.stringWidth(var1.getLabel() + ' ');
- } else if (var1.getCurrentImage() != null) {
- var3 -= this.m_nLabelOffset;
- }
-
- var1.setBounds(0, 0, var3, this.m_nCellHeight);
- }
- }
-
- public TreeViewNode nextNode(boolean var1) {
- try {
- return (TreeViewNode)this.m_tvnRoot.prevNode();
- } catch (NullPointerException var2) {
- return null;
- }
- }
-
- public TreeViewNode previousNode(boolean var1) {
- try {
- return (TreeViewNode)this.m_tvnRoot.prevNode();
- } catch (NullPointerException var2) {
- return null;
- }
- }
-
- public void ExpandBranch() {
- this.m_bMaxHeightIsValid = false;
- this.m_bMaxWidthIsValid = false;
- this.m_tvnCurrentSelection.setCollapsedState(false);
- this.mylayout();
- this.ScrollSubTreeIntoView(this.m_tvnCurrentSelection);
- ((Component)this).repaint();
- }
-
- public void update(Graphics var1) {
- if (!this.m_bLayoutComplete) {
- this.mylayout();
- }
-
- this.paint(var1);
- }
-
- public void ResetCursor() {
- if (!System.getProperty("java.version").startsWith("1.0") && (System.getProperty("java.vendor").indexOf("Netscape") == -1 || !System.getProperty("java.version").startsWith("1.1.2"))) {
- if (this.m_Cursor != null) {
- try {
- ((Component)this).setCursor((Cursor)this.m_Cursor);
- } catch (Exception var1) {
- }
-
- this.m_Cursor = null;
- }
-
- }
- }
-
- public int getXInset() {
- return this.m_nInsetX;
- }
-
- public void setXInset(int var1) {
- if (var1 < 0) {
- var1 = 0;
- }
-
- }
-
- public void MoveSelectionUp() {
- this.MoveSelectionUp(true);
- }
-
- public ImageSet getConnectors() {
- return this.m_isConnectors;
- }
-
- public void setConnectors(ImageSet var1) {
- this.m_isConnectors = var1;
- }
-
- public int getIconWidth() {
- return this.m_nIconWidth;
- }
-
- public void setIconWidth(int var1) {
- if (var1 < 0) {
- var1 = 0;
- }
-
- this.m_nIconWidth = var1;
- }
-
- public void MoveSelectionUp(boolean var1) {
- if (this.m_tvnCurrentSelection.prevNode(true) != null) {
- if (this.m_tvnCurrentSelection.prevNode(true) != this.m_tvnRoot) {
- this.m_tvnCurrentSelection.select(false);
- this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.prevNode(true);
- this.m_tvnCurrentSelection.select(true);
- this.EnsureDisplayed(this.m_tvnCurrentSelection);
- if (var1) {
- this.InternalSelectionHasChanged();
- }
-
- ((Component)this).repaint();
- }
- }
- }
-
- protected int getMaxSubTreeWidth(TreeViewNode var1, int var2, boolean var3) {
- int var4 = 0;
-
- for(TreeViewNode var5 = var1; var5 != null; var5 = (TreeViewNode)((SiblingChildTree)var5).getSibling()) {
- if (var5.getWidth() + var2 > var4) {
- var4 = var5.getWidth() + var2;
- }
-
- if (!var3 || !var5.getCollapsedState()) {
- int var6 = this.getMaxSubTreeWidth((TreeViewNode)((SiblingChildTree)var5).getChild(), var2 + this.m_nIndent, var3);
- if (var6 > var4) {
- var4 = var6;
- }
- }
- }
-
- return var4;
- }
-
- public boolean isFocusTraversable() {
- return true;
- }
-
- protected int getMaxHeight(TreeViewNode var1, int var2, boolean var3) {
- if (!this.m_bMaxHeightIsValid) {
- this.m_nMaxHeight = this.getMaxSubTreeHeight(var1, var2, var3);
- }
-
- return this.m_nMaxHeight;
- }
-
- public int getYInset() {
- return this.m_nInsetY;
- }
-
- public void setYInset(int var1) {
- if (var1 < 0) {
- var1 = 0;
- }
-
- }
-
- public void MoveSelectionPgDn() {
- int var1 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
-
- for(int var2 = 0; var2 < var1; ++var2) {
- this.MoveSelectionDown(false);
- }
-
- this.InternalSelectionHasChanged();
- ((Component)this).repaint();
- }
-
- public TreeView() {
- this((ImageSet)null, (TreeViewNode)null);
- }
-
- public TreeView(ImageSet var1) {
- this(var1, (TreeViewNode)null);
- }
-
- public TreeView(TreeViewNode var1) {
- this((ImageSet)null, var1);
- }
-
- public TreeView(ImageSet var1, TreeViewNode var2) {
- this.m_nLabelOffset = 6;
- this.m_bLayoutComplete = false;
- this.m_bUseButtons = true;
- this.m_bUseLines = false;
- this.m_bRootsConnected = true;
- this.m_applet = null;
- this.m_sbHorizontal = new Scrollbar(0);
- this.m_sbVertical = new Scrollbar(1);
- this.m_sbBsscHorizontal = new BsscScrollbar(0);
- this.m_sbBsscVertical = new BsscScrollbar(1);
- this.m_bIsClumsyNS4 = false;
- this.m_btnScrollerCorner = new Button();
- this.m_nInsetX = 5;
- this.m_nInsetY = 1;
- this.m_nConnectorWidth = 16;
- this.m_nIndent = 7 + this.m_nConnectorWidth;
- this.m_nIconWidth = 16;
- this.m_nIconHeight = 16;
- this.m_nCellHeight = this.m_nIconHeight + 1;
- this.m_nFontBaseOffset = this.m_nIconHeight;
- this.m_bNetscapeScrollers = false;
- this.m_bLayedOutByMouseOver = false;
- this.m_bCompletelyFilled = false;
- this.m_nHorizPosPixels = 0;
- this.m_nVerticalPosPixels = 0;
- this.m_nImageWidth = 0;
- this.m_nImageHeight = 0;
- this.c_lnDoubleClickWindow = 500L;
- this.m_bIsNS3Win32 = false;
- this.m_bIsNSWin16 = false;
- this.m_bIsUnix = false;
- this.m_lnLastClickTime = 0L;
- this.m_bIsMac = false;
- this.m_bNeedTreeSize = true;
- this.m_bMaxWidthIsValid = false;
- this.m_bMaxHeightIsValid = false;
- this.m_nMaxWidth = 0;
- this.m_nMaxHeight = 0;
- this.m_bUseDoubleBuffer = true;
- this.m_Cursor = null;
-
- try {
- if (System.getProperty("java.vendor").startsWith("Netscape")) {
- if (System.getProperty("java.version").startsWith("1.0") && System.getProperty("os.name").startsWith("Windows") && System.getProperty("os.version").startsWith("4")) {
- this.m_bIsNS3Win32 = true;
- } else if (System.getProperty("os.name").startsWith("16-bit Windows")) {
- this.c_lnDoubleClickWindow = 1500L;
- this.m_bIsNSWin16 = true;
- }
- }
-
- if (System.getProperty("java.vendor").startsWith("Netscape") && System.getProperty("java.version").startsWith("1.1.5") && System.getProperty("os.name").startsWith("Windows")) {
- this.m_bIsClumsyNS4 = true;
- }
- } finally {
- ;
- }
-
- this.m_tvnRoot = var2;
- this.m_isImages = var1;
- this.m_isConnectors = new TreeViewConnectorImageSet();
- this.m_imgDoubleBuffer = null;
- this.m_rectDisplayArea = new Rectangle();
- ((Container)this).setLayout((LayoutManager)null);
-
- try {
- String var3 = System.getProperty("os.name");
- if (!var3.startsWith("Windows")) {
- this.m_bIsMac = var3.startsWith("Mac");
- this.m_bIsUnix = !this.m_bIsMac;
- }
- } finally {
- ;
- }
-
- int var15 = BsscFontFixPatch.GetFontSize();
- ((Component)this).setFont(new Font(BsscFontFixPatch.GetFontName(), 0, var15));
- FontMetrics var4 = ((Component)this).getFontMetrics(((Component)this).getFont());
- int var5 = var4.getLeading() + var4.getAscent() + var4.getDescent();
- this.setCellHeight(var5);
- if (var5 < this.m_nCellHeight) {
- this.m_nFontBaseOffset = (this.m_nCellHeight + var5) / 2 - var4.getDescent();
- } else {
- this.m_nFontBaseOffset = this.m_nCellHeight - var4.getDescent();
- }
-
- this.setSelectionToTop();
- Scrollbar var6 = new Scrollbar();
- var6.setValues(0, 3, 0, 10);
- var6.setValue(10);
- if (!this.m_bIsClumsyNS4) {
- this.m_bNetscapeScrollers = var6.getValue() == 10;
- }
-
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscHorizontal.setLineIncrement(16);
- if (this.m_sbBsscHorizontal.getPageIncrement() < 128) {
- this.m_sbBsscHorizontal.setPageIncrement(128);
- }
-
- this.m_sbBsscHorizontal.setBackground(new Color(192, 192, 192));
- ((Container)this).add(this.m_sbBsscHorizontal);
- this.m_sbBsscVertical.setBackground(new Color(192, 192, 192));
- ((Container)this).add(this.m_sbBsscVertical);
- } else {
- this.m_sbHorizontal.setLineIncrement(16);
- if (this.m_sbHorizontal.getPageIncrement() < 128) {
- this.m_sbHorizontal.setPageIncrement(128);
- }
-
- this.m_sbHorizontal.setBackground(new Color(192, 192, 192));
- ((Container)this).add(this.m_sbHorizontal);
- this.m_sbVertical.setBackground(new Color(192, 192, 192));
- ((Container)this).add(this.m_sbVertical);
- }
-
- this.m_btnScrollerCorner.enable(false);
- ((Container)this).add(this.m_btnScrollerCorner);
- }
-
- public void EnsureDisplayed(TreeViewNode var1) {
- int var2 = this.m_rectDisplayArea.height / this.m_nCellHeight;
- if (!this.IsDisplayed(var1)) {
- int var3 = this.GetNodePosition(var1);
- if (this.m_bIsClumsyNS4) {
- if (var3 < this.m_sbBsscVertical.getValue()) {
- this.m_sbBsscVertical.setValue(var3);
- } else {
- this.m_sbBsscVertical.setValue(var3 - var2 + 1);
- }
-
- this.m_nVerticalPosPixels = this.m_sbBsscVertical.getValue() * this.m_nCellHeight;
- } else {
- if (var3 < this.m_sbVertical.getValue()) {
- this.m_sbVertical.setValue(var3);
- } else {
- this.m_sbVertical.setValue(var3 - var2 + 1);
- }
-
- this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
- }
- }
- }
-
- public int GetOpenChildSiblingCount(TreeViewNode var1) {
- int var2 = 0;
- if (var1 == null) {
- return 0;
- } else {
- if (var1.getLabel() != null) {
- ++var2;
- }
-
- if (!var1.getCollapsedState()) {
- TreeViewNode var3 = (TreeViewNode)((SiblingChildTree)var1).getChild();
- if (var3 != null) {
- var2 += this.GetOpenChildSiblingCount(var3);
- }
- }
-
- TreeViewNode var4 = (TreeViewNode)((SiblingChildTree)var1).getSibling();
- if (var4 != null) {
- var2 += this.GetOpenChildSiblingCount(var4);
- }
-
- return var2;
- }
- }
-
- public void paint(Graphics var1) {
- try {
- if (!this.m_bLayoutComplete) {
- String var2 = ResourceLib.GetRes("LoadingContents");
- var1.drawChars(var2.toCharArray(), 0, var2.length(), 0, 10);
- this.mylayout();
- }
-
- if (this.m_bUseDoubleBuffer && this.m_imgDoubleBuffer == null) {
- return;
- }
-
- if (this.m_bIsNS3Win32) {
- var1.dispose();
- }
-
- Object var6 = null;
- Graphics var7;
- if (this.m_bUseDoubleBuffer) {
- var7 = this.m_imgDoubleBuffer.getGraphics();
- } else {
- var7 = ((Component)this).getGraphics();
- }
-
- var7.setFont(((Component)this).getFont());
- var7.setColor(((Component)this).getBackground());
- var7.fillRect(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
- var7.setColor(((Component)this).getForeground());
- var7.translate(-this.m_nHorizPosPixels, -this.m_nVerticalPosPixels);
-
- try {
- Rectangle var3 = new Rectangle(this.m_rectDisplayArea.x, this.m_rectDisplayArea.y, this.m_rectDisplayArea.width, this.m_rectDisplayArea.height);
- var3.y += this.m_nVerticalPosPixels;
- this.paintTree(var7, this.m_tvnRoot, this.m_nInsetX, this.m_nInsetY, var3);
- } catch (NullPointerException var4) {
- ((Throwable)var4).printStackTrace();
- }
-
- if (this.m_bUseDoubleBuffer) {
- var7.dispose();
- var7 = this.m_imgDoubleBuffer.getGraphics();
- } else {
- var7.translate(this.m_nHorizPosPixels, this.m_nVerticalPosPixels);
- }
-
- this.paintBorder(var7);
- if (this.m_bUseDoubleBuffer) {
- if (this.m_bIsNS3Win32) {
- var7.dispose();
- var1 = ((Component)this).getGraphics();
- }
-
- var1.drawImage(this.m_imgDoubleBuffer, 0, 0, this);
- return;
- }
- } catch (Exception var5) {
- ((Throwable)var5).printStackTrace();
- }
-
- }
-
- protected void paintNode(Graphics var1, TreeViewNode var2, int var3, int var4) {
- var2.moveBounds(var3, var4);
- var3 = this.drawConnector(var1, var2, var3, var4);
- if (var2.getCurrentImage() != null) {
- var1.drawImage(var2.getCurrentImage(), var3, var4 + 1, this.m_nIconWidth, this.m_nIconHeight, this);
- var3 += this.m_nIconWidth + this.m_nLabelOffset;
- }
-
- if (var2.getLabel() != null) {
- this.drawText(var1, var2, var3, var4);
- }
-
- }
-
- public void MoveSelectionEnd() {
- this.m_tvnCurrentSelection.select(false);
-
- while(this.m_tvnCurrentSelection.nextNode(true) != null) {
- this.m_tvnCurrentSelection = this.m_tvnCurrentSelection.nextNode(true);
- }
-
- this.m_tvnCurrentSelection.select(true);
- if (this.m_bIsClumsyNS4) {
- this.m_sbBsscVertical.setValue(this.m_sbBsscVertical.getMaximum());
- this.m_nVerticalPosPixels = this.m_sbBsscVertical.getValue() * this.m_nCellHeight;
- } else {
- this.m_sbVertical.setValue(this.m_sbVertical.getMaximum());
- this.m_nVerticalPosPixels = this.m_sbVertical.getValue() * this.m_nCellHeight;
- }
-
- this.InternalSelectionHasChanged();
- ((Component)this).repaint();
- }
-
- public void MoveSelectionPgUp() {
- int var1 = this.m_rectDisplayArea.height / this.m_nCellHeight - 1;
-
- for(int var2 = 0; var2 < var1; ++var2) {
- this.MoveSelectionUp(false);
- }
-
- this.InternalSelectionHasChanged();
- ((Component)this).repaint();
- }
-
- TreeViewNode GetFirstDisplayedNode() {
- TreeViewNode var1 = this.m_tvnRoot;
- int var2 = 0;
- if (this.m_bIsClumsyNS4) {
- var2 = this.m_sbBsscVertical.getValue();
- } else {
- var2 = this.m_sbVertical.getValue();
- }
-
- for(; var1 != null && var2 > 0; var1 = var1.nextNode(true)) {
- if (var1.getLabel() != null) {
- --var2;
- }
- }
-
- return var1;
- }
-
- public void SetWaitCursor() {
- if (!System.getProperty("java.version").startsWith("1.0") && (System.getProperty("java.vendor").indexOf("Netscape") == -1 || !System.getProperty("java.version").startsWith("1.1.2"))) {
- try {
- this.m_Cursor = ((Component)this).getCursor();
- ((Component)this).setCursor(new Cursor(3));
- } catch (Exception var1) {
- }
- }
- }
-
- public boolean getUseButtons() {
- return this.m_bUseButtons;
- }
-
- public void setUseButtons(boolean var1) {
- this.m_bUseButtons = var1;
- }
-
- public ImageSet getImages() {
- return this.m_isImages;
- }
-
- public void setImages(ImageSet var1) {
- this.m_isImages = var1;
- }
-
- protected void drawText(Graphics var1, TreeViewNode var2, int var3, int var4) {
- var4 += this.m_nFontBaseOffset;
- if (var2.isSelected()) {
- var1.setColor(new Color(0, 0, 128));
- Rectangle var5 = var2.getBounds();
- int var6 = var5.width + var5.x - var3;
- var1.fillRect(var3, var5.y, var6, var5.height);
- var1.setColor(Color.white);
- } else {
- var1.setColor(((Component)this).getForeground());
- }
-
- var1.setFont(((Component)this).getFont());
- var1.drawString(var2.getLabel(), var3, var4);
- }
- }
-