junit.extensions.jfcunit.tools
Class ComponentNode

java.lang.Object
  extended byjunit.extensions.jfcunit.tools.ComponentNode
All Implemented Interfaces:
javax.swing.tree.TreeNode

public class ComponentNode
extends java.lang.Object
implements javax.swing.tree.TreeNode

Tree node for the ComponentBrowser application.

Author:
Vijay Aravamudhan : ThoughtWorks Inc.

Field Summary
private  java.awt.Component m_component
          Component.
private  ComponentNode m_parent
          Parent node.
 
Constructor Summary
ComponentNode(ComponentNode parent, java.awt.Component comp)
          Constructor.
 
Method Summary
 java.util.Enumeration children()
          Get the children of this node.
 boolean equals(java.lang.Object other)
          Check equality.
 boolean getAllowsChildren()
          Can the node support children.
private  java.util.Vector getAllWindows()
          This method is used to build a Vector of all open windows (Frames) after filtering the ComponentBrowser window.
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          Get the specified child.
 int getChildCount()
          Get the number of children.
 java.awt.Component getComponent()
          Get the component held by this node of the tree.
 int getIndex(javax.swing.tree.TreeNode node)
          Get the index of the node given.
 javax.swing.tree.TreeNode getParent()
          Get the parent node.
 int hashCode()
          The hashCode of this node.
 boolean isLeaf()
          Is the node a leaf.
 java.lang.String toString()
          Generate a description of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_component

private java.awt.Component m_component
Component.


m_parent

private ComponentNode m_parent
Parent node.

Constructor Detail

ComponentNode

public ComponentNode(ComponentNode parent,
                     java.awt.Component comp)
Constructor.

Parameters:
parent - node of parent.
comp - Component to be held by the node.
Method Detail

getAllowsChildren

public boolean getAllowsChildren()
Can the node support children.

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Returns:
true if the node Component is a Container.

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Get the specified child.

Specified by:
getChildAt in interface javax.swing.tree.TreeNode
Parameters:
childIndex - The index of the child node to be returned.
Returns:
TreeNode The child node in the tree.

getChildCount

public int getChildCount()
Get the number of children.

Specified by:
getChildCount in interface javax.swing.tree.TreeNode
Returns:
int Number of children.

getComponent

public java.awt.Component getComponent()
Get the component held by this node of the tree.

Returns:
Component

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Get the index of the node given.

Specified by:
getIndex in interface javax.swing.tree.TreeNode
Parameters:
node - TreeNode for which the index should be given.
Returns:
int Returns the index of the node or -1 if the node is not found.

isLeaf

public boolean isLeaf()
Is the node a leaf.

Specified by:
isLeaf in interface javax.swing.tree.TreeNode
Returns:
boolean True if the node has no children.

getParent

public javax.swing.tree.TreeNode getParent()
Get the parent node.

Specified by:
getParent in interface javax.swing.tree.TreeNode
Returns:
TreeNode Reference to parent.

children

public java.util.Enumeration children()
Get the children of this node.

Specified by:
children in interface javax.swing.tree.TreeNode
Returns:
Enumeration of the children of type ComponentNode.

equals

public boolean equals(java.lang.Object other)
Check equality.

Parameters:
other - Object to be compared.
Returns:
boolean true if the objects are equal.

hashCode

public int hashCode()
The hashCode of this node.

Returns:
int hashCode of the referenced Component or 1 if no component is referenced (ex. Top of Tree).

toString

public java.lang.String toString()
Generate a description of the object.

Returns:
String description of this object.

getAllWindows

private java.util.Vector getAllWindows()
This method is used to build a Vector of all open windows (Frames) after filtering the ComponentBrowser window.

Returns:
Vector A list of all windows excluding the ComponentBrowser window


Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999