Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.ide.controls.tree
Class JMutableTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by oracle.ide.controls.tree.JMutableTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class JMutableTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements java.lang.Comparable

Extension of DefaultMutableTreeNode that provides support for the JTreeCell data structure.

See Also:
Serialized Form

Field Summary
protected  JTreeCellData _treeCellData
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
JMutableTreeNode()
          Creates a tree node that has no parent and no children, but which allows children.
JMutableTreeNode(JTreeCellData treeCellData)
          Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified tree cell data.
JMutableTreeNode(JTreeCellData treeCellData, boolean allowsChildren)
          Creates a tree node with no parent, no children, initialized with the specified tree cell data, and that allows children only if specified.
JMutableTreeNode(java.lang.String text)
          Creates a tree node with no parent, no children, but which allows children, and initializes it to contain a JTreeCellData object whose display string is the specified text.
 
Method Summary
 JMutableTreeNode add(JTreeCellData childNodeData)
          Convenience method where a new child node is added by specifying its data model.
 void ascendingUpdateNodes()
           
 int compareTo(JMutableTreeNode otherNode)
          Supports the Comparable implementation so that JMutableTreeNodes can be sorted using Collections.sort().
 int compareTo(java.lang.Object object)
           
 TriStateBoolean descendingUpdateNodes()
          Beginning with the given actionNode this method recurses down the sub-tree and updates the checked status of non-leaf checkboxes.
 JTreeCellData getModel()
          Returns the data model being used by this JMutableTreeNode.
 void selectDescendants(boolean b)
          Starting with this tree node, select it and all of its descendants according to the flag b.
 void setModel(JTreeCellData treeCellData)
          Sets the data model used by this JMutableTreeNode.
 void sortChildren()
          Sorts this node's children.
 void sortChildren(int recursionLevel)
          If the indicated recursion level is non-negative, this method sorts the JMutableTreeNode's children and then recurses the number of levels indicated to sort their children.
 void sortDescendents()
          Sorts all levels of the subtree represented by this JMutableTreeNode.
 JMutableTreeNode unselectSibling()
          Method to unselect the current selected sibling
 void updateNodes()
          Method that re-synchronizes non-leaf checkboxes with the states reflected in leaf checkboxes.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, 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, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_treeCellData

protected JTreeCellData _treeCellData
Constructor Detail

JMutableTreeNode

public JMutableTreeNode()
Creates a tree node that has no parent and no children, but which allows children.


JMutableTreeNode

public JMutableTreeNode(java.lang.String text)
Creates a tree node with no parent, no children, but which allows children, and initializes it to contain a JTreeCellData object whose display string is the specified text.


JMutableTreeNode

public JMutableTreeNode(JTreeCellData treeCellData)
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified tree cell data.


JMutableTreeNode

public JMutableTreeNode(JTreeCellData treeCellData,
                        boolean allowsChildren)
Creates a tree node with no parent, no children, initialized with the specified tree cell data, and that allows children only if specified.

Method Detail

compareTo

public int compareTo(java.lang.Object object)
Specified by:
compareTo in interface java.lang.Comparable

selectDescendants

public void selectDescendants(boolean b)
Starting with this tree node, select it and all of its descendants according to the flag b. If b is true, then nodes are selected (i.e. checked); otherwise, nodes are deselected (i.e. unchecked).

If the tree node is a radio button then it is enable or disabled because all the radio buttons within the group can't be selected. A typical usage of this method and related methods goes something like this:

    someNode.selectDescendants( true );
    someNode.updateNodes();
  
This example enables all descendants, skipping disabled nodes (and thus skipping the sub-tree under a disabled node), and then makes another pass to make sure that non-leaf nodes have the proper check mark (checked, half-checked, unchecked).


descendingUpdateNodes

public TriStateBoolean descendingUpdateNodes()
Beginning with the given actionNode this method recurses down the sub-tree and updates the checked status of non-leaf checkboxes. This method ignores the values held by non-leaf checkboxes in the process of making them consistent with the states set in leaf nodes. All checkboxes are updated whether they are enabled or not.

It is best not to invoke this method directly but to use one of the updateNodes() methods instead. This is because nodes closer to the root than actionNode are not updated.


ascendingUpdateNodes

public void ascendingUpdateNodes()

updateNodes

public void updateNodes()
Method that re-synchronizes non-leaf checkboxes with the states reflected in leaf checkboxes.


unselectSibling

public JMutableTreeNode unselectSibling()
Method to unselect the current selected sibling


compareTo

public int compareTo(JMutableTreeNode otherNode)
Supports the Comparable implementation so that JMutableTreeNodes can be sorted using Collections.sort().


add

public JMutableTreeNode add(JTreeCellData childNodeData)
Convenience method where a new child node is added by specifying its data model. A new instance of JMutableTreeNode is created and added.


getModel

public JTreeCellData getModel()
Returns the data model being used by this JMutableTreeNode.


setModel

public void setModel(JTreeCellData treeCellData)
Sets the data model used by this JMutableTreeNode.


sortChildren

public void sortChildren()
Sorts this node's children. No recursion.


sortChildren

public void sortChildren(int recursionLevel)
If the indicated recursion level is non-negative, this method sorts the JMutableTreeNode's children and then recurses the number of levels indicated to sort their children.


sortDescendents

public void sortDescendents()
Sorts all levels of the subtree represented by this JMutableTreeNode.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.