public class SourceTreeNode extends javax.swing.tree.DefaultMutableTreeNode implements java.lang.Comparable<SourceTreeNode>
AbstractSourceTree. They can be
sorted and filtered based on user input.AbstractSourceTree,
Serialized Form| Constructor and Description |
|---|
SourceTreeNode(java.lang.Object userObject)
Creates an unsorted tree node.
|
SourceTreeNode(java.lang.Object userObject,
boolean sorted)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(javax.swing.tree.MutableTreeNode child)
Overridden to ensure the new child is only made visible if it is
matched by the current filter.
|
java.util.Enumeration<javax.swing.tree.TreeNode> |
children()
Overridden to operate over visible children only.
|
java.lang.Object |
clone()
Returns a clone of this tree node.
|
SourceTreeNode |
cloneWithChildren()
Returns a clone of this tree node and all of its children.
|
int |
compareTo(SourceTreeNode stn2)
Overridden to provide proper sorting of source tree nodes when the
parent
AbstractSourceTree is sorted. |
protected void |
filter(java.util.regex.Pattern pattern)
Filters the children of this tree node based on the specified prefix.
|
javax.swing.tree.TreeNode |
getChildAfter(javax.swing.tree.TreeNode child)
Overridden to operate over visible children only.
|
javax.swing.tree.TreeNode |
getChildAt(int index)
Overridden to operate over visible children only.
|
javax.swing.tree.TreeNode |
getChildBefore(javax.swing.tree.TreeNode child)
Overridden to operate over visible children only.
|
int |
getChildCount()
Overridden to operate over visible children only.
|
int |
getIndex(javax.swing.tree.TreeNode child)
Overridden to operate over visible children only.
|
int |
getSortPriority()
Returns the relative priority of this node against others when being
sorted (lower is higher priority).
|
boolean |
isSortable()
Returns whether this particular node's children can be sorted.
|
boolean |
isSorted()
Returns whether this node is sorted.
|
void |
refresh() |
void |
setSortable(boolean sortable)
Sets whether this particular node's children are sortable.
|
void |
setSorted(boolean sorted)
Sets whether this tree node (and any child sortable tree nodes) are
sorting their children.
|
void |
setSortPriority(int priority)
Sets the relative sort priority of this tree node when it is compared
against others (lower is higher priority).
|
breadthFirstEnumeration, depthFirstEnumeration, getAllowsChildren, getDepth, getFirstChild, getFirstLeaf, 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, toStringpublic SourceTreeNode(java.lang.Object userObject)
userObject - The user data for this tree node.public SourceTreeNode(java.lang.Object userObject,
boolean sorted)
userObject - The user data for this tree node.sorted - Whether any child nodes added to this one should be
sorted.public void add(javax.swing.tree.MutableTreeNode child)
add in class javax.swing.tree.DefaultMutableTreeNodechild - The child node to add.public java.util.Enumeration<javax.swing.tree.TreeNode> children()
children in interface javax.swing.tree.TreeNodechildren in class javax.swing.tree.DefaultMutableTreeNodepublic java.lang.Object clone()
clone in class javax.swing.tree.DefaultMutableTreeNodecloneWithChildren()public SourceTreeNode cloneWithChildren()
clone()public int compareTo(SourceTreeNode stn2)
AbstractSourceTree is sorted. Sorting is done first
by priority, and nodes with equal priority are then sorted by their
string representations, ignoring case. Subclasses can override this
method if they wish to do more intricate sorting.compareTo in interface java.lang.Comparable<SourceTreeNode>stn2 - A tree node to compare to.protected void filter(java.util.regex.Pattern pattern)
pattern - The pattern that the child nodes must match. If this is
null, all possible children are shown.public javax.swing.tree.TreeNode getChildAfter(javax.swing.tree.TreeNode child)
getChildAfter in class javax.swing.tree.DefaultMutableTreeNodechild - The child node.null
if none.public javax.swing.tree.TreeNode getChildAt(int index)
getChildAt in interface javax.swing.tree.TreeNodegetChildAt in class javax.swing.tree.DefaultMutableTreeNodeindex - The index of the visible child to retrieve.public javax.swing.tree.TreeNode getChildBefore(javax.swing.tree.TreeNode child)
getChildBefore in class javax.swing.tree.DefaultMutableTreeNodechild - The child node.null
if none.public int getChildCount()
getChildCount in interface javax.swing.tree.TreeNodegetChildCount in class javax.swing.tree.DefaultMutableTreeNodepublic int getIndex(javax.swing.tree.TreeNode child)
getIndex in interface javax.swing.tree.TreeNodegetIndex in class javax.swing.tree.DefaultMutableTreeNodechild - The child node.-1 is returned.public int getSortPriority()
setSortPriority(int)public boolean isSortable()
setSortable(boolean)public boolean isSorted()
public void refresh()
public void setSortable(boolean sortable)
sortable - Whether this node's children are sortable.isSortable()public void setSorted(boolean sorted)
sorted - Whether sorting is enabled.isSorted()public void setSortPriority(int priority)
priority - The relative priority.getSortPriority()