All Packages Class Hierarchy This Package Previous Next Index
Class symantec.itools.awt.TreeView2
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----symantec.itools.awt.TreeView2
- public class TreeView2
- extends Panel
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 TreeNode2 object is used for each heading.
- See Also:
- TreeNode2
-
CHILD
- Constant indicating that the new node is to be a child
of the existing node.
-
count
-
-
g1
- Offscreen graphics context used for buffering the painting process.
-
hasFocus
-
-
horizontalScrollBar
-
-
im1
- Offscreen Image used for buffering the painting process.
-
isSun1_1
-
-
LAST
- Constant indicating that the new node is to be the last
sibling of the existing node.
-
NEXT
- Constant indicating that the new node is to be the next
sibling of the existing node.
-
redrawTriggered
-
-
SEL_CHANGED
-
Deprecated.
-
treeChanged
-
-
verticalScrollBar
-
-
viewCount
-
-
TreeView2()
- Constructs an empty TreeView2.
-
TreeView2(TreeNode2)
- Constructs a TreeView2 with the given node.
-
append(TreeNode2)
- Adds a new node at root level.
-
changeSelection(TreeNode2)
-
-
clear()
-
-
drawTree()
- Draws the TreeView2 into an offscreen image.
-
exists(String)
- Determines if the node with the given text is in the TreeView2.
-
exists(TreeNode2)
- Determines if the given node is in the TreeView2.
-
focusLost(Event, Object)
-
-
getBgHilite()
-
Deprecated.
-
getCount()
- Returns the total number of nodes in the tree.
-
getFgHilite()
-
Deprecated.
-
getRootNode()
- Returns the "root" node.
-
getSelectedNode()
- Gets the currently selected node.
-
getSelectedObjects()
- Returns the selected items or null if no items are selected.
-
getSelectedText()
- Gets the text of the currently selected node.
-
getTreeStructure()
- Gets a string array that reflects the current TreeView2's contents.
-
getViewCount()
- Returns the total number of viewable nodes in the tree.
-
gotFocus(Event, Object)
-
-
handleEvent(Event)
-
-
insert(TreeNode2, TreeNode2, int)
- Inserts a new node relative to an existing node in the tree.
-
keyDown(Event, int)
- Processes KEY_PRESS and KEY_ACTION events.
-
minimumSize()
- Returns the minimum dimensions to properly display this component.
-
mouseDown(Event, int, int)
- Processes MOUSE_DOWN events.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
preferredSize()
- Returns the recommended dimensions to properly display this component.
-
printTree(TreeNode2)
- Print out the text of each node in the TreeView2 beginning with
the given node.
-
redraw()
- Lays out the vertical scrollbar as needed, then draws the TreeView2 into
an offscreen image.
-
redraw(Graphics)
-
-
remove(String)
- Removes the node with the given text from the TreeView2.
-
remove(TreeNode2)
- Removes the given node from the TreeView2.
-
removeSelected()
- Removes the currently selected node from the TreeView2.
-
sendActionEvent()
-
-
setBgHilite(Color)
-
Deprecated.
-
setFgHilite(Color)
-
Deprecated.
-
setLayout(LayoutManager)
- Takes no action.
-
setTreeStructure(String[])
- Initializes the TreeView2 from a string array.
-
triggerRedraw()
-
-
update(Graphics)
- Handles redrawing of this component on the screen.
CHILD
public static final int CHILD
- Constant indicating that the new node is to be a child
of the existing node.
- See Also:
- insert
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
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
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
verticalScrollBar
protected Scrollbar verticalScrollBar
count
protected int count
viewCount
protected int viewCount
horizontalScrollBar
protected Scrollbar horizontalScrollBar
isSun1_1
protected boolean isSun1_1
im1
protected Image im1
- Offscreen Image used for buffering the painting process.
g1
protected Graphics g1
- Offscreen graphics context used for buffering the painting process.
redrawTriggered
protected boolean redrawTriggered
treeChanged
protected boolean treeChanged
hasFocus
protected boolean hasFocus
TreeView2
public TreeView2()
- Constructs an empty TreeView2.
TreeView2
public TreeView2(TreeNode2 head)
- Constructs a TreeView2 with the given node.
- Parameters:
- head - the root node of the constructed tree
clear
public synchronized void clear()
setTreeStructure
public void setTreeStructure(String s[])
- Initializes the TreeView2 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
- See Also:
- getTreeStructure
getTreeStructure
public String[] getTreeStructure()
- Gets a string array that reflects the current TreeView2'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 TreeView2's contents
- See Also:
- setTreeStructure
setFgHilite
public void setFgHilite(Color c)
- Note: setFgHilite() is deprecated.
As of JDK version 1.1,
replaced by use of SystemColors.textHighlightText.
getFgHilite
public Color getFgHilite()
- Note: getFgHilite() is deprecated.
As of JDK version 1.1,
replaced by use of SystemColors.textHighlightText.
setBgHilite
public void setBgHilite(Color c)
- Note: setBgHilite() is deprecated.
As of JDK version 1.1,
replaced by use of SystemColors.textHighlight.
getBgHilite
public Color getBgHilite()
- Note: getBgHilite() is deprecated.
As of JDK version 1.1,
replaced by use of SystemColors.textHighlight.
getSelectedObjects
public Object[] getSelectedObjects()
- Returns the selected items or null if no items are selected.
This is a standard method of the ItemSelectable interface.
insert
public void insert(TreeNode2 newNode,
TreeNode2 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
getRootNode
public TreeNode2 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
getCount
public int getCount()
- Returns the total number of nodes in the tree.
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.
exists
public boolean exists(TreeNode2 node)
- Determines if the given node is in the TreeView2.
- Parameters:
- node - the node to check
- Returns:
- true if the node is in the TreeView2, false if it is not
- See Also:
- exists
exists
public boolean exists(String s)
- Determines if the node with the given text is in the TreeView2.
- Parameters:
- s - the node text to find
- Returns:
- true if the node is in the TreeView2, false if it is not
- See Also:
- exists
append
public void append(TreeNode2 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.
- Parameters:
- newNode - the new node to add
- See Also:
- insert
remove
public TreeNode2 remove(String s)
- Removes the node with the given text from the TreeView2.
- Parameters:
- s - the node text to find
- Returns:
- the TreeNode2 removed from this TreeView2 or null if not found
- See Also:
- remove, removeSelected
removeSelected
public void removeSelected()
- Removes the currently selected node from the TreeView2.
- See Also:
- remove, remove
remove
public void remove(TreeNode2 node)
- Removes the given node from the TreeView2.
- Parameters:
- node - the node to remove
- Returns:
- the TreeNode2 removed from this TreeView2 or null if not found
- See Also:
- remove, removeSelected
printTree
public void printTree(TreeNode2 node)
- Print out the text of each node in the TreeView2 beginning with
the given node.
The nodes are printed out one per line with no indenting.
- Parameters:
- node - the first node to print
handleEvent
public synchronized boolean handleEvent(Event event)
- Overrides:
- handleEvent in class Component
mouseDown
public boolean mouseDown(Event event,
int x,
int y)
- Processes MOUSE_DOWN events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a MOUSE_DOWN
event. These events occur when the mouse button is pressed while
inside this component.
- Parameters:
- event - the event
- x - the component-relative horizontal coordinate of the mouse
- y - the component-relative vertical coordinate of the mouse
- Returns:
- true if the event was handled
- Overrides:
- mouseDown in class Component
- See Also:
- mouseUp, handleEvent
keyDown
public boolean keyDown(Event event,
int key)
- Processes KEY_PRESS and KEY_ACTION events.
This is a standard Java AWT method which gets called by the AWT
method handleEvent() in response to receiving a KEY_PRESS or
KEY_ACTION event. These events occur when this component has the focus
and the user presses a "normal" or an "action" (F1, page up, etc) key.
- Parameters:
- event - the Event
- key - the key that was pressed
- Returns:
- true if the event was handled
- Overrides:
- keyDown in class Component
- See Also:
- keyUp, handleEvent
gotFocus
public boolean gotFocus(Event e,
Object what)
- Overrides:
- gotFocus in class Component
focusLost
public boolean focusLost(Event e,
Object what)
sendActionEvent
protected void sendActionEvent()
getSelectedNode
public TreeNode2 getSelectedNode()
- Gets the currently selected node.
- Returns:
- the currently selected node, or null if none selected
getSelectedText
public 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
changeSelection
protected void changeSelection(TreeNode2 node)
update
public synchronized 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
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
redraw
public void redraw()
- Lays out the vertical scrollbar as needed, then draws the TreeView2 into
an offscreen image. This is used for cleaner refresh.
redraw
public void redraw(Graphics g)
drawTree
public void drawTree()
- Draws the TreeView2 into an offscreen image. This is used for cleaner refresh.
preferredSize
public synchronized Dimension preferredSize()
- 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:
- preferredSize in class Container
- See Also:
- minimumSize
minimumSize
public synchronized Dimension minimumSize()
- 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:
- minimumSize in class Container
- See Also:
- preferredSize
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
triggerRedraw
protected void triggerRedraw()
All Packages Class Hierarchy This Package Previous Next Index