org.eclipse.actf.model.javapp.traverse
Class SwtTreeNodeWalker

java.lang.Object
  extended by org.eclipse.actf.model.traverse.AbstractNodeWalker
      extended by org.eclipse.actf.model.traverse.AbstractTreeNodeWalker
          extended by org.eclipse.actf.model.javapp.traverse.SwtTreeNodeWalker
All Implemented Interfaces:
INodeWalker, ITreeNodeWalker

public class SwtTreeNodeWalker
extends AbstractTreeNodeWalker

used to walk a tree of org.eclipse.swt.widgets.Composite nodes. If a node is an instance of org.eclipse.swt.widgets.Shell, the child shells of this node will not be included in the children returned. Thus, a call to hasChildren() that returns false does not mean that the particular element has no children at all.

Note: Composite objects that have org.eclipse.swt.widgets.Item children will have two children for each such Item object - one for the Item object itself and one for the Control object returned by getControl, should that item support this method.

Author:
Mike Squillace

Field Summary
 
Fields inherited from class org.eclipse.actf.model.traverse.AbstractTreeNodeWalker
clCache, componentBridgeMap, configuration
 
Fields inherited from class org.eclipse.actf.model.traverse.AbstractNodeWalker
nodeFilters
 
Constructor Summary
SwtTreeNodeWalker()
           
 
Method Summary
protected  Object[] addAssociatedControls(Object[] children)
           
protected  Object[] getAllChildren(Object element)
           
 Object[] getChildren(Object element)
          returns the children of the given node. For convenience, the menu of any control object is also counted as a child of that control.
protected  Object[] getItemChildren(Object element)
           
 Object getParent(Object element)
          return the parent of the given node.
protected  Object[] getShellChildren(Object element)
           
 Object[] getStartNodes()
          get the starting nodes of the graph.
 
Methods inherited from class org.eclipse.actf.model.traverse.AbstractTreeNodeWalker
getBridgedChild, getBridgedParent, getFilteredChildren, getFilteredSuccessorNodes, getPredecessorNodes, getSuccessorNodes, hasChildren, setComponentBridgeMap
 
Methods inherited from class org.eclipse.actf.model.traverse.AbstractNodeWalker
addNodeFilter, removeAllFilters, removeNodeFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.actf.model.traverse.INodeWalker
addNodeFilter, removeAllFilters, removeNodeFilter
 

Constructor Detail

SwtTreeNodeWalker

public SwtTreeNodeWalker()
Method Detail

getChildren

public Object[] getChildren(Object element)
                     throws InvalidComponentException
returns the children of the given node.

For convenience, the menu of any control object is also counted as a child of that control. Subsequent menu items that have menus as children will also be traversed by this method.

Parameters:
element - - node of tree
Returns:
children of given node or empty array if no children are found
Throws:
InvalidComponentException - if component is disposed or otherwise invalid

getParent

public Object getParent(Object element)
                 throws InvalidComponentException
return the parent of the given node.

Parameters:
element - - node of tree
Returns:
parent of given node or null if node has no parent
Throws:
InvalidComponentException - if component is disposed or otherwise invalid

getStartNodes

public Object[] getStartNodes()
get the starting nodes of the graph. These are the nodes of the graph that have no predecessors.

Returns:
starting nodes of graph

getAllChildren

protected Object[] getAllChildren(Object element)
                           throws InvalidComponentException
Throws:
InvalidComponentException

addAssociatedControls

protected Object[] addAssociatedControls(Object[] children)
                                  throws Exception
Throws:
Exception

getShellChildren

protected Object[] getShellChildren(Object element)

getItemChildren

protected Object[] getItemChildren(Object element)