borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.control 

TreeControl component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.ScrollPane
                           +----borland.jbcl.view.TreeView
                                   +----borland.jbcl.control.TreeControl

About the TreeControl component

Variables  Constructors  Properties  Methods  Event Listeners

Implements GraphModel, WritableGraphModel, BlackBox, GraphView, MenuContainer, ImageObserver, Serializable

The TreeControl component displays a hierarchical list of items (nodes), such as the headings of a document, the entries in an index, or the directories and files on a disk. Each node (except the root node, or origin of the tree) has a parent node from which it descends. It may or may not have one or more sibling nodes (descendants from the same parent) and one or more children nodes (descendants from itself). By clicking on the graphic beside a node, the user can expand and collapse the associated list of sub-nodes (children). Nodes in a TreeControl are of type LinkedTreeNode

Use the style() method to select from a list of platform-specific display styles. The selection property is the currently selected node.

TreeControl is a composite component that instantiates a default graph data model (BasicTreeContainer), item painter (SelectableTextItemPainter), and view manager (BasicViewManager).

You can show both text and a graphic on each TreeControl node, to create a basic file-manager directory tree with folder images and strings showing the directories. The default item viewer (SelectableTextItemViewer) won't work for this. You need a CompositeItemViewer made up of a ImageItemViewer (or StateImageItemViewer to show open and closed folders) and a SelectableTextItemViewer. You can use these classes with the TreeControl and LinkedTreeContainer. To use TreeControl, drop it in the UI Designer. Everything else for such composite nodes needs to be coded.

Here are some sample uses of tree (data):


  TreeControl tree = new TreeControl();

  GraphLocation root = tree.setRoot("Monkey");
                root = tree.setRoot(new Color(234, 234, 22));
                root = tree.setRoot(myCustomClassThingie);

  GraphLocation node = tree.addChild(root, "Monkies");
                node = tree.addChild(root, new Color(24, 4, 2));
                node = tree.addChild(myCustomClassThingie2);

  GraphLocation found = tree.find("Monkies");
  System.out.println("This should print out 'Monkies' = " + tree.get(found));

  System.out.println("A node's value : " + tree.get(node));
  System.out.println("Der root : " + tree.get(tree.getRoot()));

TreeControl variables

Variables implemented in borland.jbcl.view.TreeView

Variables implemented in java.awt.Component

Variables implemented in java.awt.ScrollPane

TreeControl constructors

TreeControl properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.TreeView

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.awt.ScrollPane

Properties implemented in java.lang.Object

TreeControl methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.TreeView

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.ScrollPane

Methods implemented in java.lang.Object

TreeControl event listeners


TreeControl constructors

TreeControl()

  public TreeControl()
Constructs an empty TreeControl with default property values.


TreeControl properties

model

 public void setModel(borland.jbcl.model.GraphModel model)

Checks for recursive model creation, then calls super.setModel(model), which is borland.jbcl.view.TreeView.setModel().

root

 public GraphLocation getRoot()

Returns the root node for this graph. Uses getRoot() of the GraphModel.

variableSize

 public boolean isVariableSize()

Uses isVariableSize() of the WriteableGraphModel to check whether the tree control can have items inserted.


TreeControl event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

 public void addActionListener(java.awt.event.ActionListener l)
 public void removeActionListener(java.awt.event.ActionListener l)

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener l)
 public synchronized void removeComponentListener(java.awt.event.ComponentListener l)

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener l)
 public void removeContainerListener(java.awt.event.ContainerListener l)

focus

 public void addFocusListener(java.awt.event.FocusListener l)
 public void removeFocusListener(java.awt.event.FocusListener l)

key

 public void addKeyListener(java.awt.event.KeyListener l)
 public void removeKeyListener(java.awt.event.KeyListener l)

model

 public void addModelListener(borland.jbcl.model.GraphModelListener listener)
 public void removeModelListener(borland.jbcl.model.GraphModelListener listener)

mouse

 public void addMouseListener(java.awt.event.MouseListener l)
 public void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

selection

 public void addSelectionListener(borland.jbcl.model.GraphSelectionListener listener)
 public void removeSelectionListener(borland.jbcl.model.GraphSelectionListener listener)

subfocus

 public void addSubfocusListener(borland.jbcl.model.GraphSubfocusListener l)
 public void removeSubfocusListener(borland.jbcl.model.GraphSubfocusListener l)

tree

 public void addTreeListener(borland.jbcl.view.TreeListener l)
 public void removeTreeListener(borland.jbcl.view.TreeListener l)