| java.lang.Object javax.swing.tree.DefaultTreeSelectionModel com.jidesoft.swing.CheckBoxTreeSelectionModel
Method Summary | |
public void | addSelectionPaths(TreePath[] paths) Overrides the method in DefaultTreeSelectionModel to consider digIn mode. | public TreeModel | getModel() | public boolean | isDigIn() Gets the dig-in mode. | public boolean | isPartiallySelected(TreePath path) Tests whether there is any unselected node in the subtree of given path.
Parameters: path - check if the path is partially selected. | public boolean | isPathSelected(TreePath path, boolean digIn) Tells whether given path is selected. | public boolean | isSingleEventMode() | protected void | notifyPathChange(Vector changedPaths, TreePath oldLeadSelection) | protected void | notifyPathChange(TreePath[] changedPaths, boolean isNew, TreePath oldLeadSelection) Notifies listeners of a change in path. | public void | removeSelectionPaths(TreePath[] paths) | public void | setBatchMode(boolean batchMode) | public void | setDigIn(boolean digIn) Sets the dig-in mode. | public void | setModel(TreeModel model) | public void | setSelectionPaths(TreePath[] pPaths) Overrides the method in DefaultTreeSelectionModel to consider digIn mode. | public void | setSingleEventMode(boolean singleEventMode) Single event mode is a mode that always fires only one event when you select or unselect a tree node.
Taking this tree as an example,
A -- a
|- b
|- c
Case 1: Assuming b and c are selected at this point, you click on a.
- In non-single event mode, you will get select-A, deselect-b and deselect-c three events
- In single event mode, you will only get select-a.
Case 2: Assuming none of the nodes are selected, you click on A. | void | setTree(CheckBoxTree tree) |
CheckBoxTreeSelectionModel | public CheckBoxTreeSelectionModel(TreeModel model)(Code) | | |
CheckBoxTreeSelectionModel | public CheckBoxTreeSelectionModel(TreeModel model, boolean digIn)(Code) | | |
addSelectionPaths | public void addSelectionPaths(TreePath[] paths)(Code) | | Overrides the method in DefaultTreeSelectionModel to consider digIn mode.
Parameters: paths - the tree paths to be added to selection paths. |
isDigIn | public boolean isDigIn()(Code) | | Gets the dig-in mode. If the CheckBoxTree is in dig-in mode, checking the parent node
will check all the children. Correspondingly, getSelectionPaths() will only return the
parent tree path. If not in dig-in mode, each tree node can be checked or unchecked independently
true or false. |
isPartiallySelected | public boolean isPartiallySelected(TreePath path)(Code) | | Tests whether there is any unselected node in the subtree of given path.
Parameters: path - check if the path is partially selected. true i fpartially. Otherwise false. |
isPathSelected | public boolean isPathSelected(TreePath path, boolean digIn)(Code) | | Tells whether given path is selected. if dig is true,
then a path is assumed to be selected, if one of its ancestor is selected.
Parameters: path - check if the path is selected. Parameters: digIn - whether we will check its descendants. true if the path is selected. |
isSingleEventMode | public boolean isSingleEventMode()(Code) | | |
notifyPathChange | protected void notifyPathChange(Vector changedPaths, TreePath oldLeadSelection)(Code) | | |
notifyPathChange | protected void notifyPathChange(TreePath[] changedPaths, boolean isNew, TreePath oldLeadSelection)(Code) | | Notifies listeners of a change in path. changePaths should contain
instances of PathPlaceHolder.
Parameters: changedPaths - the paths that are changed. Parameters: isNew - is it a new path. Parameters: oldLeadSelection - the old selection. |
removeSelectionPaths | public void removeSelectionPaths(TreePath[] paths)(Code) | | |
setBatchMode | public void setBatchMode(boolean batchMode)(Code) | | |
setDigIn | public void setDigIn(boolean digIn)(Code) | | Sets the dig-in mode. If the CheckBoxTree is in dig-in mode, checking the parent node
will check all the children. Correspondingly, getSelectionPaths() will only return the
parent tree path. If not in dig-in mode, each tree node can be checked or unchecked independently
Parameters: digIn - true to enable dig-in mode. False to disable it. |
setSelectionPaths | public void setSelectionPaths(TreePath[] pPaths)(Code) | | Overrides the method in DefaultTreeSelectionModel to consider digIn mode.
Parameters: pPaths - the tree paths to be selected. |
setSingleEventMode | public void setSingleEventMode(boolean singleEventMode)(Code) | | Single event mode is a mode that always fires only one event when you select or unselect a tree node.
Taking this tree as an example,
A -- a
|- b
|- c
Case 1: Assuming b and c are selected at this point, you click on a.
- In non-single event mode, you will get select-A, deselect-b and deselect-c three events
- In single event mode, you will only get select-a.
Case 2: Assuming none of the nodes are selected, you click on A. In this case, both modes result in the same behavior.
- In non-single event mode, you will get only select-A event.
- In single event mode, you will only get select-A too.
Case 3: Assuming b and c are selected and now you click on A.
- In non-single event mode, you will get select-A event as well as deselect-b and deselect-c event.
- In single event mode, you will only get select-A.
As you can see, single event mode will always fire the event on the nodes you select. However it doesn't reflect
what really happened inside the selection model. So if you want to get
a complete picture of the selection state inside selection model, you should use
CheckBoxTreeSelectionModel.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.
Parameters: singleEventMode - true or false. |
|
|