Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ledestin.swing
Class SetTreeNode  view SetTreeNode download SetTreeNode.java

java.lang.Object
  extended byledestin.swing.SetTreeNode
All Implemented Interfaces:
javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class SetTreeNode
extends java.lang.Object
implements javax.swing.tree.MutableTreeNode

A tree node storing its children as a TreeSet.


Field Summary
private  java.util.TreeSet children
           
private  javax.swing.tree.MutableTreeNode parent
           
private  java.lang.String title
           
 
Constructor Summary
SetTreeNode(java.lang.String title)
           
SetTreeNode(java.lang.String title, javax.swing.tree.MutableTreeNode parent)
           
 
Method Summary
 java.util.Enumeration children()
          Returns an enumeration of the children of this node, or an empty enumeration if this node has no children.
 boolean getAllowsChildren()
          Returns true if this node allows children, and false otherwise.
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          Returns the child node at the given index.
 int getChildCount()
          Returns the number of children for this node.
 int getIndex(javax.swing.tree.TreeNode node)
          Returns the index of the specified child node, or -1 if the node is not in fact a child of this node.
 javax.swing.tree.TreeNode getParent()
          Returns the parent node for this tree node, or null if this node has no parent.
 void insert(javax.swing.tree.MutableTreeNode child, int index)
          Inserts a node as child at a given index.
 boolean isLeaf()
          Returns true if this node is a leaf node, and false otherwise.
 void remove(int index)
          Removes the child node a given index.
 void remove(javax.swing.tree.MutableTreeNode node)
          Removes a given child node.
 void removeFromParent()
          Removes this node from its parent.
 void setParent(javax.swing.tree.MutableTreeNode newParent)
          Sets the parent of the node.
 void setUserObject(java.lang.Object object)
          Sets a user object, the data represented by the node.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

children

private java.util.TreeSet children

parent

private javax.swing.tree.MutableTreeNode parent

title

private java.lang.String title
Constructor Detail

SetTreeNode

public SetTreeNode(java.lang.String title)

SetTreeNode

public SetTreeNode(java.lang.String title,
                   javax.swing.tree.MutableTreeNode parent)
Method Detail

children

public java.util.Enumeration children()
Description copied from interface: javax.swing.tree.TreeNode
Returns an enumeration of the children of this node, or an empty enumeration if this node has no children.

Specified by:
children in interface javax.swing.tree.TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Description copied from interface: javax.swing.tree.TreeNode
Returns true if this node allows children, and false otherwise.

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Description copied from interface: javax.swing.tree.TreeNode
Returns the child node at the given index.

Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getChildCount

public int getChildCount()
Description copied from interface: javax.swing.tree.TreeNode
Returns the number of children for this node.

Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Description copied from interface: javax.swing.tree.TreeNode
Returns the index of the specified child node, or -1 if the node is not in fact a child of this node.

Specified by:
getIndex in interface javax.swing.tree.TreeNode

getParent

public javax.swing.tree.TreeNode getParent()
Description copied from interface: javax.swing.tree.TreeNode
Returns the parent node for this tree node, or null if this node has no parent.

Specified by:
getParent in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Description copied from interface: javax.swing.tree.TreeNode
Returns true if this node is a leaf node, and false otherwise.

Specified by:
isLeaf in interface javax.swing.tree.TreeNode

insert

public void insert(javax.swing.tree.MutableTreeNode child,
                   int index)
Description copied from interface: javax.swing.tree.MutableTreeNode
Inserts a node as child at a given index.

Specified by:
insert in interface javax.swing.tree.MutableTreeNode

remove

public void remove(int index)
Description copied from interface: javax.swing.tree.MutableTreeNode
Removes the child node a given index.

Specified by:
remove in interface javax.swing.tree.MutableTreeNode

remove

public void remove(javax.swing.tree.MutableTreeNode node)
Description copied from interface: javax.swing.tree.MutableTreeNode
Removes a given child node.

Specified by:
remove in interface javax.swing.tree.MutableTreeNode

removeFromParent

public void removeFromParent()
Description copied from interface: javax.swing.tree.MutableTreeNode
Removes this node from its parent.

Specified by:
removeFromParent in interface javax.swing.tree.MutableTreeNode

setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)
Description copied from interface: javax.swing.tree.MutableTreeNode
Sets the parent of the node.

Specified by:
setParent in interface javax.swing.tree.MutableTreeNode

setUserObject

public void setUserObject(java.lang.Object object)
Description copied from interface: javax.swing.tree.MutableTreeNode
Sets a user object, the data represented by the node.

Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).