Class symantec.itools.awt.TreeView
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.TreeView

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Panel
                           |
                           +----symantec.itools.awt.TreeView

public class TreeView
extends Panel
implements ItemSelectable
Creates an "outline view" of text headings and, optionally, images. The headings are arranged in a hierarchical fashion, and can be expanded to show their sub-headings or collapsed, hiding their sub-headings.

A TreeView is typically used to display information that is organized in a hierarchical fashion like an index or table of contents.

A TreeNode object is used for each heading.

See Also:
TreeNode

Variable Index

 o CHILD
Constant indicating that the new node is to be a child of the existing node.
 o LAST
Constant indicating that the new node is to be the last sibling of the existing node.
 o NEXT
Constant indicating that the new node is to be the next sibling of the existing node.
 o NODE_COLLAPSED
Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been collapsed.
 o NODE_EXPANDED
Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been expanded.
 o NODE_TOGGLED
Constand used to describe ItemEvents sent when a node is toggled.
 o SEL_CHANGED
 o actionListener
The action listener to keep track of listeners for our action event.
 o adjustment
The this component's adjustment event listener.
 o count
Number of nodes in the tree.
 o e
e is vector of existing nodes
 o errors
Error strings.
 o fm
current font metrics
 o focus
The this component's focus event listener.
 o g1
Offscreen graphics context used for buffering the painting process.
 o horizontalScrollBar
The horizontal scrollbar
 o im1
Offscreen Image used for buffering the painting process.
 o isSun1_1
Checks for scrollbars that have different max value.
 o itemListener
The action listener to keep track of listeners for our item event.
 o key
The this component's key event listener.
 o mouse
The this component's mouse event listener.
 o needResetVector
Keeps track of if drawTree needs to call resetVector or not.
 o newWidth
for horizontal scrollbar
 o redrawTriggered
Flag indicating repaint() shoud redraw the entire image even if the component size has not changed.
 o rootNode
root node of tree
 o sbHLineIncrement
Horizontal scroll bar unit increment.
 o sbHShow
show or hide horizontal scrollbar
 o sbHSize
size of horizontal scrollbar
 o sbVShow
show or hide vertical scrollbar
 o selectedNode
highlighted node
 o topVisibleNode
first node in window
 o v
v is vector of viewable nodes
 o verticalScrollBar
The vertical scrollbar.
 o viewCount
Number of viewable nodes in the tree.
 o viewHeight
pixel size of tree display
 o viewWidest
widest item displayable (for horz scroll)
 o viewWidth
pixel size of tree display

Constructor Index

 o symantec.itools.awt.TreeView()
Constructs an empty TreeView.
 o symantec.itools.awt.TreeView(TreeNode)
Constructs a TreeView with the given node.

Method Index

 o addActionListener(ActionListener)
Adds the specified action listener to receive action events from this button.
 o addChild(TreeNode, TreeNode)
Adds the specified child node to the specified parent node Does not redraw the component.
 o addItemListener(ItemListener)
Add a listener to recieve item events when the state of an item changes.
 o addNotify()
Tells this component that it has been added to a container.
 o addSibling(TreeNode, TreeNode)
Adds the specified node as a sibling to the specified node Does not redraw the component.
 o addSibling(TreeNode, TreeNode, boolean)
Adds the specified node as a sibling to the specified node Does not redraw the component.
 o append(TreeNode)
Adds a new node at root level.
 o changeSelection(TreeNode)
Handles selecting the given node.
 o clear()
Clears the tree structure and redraws.
 o compWidth(Graphics)
Calculates the maximum width of the tree.
 o debugVector()
Internal use only.
 o drawDotLine(int, int, int, int)
Internal helper method.
 o drawNodeText(TreeNode, int, boolean, boolean)
Internal helper method.
 o drawNodeToggle(TreeNode, int, int)
Used to draw the toggle box of an expandable node.
 o drawTree()
Draws the TreeView into an offscreen image.
 o exists(TreeNode)
Determines if the given node is in the TreeView.
 o exists(String)
