com.limegroup.gnutella.gui.options
Class OptionsTreeNode

java.lang.Object
  extended bycom.limegroup.gnutella.gui.options.OptionsTreeNode
All Implemented Interfaces:
javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

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

This class acts as a proxy and as a "decorator" for an underlying instance of a MutableTreeNode implementation.

This class includes the most of the functionality of a DefaultMutableTreeNode, which it simply wraps, without the coupling that directly subclassing DefaultMutableTreeNode would incur.


Method Summary
 void add(OptionsTreeNode newChild)
          Removes newChild from its parent and makes it a child of this node by adding it to the end of this node's child array.
 java.util.Enumeration children()
          Returns the children of the reciever as an Enumeration.
 boolean getAllowsChildren()
          Returns true if the receiver allows children.
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          Returns the child TreeNode at index childIndex.
 int getChildCount()
          Returns the number of children TreeNodes the receiver contains.
 int getIndex(javax.swing.tree.TreeNode node)
          Returns the index of node in the receivers children.
 javax.swing.tree.TreeNode getParent()
          Returns the parent TreeNode of the receiver.
 java.lang.String getTitleKey()
          Returns the String denoting both the title of the node as well as the unique identifying String for the node.
 void insert(javax.swing.tree.MutableTreeNode child, int index)
          Adds child to the receiver at index.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
 boolean isRoot()
          Returns true if the receiver is the root node.
 void remove(int index)
          Removes the child at index from the receiver.
 void remove(javax.swing.tree.MutableTreeNode node)
          Removes node from the receiver.
 void removeFromParent()
          Removes the receiver from its parent.
 void setParent(javax.swing.tree.MutableTreeNode newParent)
          Sets the parent of the receiver to newParent.
 void setUserObject(java.lang.Object object)
          Resets the user object of the receiver to object.
 java.lang.String toString()
          Defines the class' representation as a String object, used in determining how it is displayed in the JTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

add

public void add(OptionsTreeNode newChild)
Removes newChild from its parent and makes it a child of this node by adding it to the end of this node's child array.

Serves as a proxy for the add method of the wrapped DefaultMutableTreeNode instance.

Parameters:
newChild - node to add as a child of this node
Throws:
java.lang.IllegalArgumentException - if newChild is null
java.lang.IllegalStateException - if this node does not allow children

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Returns the child TreeNode at index childIndex.

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

getChildCount

public int getChildCount()
Returns the number of children TreeNodes the receiver contains.

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

getParent

public javax.swing.tree.TreeNode getParent()
Returns the parent TreeNode of the receiver.

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

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

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

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the receiver allows children.

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

isLeaf

public boolean isLeaf()
Returns true if the receiver is a leaf.

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

children

public java.util.Enumeration children()
Returns the children of the reciever as an Enumeration.

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

insert

public void insert(javax.swing.tree.MutableTreeNode child,
                   int index)
Adds child to the receiver at index. child will be messaged with setParent.

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

remove

public void remove(int index)
Removes the child at index from the receiver.

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

remove

public void remove(javax.swing.tree.MutableTreeNode node)
Removes node from the receiver. setParent will be messaged on node.

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

setUserObject

public void setUserObject(java.lang.Object object)
Resets the user object of the receiver to object.

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

removeFromParent

public void removeFromParent()
Removes the receiver from its parent.

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

setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)
Sets the parent of the receiver to newParent.

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

isRoot

public boolean isRoot()
Returns true if the receiver is the root node.


toString

public java.lang.String toString()
Defines the class' representation as a String object, used in determining how it is displayed in the JTree.

Returns:
the String identifier for the display of this class

getTitleKey

public java.lang.String getTitleKey()
Returns the String denoting both the title of the node as well as the unique identifying String for the node.