public abstract class AbstractCheckBoxTreeModel extends AbstractTreeModel implements CheckBoxTreeModel
CheckBoxTreeModel which maintains the checkbox state and fires changes events more or less optimally.
Clients are expected to populate the tree with implementations of AbstractCheckBoxTreeModel.CheckBoxNode. The root node is provided by overriding {#link #getRoot()}. The methods of AbstractCheckBoxTreeModel.CheckBoxNode that are typically overridden are AbstractCheckBoxTreeModel.CheckBoxNode.getChildren(), AbstractCheckBoxTreeModel.CheckBoxNode.isLeaf(), and AbstractCheckBoxTreeModel.CheckBoxNode.getLabel(). Rarely, AbstractCheckBoxTreeModel.CheckBoxNode.setState(boolean), and AbstractCheckBoxTreeModel.CheckBoxNode.getState() might be overridden for leaf nodes.
| Modifier and Type | Class and Description | 
|---|---|
protected class  | 
AbstractCheckBoxTreeModel.CheckBoxNode<T extends AbstractCheckBoxTreeModel.CheckBoxNode>  | 
listenerList| Constructor and Description | 
|---|
AbstractCheckBoxTreeModel()  | 
| Modifier and Type | Method and Description | 
|---|---|
java.lang.String | 
convertValueToText(java.lang.Object node)
Gets the label text for an object in this tree. 
 | 
java.lang.Object | 
getChild(java.lang.Object parent, int index)  | 
int | 
getChildCount(java.lang.Object parent)  | 
int | 
getIndexOfChild(java.lang.Object parent, java.lang.Object child)  | 
abstract java.lang.Object | 
getRoot()  | 
java.lang.Boolean | 
getState(java.lang.Object node)
Gets the selection state of an object in this tree. 
 | 
boolean | 
isLeaf(java.lang.Object node)  | 
protected void | 
resetStateOfParents(javax.swing.tree.TreePath path)
Resets the state of parents to reflect the change of the  
AbstractCheckBoxTreeModel.CheckBoxNode at the specified path and fires events for any resulting changes. | 
protected boolean | 
setStateOfSubtree(javax.swing.tree.TreePath parent, AbstractCheckBoxTreeModel.CheckBoxNode node, boolean newState)
Sets the state of the  
AbstractCheckBoxTreeModel.CheckBoxNode subtree at the specified path and fires events for any resulting changes. | 
void | 
stateForPathChanged(javax.swing.tree.TreePath path, boolean newState)
Sets the selection state of an object in this tree. 
 | 
void | 
valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)  | 
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeStructureChanged, getListeners, getTreeModelListeners, removeTreeModelListenerpublic abstract java.lang.Object getRoot()
getRoot in interface javax.swing.tree.TreeModel
public java.lang.Object getChild(java.lang.Object parent,
                        int index)
getChild in interface javax.swing.tree.TreeModelpublic int getChildCount(java.lang.Object parent)
getChildCount in interface javax.swing.tree.TreeModel
public int getIndexOfChild(java.lang.Object parent,
                  java.lang.Object child)
getIndexOfChild in interface javax.swing.tree.TreeModelpublic boolean isLeaf(java.lang.Object node)
isLeaf in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath path,
                       java.lang.Object newValue)
valueForPathChanged in interface javax.swing.tree.TreeModelpublic java.lang.Boolean getState(java.lang.Object node)
CheckBoxTreeModelGets Boolean.TRUE or Boolean.FALSE if the object is selected or unselected, respectively, and null if it is neither (e.g., if it is not a leaf node and some but not all of its children are selected).
getState in interface CheckBoxTreeModel
public void stateForPathChanged(javax.swing.tree.TreePath path,
                       boolean newState)
treeNodesChanged events for any objects in the tree for which the selection state actually changes.
The default AbstractCheckBoxTreeModel implementation invokes setStateOfSubtree(javax.swing.tree.TreePath, oracle.jdevimpl.audit.swing.AbstractCheckBoxTreeModel.CheckBoxNode, boolean) for the specified path and if the selection state for that path changes as a result, it then invokes resetStateOfParents(javax.swing.tree.TreePath) for the specified path.
stateForPathChanged in interface CheckBoxTreeModelpath - path to the object whose state was changed by the user.newState - the new state from the user.protected void resetStateOfParents(javax.swing.tree.TreePath path)
AbstractCheckBoxTreeModel.CheckBoxNode at the specified path and fires events for any resulting changes. If children are added after the tree is initially constructed, or if a leaf node of the model changes state for a cause other than stateForPathChanged(javax.swing.tree.TreePath, boolean), this is the appropriate method to call to refresh the tree to reflect the change.
protected boolean setStateOfSubtree(javax.swing.tree.TreePath parent,
                        AbstractCheckBoxTreeModel.CheckBoxNode node,
                        boolean newState)
AbstractCheckBoxTreeModel.CheckBoxNode subtree at the specified path and fires events for any resulting changes.AbstractCheckBoxTreeModel.CheckBoxNode at the specified path actually changed.public java.lang.String convertValueToText(java.lang.Object node)
The default AbstractCheckBoxTreeModel implementation delegates to the getLabel method of the CheckBoxNode object.
convertValueToText in interface CheckBoxTreeModel