Determines if the node with the given text is in the TreeView.
 o findLastPreSpace(String)
Internal helper method.
 o getBgHilite()
 o getCount()
Returns the total number of nodes in the tree.
 o getFgHilite()
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getRootNode()
Returns the "root" node.
 o getSelectedNode()
Gets the currently selected node.
 o getSelectedObjects()
Returns the selected items or null if no items are selected.
 o getSelectedText()
Gets the text of the currently selected node.
 o getTreeStructure()
Gets a string array that reflects the current TreeView's contents.
 o getViewCount()
Returns the total number of viewable nodes in the tree.
 o handleAdjustmentEvent(AdjustmentEvent)
Handles adjustment events.
 o handleFocusGained(FocusEvent)
Handles focus gained events.
 o handleFocusLost(FocusEvent)
Handles focus lost events.
 o handleKeyPressed(KeyEvent)
Handles key pressed events.
 o handleMousePressed(MouseEvent)
Handles mouse pressed events.
 o handleMouseReleased(MouseEvent)
Handles mouse released events.
 o insert(TreeNode, TreeNode, int)
Inserts a new node relative to an existing node in the tree.
 o isFocusTraversable()
 o minimumSize()
 o newTreeNode(String, TreeView)
Generates a new tree node.
 o paint(Graphics)
Paints this component using the given graphics context.
 o parseTreeStructure(String[])
Internal helper method.
 o preferredSize()
 o printTree(TreeNode)
Print out the text of each node in the TreeView beginning with the given node.
 o printTree(TreeNode, boolean)
Print out the text of each node in the TreeView beginning with the given node.
 o recount()
Internal helper method.
 o redraw()
Lays out the vertical scrollbar as needed, then draws the TreeView into an offscreen image.
 o redraw(Graphics)
Lays out the vertical scrollbar as needed, then draws the TreeView into an offscreen image.
 o remove(String)
Removes the node with the given text from the TreeView.
 o remove(TreeNode)
Removes the given node from the TreeView.
 o removeActionListener(ActionListener)
Removes the specified action listener so it no longer receives action events from this button.
 o removeItemListener(ItemListener)
Removes an item listener.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removeSelected()
Removes the currently selected node from the TreeView.
 o repaint(boolean)
Repaints this component.
 o resetVector()
Internal helper method.
 o sendActionEvent()
Sends an action performed event to any action listeners, as needed.
 o setLayout(LayoutManager)
Takes no action.
 o setSelectedNode(TreeNode)
Handles selecting the given node.
 o setTreeStructure(String[])
Initializes the TreeView from a string array.
 o traverse(TreeNode)
Internal helper method.
 o triggerRedraw()
Triggers redrawing the entire image, even if the size of the component has not changed.
 o update(Graphics)
Handles redrawing of this component on the screen.
 o vectorize(TreeNode, boolean, boolean, Vector)
Internal helper method.

Variables

 o CHILD
public static final int CHILD
Constant indicating that the new node is to be a child of the existing node.

See Also:
insert
 o LAST
public static final int LAST
Constant indicating that the new node is to be the last sibling of the existing node.

See Also:
insert
 o NEXT
public static final int NEXT
Constant indicating that the new node is to be the next sibling of the existing node.

See Also:
insert
 o NODE_COLLAPSED
public static final int NODE_COLLAPSED
Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been collapsed.

See Also:
NODE_TOGGLED, NODE_EXPANDED
 o NODE_EXPANDED
public static final int NODE_EXPANDED
Constand used to detail that the node referenced in a NODE_TOGGLED ItemEvent has been expanded.

See Also:
NODE_TOGGLED, NODE_COLLAPSED
 o NODE_TOGGLED
public static final int NODE_TOGGLED
Constand used to describe ItemEvents sent when a node is toggled.

See Also:
NODE_EXPANDED, NODE_COLLAPSED
 o SEL_CHANGED
public static final int SEL_CHANGED

Note: SEL_CHANGED is deprecated. As of JDK version 1.1, replaced by ItemSelectable interface.

See Also:
ItemSelectable
 o actionListener
