abbot.editor
Class ComponentNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by abbot.editor.ComponentNode
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode

public class ComponentNode
extends DefaultMutableTreeNode

Provides a JTree-compatible node model for displaying a given hierarchy.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
  ComponentNode(ComponentNode parent, Component comp)
           
  ComponentNode(ComponentNode parent, MenuComponent comp)
           
  ComponentNode(ComponentNode parent, MenuItem comp)
           
protected ComponentNode(ComponentNode parent, Object obj)
           
  ComponentNode(Hierarchy hierarchy)
          Constructor for the root node of a hierarchy.
 
Method Summary
 boolean equals(Object other)
          Return true if the represented components are the same.
 TreeNode getChildAt(int index)
           
 int getChildCount()
           
 Component getComponent()
          Returns the Component represented, or null if this is either the root or a java.awt.MenuComponent.
 ComponentNode getNode(Component comp)
          Return the nearest node corresponding to the given component.
(package private)  Component getParent(Component c)
          Return the component that appears as a parent in the ComponentNode hierarchy.
 TreePath getPath(Component comp)
          Return the TreePath for the given Component, assuming it is in the same hierarchy as this node.
 int hashCode()
           
 void reload()
           
 void reload(Hierarchy hierarchy)
           
 String toString()
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentNode

public ComponentNode(Hierarchy hierarchy)
Constructor for the root node of a hierarchy.


ComponentNode

protected ComponentNode(ComponentNode parent,
                        Object obj)

ComponentNode

public ComponentNode(ComponentNode parent,
                     Component comp)

ComponentNode

public ComponentNode(ComponentNode parent,
                     MenuComponent comp)

ComponentNode

public ComponentNode(ComponentNode parent,
                     MenuItem comp)
Method Detail

getChildAt

public TreeNode getChildAt(int index)
Specified by:
getChildAt in interface TreeNode
Overrides:
getChildAt in class DefaultMutableTreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface TreeNode
Overrides:
getChildCount in class DefaultMutableTreeNode

reload

public void reload()

reload

public void reload(Hierarchy hierarchy)

getParent

Component getParent(Component c)
Return the component that appears as a parent in the ComponentNode hierarchy.


getComponent

public Component getComponent()
Returns the Component represented, or null if this is either the root or a java.awt.MenuComponent.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Return true if the represented components are the same.

Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class DefaultMutableTreeNode

getNode

public ComponentNode getNode(Component comp)
Return the nearest node corresponding to the given component. Behavior is undefined if the node is not reachable from the root node. If the component is elided in the underlying hierarchy, returns the nearest parent node that is not elided.


getPath

public TreePath getPath(Component comp)
Return the TreePath for the given Component, assuming it is in the same hierarchy as this node. Returns as much of the ancestor path as is available in the hierarchy.



Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge