public class SCPTreeRecord
extends java.lang.Object
implements java.lang.Comparable, javax.swing.tree.TreeNode
Instances of the SCPTreeRecord class represent
nodes in a tree of the SCPTree class, which in
turn is used by the SCPTreeBrowser class.
Each record represents a single name-value pair, with the value potentially empty (e.g. a container).
| Constructor and Description |
|---|
SCPTreeRecord(SCPTreeRecord parent,
int iname)
Construct a record for a named container, linking to the specied parent.
|
SCPTreeRecord(SCPTreeRecord parent,
int iname,
java.lang.String value)
Construct a record for a name-value pair linking to the specified parent.
|
SCPTreeRecord(SCPTreeRecord parent,
java.lang.String name)
Construct a record for a named container, linking to the specied parent.
|
SCPTreeRecord(SCPTreeRecord parent,
java.lang.String name,
java.lang.String value)
Construct a record for a name-value pair linking to the specified parent.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Enumeration |
children()
Returns the children of this node as an
Enumeration. |
int |
compareTo(java.lang.Object o) |
boolean |
equals(java.lang.Object o) |
boolean |
getAllowsChildren()
Always returns true, since children may always be added.
|
javax.swing.tree.TreeNode |
getChildAt(int index)
Returns the child at the specified index.
|
int |
getChildCount()
Return the number of children that this node contains.
|
int |
getIndex(javax.swing.tree.TreeNode child)
Returns the index of the specified child from amongst this node's children, if present.
|
javax.swing.tree.TreeNode |
getParent()
Returns the parent node of this node.
|
boolean |
isLeaf()
Returns true if the receiver is a leaf (has no children).
|
java.lang.String |
toString()
Dump the record as a string.
|
public SCPTreeRecord(SCPTreeRecord parent, java.lang.String name, java.lang.String value)
Construct a record for a name-value pair linking to the specified parent.
Adds the new node to the children of the parent node, keeping them sorted.
parent - parent recordname - the String name of this node (by which they are sorted)value - the String value of this nodepublic SCPTreeRecord(SCPTreeRecord parent, java.lang.String name)
Construct a record for a named container, linking to the specied parent.
Adds the new node to the children of the parent node, keeping them sorted.
parent - parent recordname - the String name of this node (by which they are sorted)public SCPTreeRecord(SCPTreeRecord parent, int iname, java.lang.String value)
Construct a record for a name-value pair linking to the specified parent.
Adds the new node to the children of the parent node, keeping them sorted.
parent - parent recordiname - the numeric name of this node (by which they are sorted)value - the String value of this nodepublic SCPTreeRecord(SCPTreeRecord parent, int iname)
Construct a record for a named container, linking to the specied parent.
Adds the new node to the children of the parent node, keeping them sorted.
parent - parent recordiname - the numeric name of this node (by which they are sorted)public java.lang.String toString()
Dump the record as a string.
toString in class java.lang.Objectpublic int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - public javax.swing.tree.TreeNode getParent()
Returns the parent node of this node.
getParent in interface javax.swing.tree.TreeNodepublic javax.swing.tree.TreeNode getChildAt(int index)
Returns the child at the specified index.
getChildAt in interface javax.swing.tree.TreeNodeindex - the index of the child to be returned, numbered from 0TreeNode at the specified indexpublic int getIndex(javax.swing.tree.TreeNode child)
Returns the index of the specified child from amongst this node's children, if present.
getIndex in interface javax.swing.tree.TreeNodechild - the child to search for amongst this node's childrenpublic boolean getAllowsChildren()
Always returns true, since children may always be added.
getAllowsChildren in interface javax.swing.tree.TreeNodepublic boolean isLeaf()
Returns true if the receiver is a leaf (has no children).
isLeaf in interface javax.swing.tree.TreeNodepublic int getChildCount()
Return the number of children that this node contains.
getChildCount in interface javax.swing.tree.TreeNodepublic java.util.Enumeration children()
Returns the children of this node as an Enumeration.
children in interface javax.swing.tree.TreeNode