protected java.awt.event.ActionListener actionListener
The action listener to keep track of listeners for our action event.

 o adjustment
protected symantec.itools.awt.TreeView. Adjustment adjustment
The this component's adjustment event listener.

 o count
protected int count
Number of nodes in the tree.

 o e
protected java.util.Vector e
e is vector of existing nodes

 o errors
protected transient java.util.ResourceBundle errors
Error strings.

 o fm
protected transient java.awt.FontMetrics fm
current font metrics

 o focus
protected symantec.itools.awt.TreeView. Focus focus
The this component's focus event listener.

 o g1
protected transient java.awt.Graphics g1
Offscreen graphics context used for buffering the painting process.

 o horizontalScrollBar
protected java.awt.Scrollbar horizontalScrollBar
The horizontal scrollbar

 o im1
protected transient java.awt.Image im1
Offscreen Image used for buffering the painting process.

 o isSun1_1
protected static boolean isSun1_1
Checks for scrollbars that have different max value.

 o itemListener
protected java.awt.event.ItemListener itemListener
The action listener to keep track of listeners for our item event.

 o key
protected symantec.itools.awt.TreeView. Key key
The this component's key event listener.

 o mouse
protected symantec.itools.awt.TreeView. Mouse mouse
The this component's mouse event listener.

 o needResetVector
protected boolean needResetVector
Keeps track of if drawTree needs to call resetVector or not.

 o newWidth
protected int newWidth
for horizontal scrollbar

 o redrawTriggered
protected transient boolean redrawTriggered
Flag indicating repaint() shoud redraw the entire image even if the component size has not changed.

 o rootNode
protected symantec.itools.awt.TreeNode rootNode
root node of tree

 o sbHLineIncrement
protected int sbHLineIncrement
Horizontal scroll bar unit increment.

 o sbHShow
protected boolean sbHShow
show or hide horizontal scrollbar

 o sbHSize
protected int sbHSize
size of horizontal scrollbar

 o sbVShow
protected boolean sbVShow
show or hide vertical scrollbar

 o selectedNode
protected symantec.itools.awt.TreeNode selectedNode
highlighted node

 o topVisibleNode
protected symantec.itools.awt.TreeNode topVisibleNode
first node in window

 o v
protected java.util.Vector v
v is vector of viewable nodes

 o verticalScrollBar
protected java.awt.Scrollbar verticalScrollBar
The vertical scrollbar.

 o viewCount
protected int viewCount
Number of viewable nodes in the tree. A node is viewable if all of its parents are expanded.

 o viewHeight
protected int viewHeight
pixel size of tree display

 o viewWidest
protected int viewWidest
widest item displayable (for horz scroll)

 o viewWidth
protected int viewWidth
pixel size of tree display

Constructors

 o TreeView
public TreeView()
Constructs an empty TreeView.

 o TreeView
public TreeView(TreeNode head)
Constructs a TreeView with the given node.

Parameters:
head - the root node of the constructed tree

Methods

 o addActionListener
public synchronized void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this button.

Parameters:
l - the action listener
 o addChild
public void addChild(TreeNode newNode,
                     TreeNode relativeNode)
Adds the specified child node to the specified parent node Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

Parameters:
newNode - the node to add as a child
relativeNode - the node to add the child to.
 o addItemListener
public synchronized void addItemListener(ItemListener l)
Add a listener to recieve item events when the state of an item changes.

This is a standard method of the ItemSelectable interface.

Parameters:
l - the listener to recieve events
See Also:
ItemEvent
 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

Overrides:
addNotify in class Panel
See Also:
removeNotify
 o addSibling
public void addSibling(TreeNode newNode,
                       TreeNode siblingNode)
Adds the specified node as a sibling to the specified node Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

Parameters:
newNode - the node to add as a sibling
siblingNode - a sibling node to the new node.
See Also:
addSibling(symantec.itools.awt.TreeNode, symantec.itools.awt.TreeNode, boolean)
 o addSibling
public void addSibling(TreeNode newNode,
                       TreeNode siblingNode,
                       boolean asLastSibling)
