net.sf.tm.plugin
Class TreeNode

java.lang.Object
  extended bynet.sf.tm.plugin.TreeNode

public class TreeNode
extends Object

Tree model for use with JFace TreeViewer. The class is an adapter class containing the original object in the content field. A TreeNode can have a parent TreeNode. If it is a root node the parent must be null.

Version:
$Id: TreeNode.java,v 1.3 2004/03/28 16:23:06 apataki Exp $
Author:
Andreas Pataki

Constructor Summary
TreeNode(Object newContent)
          Constructor.
TreeNode(Object newContent, TreeNode newParent)
          Constructor.
 
Method Summary
 boolean equals(Object obj)
          Delegates the equals method to the contained content object.
 Object getContent()
          Getter for the field content.
 TreeNode getParent()
          Getter for the field parent.
 int hashCode()
          Returns the hashCode of the contained content object.
 String toString()
          Delegates the toString call to the content object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeNode

public TreeNode(Object newContent)
Constructor. The content will get stored in the content field. The parent will get set to null.

Parameters:
newContent - The actual content object.

TreeNode

public TreeNode(Object newContent,
                TreeNode newParent)
Constructor.

Parameters:
newContent - The actual content object. Will get stored in the content field.
newParent - The parent TreeNode object.
Method Detail

getContent

public Object getContent()
Getter for the field content.

Returns:
content object

getParent

public TreeNode getParent()
Getter for the field parent.

Returns:
parent object or null if the node is a root node.

equals

public boolean equals(Object obj)
Delegates the equals method to the contained content object. This is necessary because otherwise the tree thinks that the objects have changed after a data update.

See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns the hashCode of the contained content object. Attention: This means the TreeNode has the same hash as his content!

See Also:
Object.hashCode()

toString

public String toString()
Delegates the toString call to the content object.

See Also:
Object.toString()


Copyright © 2003-2004 Andreas Pataki. All Rights Reserved.