|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.tree.DefaultTreeSelectionModel
com.jidesoft.swing.CheckBoxTreeSelectionModel
public class CheckBoxTreeSelectionModel
CheckBoxTreeSelectionModel is a selection _model based on DefaultTreeSelectionModel and use in
CheckBoxTree to keep track of the checked tree paths.
| Field Summary | |
|---|---|
protected Set<TreePath> |
_pathHasAdded
Used in areSiblingsSelected(javax.swing.tree.TreePath) for those paths pending added so that they are not
in the selection model right now. |
| 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 | |
|---|---|
CheckBoxTreeSelectionModel(TreeModel model)
|
|
CheckBoxTreeSelectionModel(TreeModel model,
boolean digIn)
|
|
| Method Summary | |
|---|---|
void |
addSelectionPaths(TreePath[] paths)
Overrides the method in DefaultTreeSelectionModel to consider digIn mode. |
protected void |
addSelectionPaths(TreePath[] paths,
boolean needCheckPathSelection)
Add the selection paths. |
protected boolean |
areSiblingsSelected(TreePath path)
tells whether all siblings of given path are selected. |
protected Object |
getChild(Object node,
int i)
Get the child of node in the designated index. |
protected int |
getChildrenCount(Object node)
Get the children count |
TreeModel |
getModel()
|
boolean |
isDigIn()
Gets the dig-in mode. |
protected boolean |
isParentActuallySelected(TreePath path,
TreePath parent)
Check if the parent path is really selected. |
boolean |
isPartiallySelected(TreePath path)
Tests whether there is any unselected node in the subtree of given path. |
boolean |
isPathSelected(TreePath path)
|
boolean |
isPathSelected(TreePath path,
boolean digIn)
Tells whether given path is selected. |
boolean |
isRowSelected(int row)
|
boolean |
isSingleEventMode()
|
protected void |
notifyPathChange(TreePath[] changedPaths,
boolean isNew,
TreePath oldLeadSelection)
Notifies listeners of a change in path. |
protected void |
notifyPathChange(Vector changedPaths,
TreePath oldLeadSelection)
|
void |
removeSelectionPaths(TreePath[] paths)
|
void |
removeSelectionPaths(TreePath[] paths,
boolean doFireEvent)
|
void |
setBatchMode(boolean batchMode)
|
void |
setDigIn(boolean digIn)
Sets the dig-in mode. |
void |
setModel(TreeModel model)
|
void |
setSelectionPaths(TreePath[] pPaths)
Overrides the method in DefaultTreeSelectionModel to consider digIn mode. |
void |
setSingleEventMode(boolean singleEventMode)
Single event mode is a mode that always fires only one event when you select or deselect a tree node. |
void |
treeNodesChanged(TreeModelEvent e)
|
void |
treeNodesInserted(TreeModelEvent e)
|
void |
treeNodesRemoved(TreeModelEvent e)
|
void |
treeStructureChanged(TreeModelEvent e)
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Set<TreePath> _pathHasAdded
areSiblingsSelected(javax.swing.tree.TreePath) for those paths pending added so that they are not
in the selection model right now.
| Constructor Detail |
|---|
public CheckBoxTreeSelectionModel(TreeModel model)
public CheckBoxTreeSelectionModel(TreeModel model,
boolean digIn)
| Method Detail |
|---|
public TreeModel getModel()
public void setModel(TreeModel model)
public boolean isDigIn()
public void setDigIn(boolean digIn)
digIn - true to enable dig-in mode. False to disable it.public boolean isPartiallySelected(TreePath path)
path - check if the path is partially selected.
public boolean isRowSelected(int row)
isRowSelected in interface TreeSelectionModelisRowSelected in class DefaultTreeSelectionModel
protected boolean isParentActuallySelected(TreePath path,
TreePath parent)
path - the original path to be checkedparent - the parent part which is closest to the original path and is selected
public boolean isPathSelected(TreePath path)
isPathSelected in interface TreeSelectionModelisPathSelected in class DefaultTreeSelectionModel
public boolean isPathSelected(TreePath path,
boolean digIn)
path - check if the path is selected.digIn - whether we will check its descendants.
protected void notifyPathChange(Vector changedPaths,
TreePath oldLeadSelection)
notifyPathChange in class DefaultTreeSelectionModelpublic void setSelectionPaths(TreePath[] pPaths)
setSelectionPaths in interface TreeSelectionModelsetSelectionPaths in class DefaultTreeSelectionModelpPaths - the tree paths to be selected.public void addSelectionPaths(TreePath[] paths)
addSelectionPaths in interface TreeSelectionModeladdSelectionPaths in class DefaultTreeSelectionModelpaths - the tree paths to be added to selection paths.
protected void addSelectionPaths(TreePath[] paths,
boolean needCheckPathSelection)
paths - the paths to be addedneedCheckPathSelection - the flag to indicating if the path selection should be checked to improve performanceprotected boolean areSiblingsSelected(TreePath path)
path - the tree path
public void removeSelectionPaths(TreePath[] paths)
removeSelectionPaths in interface TreeSelectionModelremoveSelectionPaths in class DefaultTreeSelectionModel
public void removeSelectionPaths(TreePath[] paths,
boolean doFireEvent)
protected Object getChild(Object node,
int i)
node - the parent nodei - the child index
protected int getChildrenCount(Object node)
node - the parent node
public boolean isSingleEventMode()
public void setSingleEventMode(boolean singleEventMode)
A -- a
|- b
|- c
Case 1: Assuming b and c are selected at this point, you click on a. DefaultTreeSelectionModel.getSelectionPaths() to
find out. In non-single event mode, the events reflect what happened inside the selection model. So you can get a
complete picture of the exact state without asking the selection model. The downside is it will generate too many
events. With this option, you can decide which mode you want to use that is the best for your case.
By default, singleEventMode is set to false to be compatible with the older versions that don't have this
option.
singleEventMode - true or false.
protected void notifyPathChange(TreePath[] changedPaths,
boolean isNew,
TreePath oldLeadSelection)
changedPaths - the paths that are changed.isNew - is it a new path.oldLeadSelection - the old selection.public void setBatchMode(boolean batchMode)
public void treeNodesChanged(TreeModelEvent e)
treeNodesChanged in interface TreeModelListenerpublic void treeNodesInserted(TreeModelEvent e)
treeNodesInserted in interface TreeModelListenerpublic void treeNodesRemoved(TreeModelEvent e)
treeNodesRemoved in interface TreeModelListenerpublic void treeStructureChanged(TreeModelEvent e)
treeStructureChanged in interface TreeModelListener
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||