Adds the specified node as a sibling to the specified node Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

Parameters:
newNode - the node to add as a sibling
siblingNode - a sibling node to the new node.
asLastSibling - if true, then add the new node as the last (bottommost) sibling node to the specified sibling node.
See Also:
addSibling(symantec.itools.awt.TreeNode, symantec.itools.awt.TreeNode)
 o append
public void append(TreeNode newNode)
Adds a new node at root level. If there is no root node, the given node is made the root node. If there is a root node, the given node is made a sibling of the root node. Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

Parameters:
newNode - the new node to add
See Also:
insert
 o changeSelection
protected void changeSelection(TreeNode node)
Handles selecting the given node.

Parameters:
node - the node to select
 o clear
public void clear()
Clears the tree structure and redraws.

 o compWidth
protected int compWidth(Graphics gg)
Calculates the maximum width of the tree.

Parameters:
gg - the Graphics context to use for the calculation
Returns:
the maximum tree width, in pixels
 o debugVector
protected void debugVector()
Internal use only.

 o drawDotLine
protected void drawDotLine(int x0,
                           int y0,
                           int x1,
                           int y1)
Internal helper method. Draws a dotted line.

Parameters:
x0 - starting x position
y0 - starting y position
x1 - ending x position
y1 - ending y position
 o drawNodeText
protected void drawNodeText(TreeNode node,
                            int yPosition,
                            boolean eraseBackground,
                            boolean eraseLines)
Internal helper method. Draws the text of the given tree node.

Parameters:
node - the tree node whose text is drawn
yPosition - the vertical drawing position for the node
eraseBackground - true to erase the background behind the text
eraseLines - true to erase the node's text lines before redrawing
 o drawNodeToggle
protected void drawNodeToggle(TreeNode node,
                              int x,
                              int y)
Used to draw the toggle box of an expandable node. Override to change the look of the toggle box.

 o drawTree
public void drawTree()
Draws the TreeView into an offscreen image. This is used for cleaner refresh.

 o exists
public boolean exists(TreeNode node)
Determines if the given node is in the TreeView.

Parameters:
node - the node to check
Returns:
true if the node is in the TreeView, false if it is not
See Also:
exists(java.lang.String)
 o exists
public boolean exists(String s)
Determines if the node with the given text is in the TreeView.

Parameters:
s - the node text to find
Returns:
true if the node is in the TreeView, false if it is not
See Also:
exists(symantec.itools.awt.TreeNode)
 o findLastPreSpace
protected int findLastPreSpace(String s)
Internal helper method. Counts the number of spaces before the node text starts.

Parameters:
s - the node text
Returns:
the number of spaces before the texxt starts
 o getBgHilite
public java.awt.Color getBgHilite()
Note: getBgHilite() is deprecated. As of JDK version 1.1, replaced by use of SystemColors.textHighlight.

 o getCount
public int getCount()
Returns the total number of nodes in the tree.

 o getFgHilite
public java.awt.Color getFgHilite()
Note: getFgHilite() is deprecated. As of JDK version 1.1, replaced by use of SystemColors.textHighlightText.

 o getMinimumSize
public synchronized java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
getMinimumSize in class Container
See Also:
getPreferredSize
 o getPreferredSize
public synchronized java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
getPreferredSize in class Container
See Also:
getMinimumSize
 o getRootNode
public symantec.itools.awt.TreeNode getRootNode()
Returns the "root" node. The root node is the first top-level node in the tree hierarchy. All other nodes are either children or siblings of that one.

Returns:
the root tree node
 o getSelectedNode
public symantec.itools.awt.TreeNode getSelectedNode()
Gets the currently selected node.

Returns:
the currently selected node, or null if none selected
 o getSelectedObjects
public java.lang.Object[] getSelectedObjects()
Returns the selected items or null if no items are selected.

This is a standard method of the ItemSelectable interface.

 o getSelectedText
public java.lang.String getSelectedText()
Gets the text of the currently selected node.

Returns:
the text of the currently selected node or null if no node is selected
 o getTreeStructure
