org.tbee.swing.tree
Class CheckTreeSelectionModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeSelectionModel
      extended by org.tbee.swing.tree.CheckTreeSelectionModel
All Implemented Interfaces:
Serializable, Cloneable, TreeSelectionModel

public class CheckTreeSelectionModel
extends DefaultTreeSelectionModel

JTree should have two selections: one is normal selection and another is checkSelection (checkbox selected) Why don't we use TreeSelectionModel to maintain checkSelection. But we can't use DefaultTreeSelection as-it-is without any changes. because we have to restrict the selection as explained in the above points: In our check selection model, it contains only the selected node but not all its descendants. i.e. let us say Node A has children B, C, D; When user checks Node A, the tree shows B, C and D also checked. But the selectionModel actually contains only A,

Version:
$Revision: 1.4 $
See Also:
Serialized Form

Field Summary
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class javax.swing.tree.DefaultTreeSelectionModel
changeSupport, leadIndex, leadPath, leadRow, listenerList, listSelectionModel, rowMapper, selection, SELECTION_MODE_PROPERTY, selectionMode
 
Fields inherited from interface javax.swing.tree.TreeSelectionModel
CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, SINGLE_TREE_SELECTION
 
Constructor Summary
CheckTreeSelectionModel(TreeModel model)
           
 
Method Summary
 void addSelectionPaths(TreePath[] paths)
           
 boolean isPartiallySelected(TreePath path)
           
 boolean isPathSelected(TreePath path, boolean dig)
           
 void removeSelectionPaths(TreePath[] paths)
           
 void setSelectionPaths(TreePath[] pPaths)
           
 
Methods inherited from class javax.swing.tree.DefaultTreeSelectionModel
addPropertyChangeListener, addSelectionPath, addTreeSelectionListener, arePathsContiguous, canPathsBeAdded, canPathsBeRemoved, clearSelection, clone, fireValueChanged, getLeadSelectionPath, getLeadSelectionRow, getListeners, getMaxSelectionRow, getMinSelectionRow, getPropertyChangeListeners, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionPaths, getSelectionRows, getTreeSelectionListeners, insureRowContinuity, insureUniqueness, isPathSelected, isRowSelected, isSelectionEmpty, notifyPathChange, removePropertyChangeListener, removeSelectionPath, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode, setSelectionPath, toString, updateLeadIndex
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

CheckTreeSelectionModel

public CheckTreeSelectionModel(TreeModel model)
Method Detail

isPartiallySelected

public boolean isPartiallySelected(TreePath path)

isPathSelected

public boolean isPathSelected(TreePath path,
                              boolean dig)

setSelectionPaths

public void setSelectionPaths(TreePath[] pPaths)
Specified by:
setSelectionPaths in interface TreeSelectionModel
Overrides:
setSelectionPaths in class DefaultTreeSelectionModel

addSelectionPaths

public void addSelectionPaths(TreePath[] paths)
Specified by:
addSelectionPaths in interface TreeSelectionModel
Overrides:
addSelectionPaths in class DefaultTreeSelectionModel

removeSelectionPaths

public void removeSelectionPaths(TreePath[] paths)
Specified by:
removeSelectionPaths in interface TreeSelectionModel
Overrides:
removeSelectionPaths in class DefaultTreeSelectionModel


Copyright © 2012 KnowledgePlaza. All Rights Reserved.