qflib 0.98.1

de.qfs.lib.gui
Class AWTTreeAdapter

java.lang.Object
  |
  +--de.qfs.lib.tree.IndexBasedTreeAdapter
        |
        +--de.qfs.lib.gui.AWTTreeAdapter
All Implemented Interfaces:
TreeAdapter

public class AWTTreeAdapter
extends IndexBasedTreeAdapter

This is a TreeAdapter for the AWT Component hierarchy. It assumes that all nodes passed are Components. It takes special care of JMenus, which violate the standard AWT tree structure.

Since:
0.98.1
Version:
$Revision: 1.1 $
Author:
Gregor Schmid

Inner classes inherited from class de.qfs.lib.tree.IndexBasedTreeAdapter
IndexBasedTreeAdapter.ChildEnumeration
 
Constructor Summary
AWTTreeAdapter()
           
 
Method Summary
 int getChildCount(java.lang.Object parent)
          Get the number of children of a node.
 java.lang.Object getChildNode(java.lang.Object parent, int index)
          Get a child of a node.
 int getIndexOfChildNode(java.lang.Object parent, java.lang.Object child)
          Get the index of a child in a node's list of children.
 java.lang.Object getParentNode(java.lang.Object child)
          Get the parent of a node.
 boolean isLeaf(java.lang.Object node)
          Query whether a node is a leaf.
 
Methods inherited from class de.qfs.lib.tree.IndexBasedTreeAdapter
getChildren, getFirstChildNode, getLastChildNode, getNextSibling, getPreviousSibling, isEnumerationBased, isIndexBased, isLinkBased
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AWTTreeAdapter

public AWTTreeAdapter()
Method Detail

getParentNode

public java.lang.Object getParentNode(java.lang.Object child)
Get the parent of a node.
Parameters:
child - The node to query for the parent.
Returns:
The parent of the node.

isLeaf

public boolean isLeaf(java.lang.Object node)
Query whether a node is a leaf.
Parameters:
node - The node to query.
Returns:
True if the node is a leaf.

getChildCount

public int getChildCount(java.lang.Object parent)
Get the number of children of a node.
Parameters:
parent - The node to query.
Returns:
The number of children of the node.

getChildNode

public java.lang.Object getChildNode(java.lang.Object parent,
                                     int index)
                              throws java.lang.IndexOutOfBoundsException
Get a child of a node.
Parameters:
parent - The node to query.
index - The index of the child.
Returns:
The child at the index.
Throws:
java.lang.IndexOutOfBoundsException - If the index is invalid.

getIndexOfChildNode

public int getIndexOfChildNode(java.lang.Object parent,
                               java.lang.Object child)
Get the index of a child in a node's list of children.
Parameters:
parent - The node to query.
child - The child to look for.
Returns:
The index of the child or -1 if it is not a child of this node.

qflib 0.98.1