public java.lang.String[] getTreeStructure()
Gets a string array that reflects the current TreeView's contents. There is one string for each node in the array. That string contains the text of the node indented with same number of leading spaces as the depth of that node in the tree.

Returns:
the string array that reflects the TreeView's contents
See Also:
setTreeStructure
 o getViewCount
public int getViewCount()
Returns the total number of viewable nodes in the tree. A node is viewable if all of its parents are expanded.

 o handleAdjustmentEvent
protected void handleAdjustmentEvent(AdjustmentEvent event)
Handles adjustment events. This function will get called when the component recives a adjustment event. Override to change the way adjustment is handled.

Parameters:
event - the AdjustmentEvent
 o handleFocusGained
protected void handleFocusGained(FocusEvent event)
Handles focus gained events. This function will get called when the component recives a focus gained event. Override to change the way focus gained is handled.

Parameters:
event - the FocusEvent
See Also:
handleFocusLost
 o handleFocusLost
protected void handleFocusLost(FocusEvent event)
Handles focus lost events. This function will get called when the component recives a focus lost event. Override to change the way focus lost is handled.

Parameters:
event - the FocusEvent
See Also:
handleFocusGained
 o handleKeyPressed
protected void handleKeyPressed(KeyEvent event)
Handles key pressed events. This function will get called when the component recives a key pressed event. Override to change the way key pressed is handled.

Parameters:
event - the KeyEvent
 o handleMousePressed
protected void handleMousePressed(MouseEvent event)
Handles mouse pressed events. This function will get called when the component recives a mouse pressed event. Override to change the way mouse pressed is handled.

Parameters:
event - the MouseEvent
See Also:
handleMouseReleased
 o handleMouseReleased
protected void handleMouseReleased(MouseEvent event)
Handles mouse released events. This function will get called when the component recives a mouse released event. Override to change the way mouse released is handled.

Parameters:
event - the MouseEvent
See Also:
handleMousePressed
 o insert
public void insert(TreeNode newNode,
                   TreeNode relativeNode,
                   int position)
Inserts a new node relative to an existing node in the tree.

Parameters:
newNode - the new node to insert into the tree
relativeNode - the existing node used for a position reference
position - where to insert the new node relative to relativeNode. Legal values are CHILD, NEXT and LAST.
See Also:
CHILD, NEXT, LAST, append
 o isFocusTraversable
public boolean isFocusTraversable()
Overrides:
isFocusTraversable in class Component
 o minimumSize
public synchronized java.awt.Dimension minimumSize()
Note: minimumSize() is deprecated.

Overrides:
minimumSize in class Container
See Also:
getMinimumSize
 o newTreeNode
protected symantec.itools.awt.TreeNode newTreeNode(String text,
                                                   TreeView treeView)
Generates a new tree node. Override if you want to return your own instantiation of a TreeNode subclas.

Parameters:
text - the node text
treeView - a reference to the parent TreeView (usually "this").
Returns:
a new TreeNode
 o paint
public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Container
See Also:
repaint, update
 o parseTreeStructure
protected void parseTreeStructure(String[] tempStructure) throws InvalidTreeNodeException
Internal helper method. Process the given array of Strings, creating TreeNodes and appending them to this component. Existing TreeNodes are kept.

Parameters:
tempStructure - the String array to parse
Throws: InvalidTreeNodeException
if there is a problem with the String array values
 o preferredSize
public synchronized java.awt.Dimension preferredSize()
Note: preferredSize() is deprecated.

Overrides:
preferredSize in class Container
See Also:
getPreferredSize
 o printTree
public void printTree(TreeNode node)
Print out the text of each node in the TreeView beginning with the given node. The nodes are printed out one per line with no indenting.

Parameters:
node - the first node to print
 o printTree
public void printTree(TreeNode node,
                      boolean isIndented)
Print out the text of each node in the TreeView beginning with the given node.

Parameters:
node - the first node to print
isIndented, - if true, nodes will have hierarchical indenting, if false, all nodes will pe printed at the same level
 o recount
protected void recount()
Internal helper method. Rebuilds the Vector e of nodes, adjusting node depth and maintaining an overall count as it goes along. Calls the recursive method traverse to do the meat of the job.

 o redraw
public void redraw()
Lays out the vertical scrollbar as needed, then draws the TreeView into an offscreen image. This is used for cleaner refresh.

 o redraw
public void redraw(Graphics g)
Lays out the vertical scrollbar as needed, then draws the TreeView into an offscreen image. This is used for cleaner refresh.

Parameters:
g - the graphics object use for drawing
 o remove
public symantec.itools.awt.TreeNode remove(String s)
Removes the node with the given text from the TreeView. Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

Parameters:
s - the node text to find
Returns:
the TreeNode removed from this TreeView or null if not found
See Also:
remove(symantec.itools.awt.TreeNode), removeSelected
 o remove
public void remove(TreeNode node)
Removes the given node from the TreeView. Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

Parameters:
node - the node to remove
Returns:
the TreeNode removed from this TreeView or null if not found
See Also:
remove(java.lang.String), removeSelected
 o removeActionListener
public synchronized void removeActionListener(ActionListener l)
Removes the specified action listener so it no longer receives action events from this button.

Parameters:
l - the action listener
 o removeItemListener
public synchronized void removeItemListener(ItemListener l)
Removes an item listener.

This is a standard method of the ItemSelectable interface.

Parameters:
l - the listener being removed
See Also:
ItemEvent
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class Container
See Also:
addNotify
 o removeSelected
public void removeSelected()
Removes the currently selected node from the TreeView. Does not redraw the component. This allows you to call repeatedly without causing the component to flicker while nodes are manipulated. After all manipulation is done, repaint the tree.

See Also:
remove(symantec.itools.awt.TreeNode), remove(java.lang.String)
 o repaint
public void repaint(boolean f)
Repaints this component.

Parameters:
f - trueto re-vectorize if the node arrangement has changed
 o resetVector
protected void resetVector()
Internal helper method. Traverses tree to put nodes into vector v for internal processing. Depths of nodes are set, and viewCount and viewWidest is set. Calls the recursive method vectorize to do the meat of the job.

 o sendActionEvent
protected void sendActionEvent()
Sends an action performed event to any action listeners, as needed.

 o setLayout
public void setLayout(LayoutManager lm)
Takes no action. This is a standard Java AWT method which gets called to specify which layout manager should be used to layout the components in standard containers. Since layout managers CANNOT BE USED with this container the standard setLayout has been OVERRIDDEN for this container and does nothing.

Parameters:
lm - the layout manager to use to layout this container's components (IGNORED)
Overrides:
setLayout in class Container
See Also:
getLayout
 o setSelectedNode
public void setSelectedNode(TreeNode node)
Handles selecting the given node.

Parameters:
node - the node to select
 o setTreeStructure
public void setTreeStructure(String[] s)
Initializes the TreeView from a string array. There is one string for each node in the array. That string contains the text of the node indented with same number of leading spaces as the depth of that node in the tree.

Parameters:
s - the string array used for initialization. If null, the tree will be cleared.
See Also:
getTreeStructure
 o traverse
protected void traverse(TreeNode node)
Internal helper method. Recursive method that rebuilds the Vector e of nodes, adjusting node depth and maintaining an overall count as it goes along.

 o triggerRedraw
public void triggerRedraw()
Triggers redrawing the entire image, even if the size of the component has not changed.

 o update
public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to reduce flicker by eliminating the uneeded clearing of the background.

Parameters:
g - the graphics context
Overrides:
update in class Container
See Also:
repaint, paint
 o vectorize
protected void vectorize(TreeNode node,
                         boolean respectExpanded,
                         boolean repectHidden,
                         Vector nodeVector)
Internal helper method. Traverses tree to put nodes into the given vector for for processing. Depths of nodes are set.

Parameters:
node - the current node
respectExpanded - true to only follow expanded child links
repectHidden - true to not follow hidden child links
nodeVector - Vector to add the processed nodes to

All Packages  Class Hierarchy  This Package  Previous  Next  Index