|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.alee.extended.tree.DefaultTreeCheckingModel<E>
public class DefaultTreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
Default checking model for WebCheckBoxTree.
Field Summary | |
---|---|
protected WebCheckBoxTree<E> |
checkBoxTree
Checkbox tree which uses this checking model. |
protected java.util.List<CheckStateChangeListener<E>> |
checkStateChangeListeners
Checkbox tree check state change listeners. |
protected java.util.Map<E,CheckState> |
nodeCheckStates
Node check states cache. |
Constructor Summary | |
---|---|
DefaultTreeCheckingModel(WebCheckBoxTree<E> checkBoxTree)
|
Method Summary | |
---|---|
void |
addCheckStateChangeListener(CheckStateChangeListener listener)
Adds check state change listener. |
void |
checkAll()
Checks all tree nodes. |
void |
checkingModeChanged(boolean recursive)
Notifies model about checking mode change. |
protected void |
filterOutChildNodes(java.util.List<E> nodes)
Filters out all nodes which are childs of other nodes presented in the list. |
void |
fireCheckStateChanged(java.util.List<CheckStateChange<E>> stateChanges)
Informs about single or multiply check state changes. |
protected java.util.List<E> |
getAllNodesForState(CheckState state,
boolean optimize)
Returns list of nodes for the specified state. |
WebCheckBoxTree<E> |
getCheckBoxTree()
Returns checkbox tree which uses this checking model. |
java.util.List<E> |
getCheckedNodes(boolean optimize)
Returns list of checked nodes. |
CheckState |
getCheckState(E node)
Returns specified tree node check state. |
java.util.List<E> |
getMixedNodes()
Returns list of nodes in mixed state. |
protected CheckState |
getNextState(CheckState checkState)
Returns next check state for check invertion action. |
void |
invertCheck(java.util.Collection<E> nodes)
Inverts tree nodes check. |
void |
invertCheck(E node)
Inverts tree node check. |
protected boolean |
isChildNode(E node,
E childOf)
Returns whether the specified node is a child of another node or some of its child nodes or not. |
void |
removeCheckStateChangeListener(CheckStateChangeListener listener)
Removes check state change listener. |
protected void |
repaintTreeNodes(java.util.List<E> nodes)
Repaints specified tree nodes. |
protected void |
repaintVisibleTreeRect()
Repaints visible tree rect. |
void |
setCheckBoxTree(WebCheckBoxTree<E> checkBoxTree)
Sets checkbox tree which uses this checking model. |
void |
setChecked(java.util.Collection<E> nodes,
boolean checked)
Sets specified nodes state to checked. |
void |
setChecked(E node,
boolean checked)
Sets whether the specified tree node is checked or not. |
protected void |
setCheckedImpl(E node,
boolean checked,
java.util.List<E> toUpdate,
java.util.List<CheckStateChange<E>> changes)
Sets whether the specified tree node is checked or not. |
void |
uncheckAll()
Unchecks all tree nodes. |
protected void |
updateChildNodesState(E node,
CheckState newState,
java.util.List<E> toUpdate,
java.util.List<CheckStateChange<E>> changes)
Updates child nodes check state. |
protected void |
updateNodeState(E node,
CheckState newState,
java.util.List<E> toUpdate)
Updates single node check state. |
protected void |
updateParentStates(E node,
java.util.List<E> toUpdate,
java.util.List<CheckStateChange<E>> changes)
Updates parent nodes check states. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected WebCheckBoxTree<E extends javax.swing.tree.DefaultMutableTreeNode> checkBoxTree
protected java.util.Map<E extends javax.swing.tree.DefaultMutableTreeNode,CheckState> nodeCheckStates
protected java.util.List<CheckStateChangeListener<E extends javax.swing.tree.DefaultMutableTreeNode>> checkStateChangeListeners
Constructor Detail |
---|
public DefaultTreeCheckingModel(WebCheckBoxTree<E> checkBoxTree)
checkBoxTree
- Method Detail |
---|
public WebCheckBoxTree<E> getCheckBoxTree()
public void setCheckBoxTree(WebCheckBoxTree<E> checkBoxTree)
checkBoxTree
- checkbox tree which uses this checking model.public java.util.List<E> getCheckedNodes(boolean optimize)
getCheckedNodes
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
optimize
- whether should optimize the resulting list by removing checked node childs or not
public java.util.List<E> getMixedNodes()
getMixedNodes
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
protected java.util.List<E> getAllNodesForState(CheckState state, boolean optimize)
state
- check stateoptimize
-
public void setChecked(java.util.Collection<E> nodes, boolean checked)
setChecked
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
nodes
- nodes to checkchecked
- whether the specified tree nodes should be checked or notpublic CheckState getCheckState(E node)
getCheckState
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
node
- tree node to process
public void setChecked(E node, boolean checked)
setChecked
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
node
- tree node to processchecked
- whether the specified tree node should be checked or notprotected void setCheckedImpl(E node, boolean checked, java.util.List<E> toUpdate, java.util.List<CheckStateChange<E>> changes)
node
- tree node to processchecked
- whether the specified tree node is checked or nottoUpdate
- list of nodes for later updatechanges
- protected void updateParentStates(E node, java.util.List<E> toUpdate, java.util.List<CheckStateChange<E>> changes)
node
- node to start checking parents fromtoUpdate
- list of nodes for later updatechanges
- protected void updateChildNodesState(E node, CheckState newState, java.util.List<E> toUpdate, java.util.List<CheckStateChange<E>> changes)
node
- parent nodenewState
- new check statetoUpdate
- list of nodes for later updatechanges
- protected void updateNodeState(E node, CheckState newState, java.util.List<E> toUpdate)
node
- node to updatenewState
- new check statetoUpdate
- list of nodes for later updatepublic void invertCheck(E node)
invertCheck
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
node
- tree node to processpublic void invertCheck(java.util.Collection<E> nodes)
invertCheck
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
nodes
- list of tree nodes to processpublic void uncheckAll()
uncheckAll
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
public void checkAll()
checkAll
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
protected CheckState getNextState(CheckState checkState)
checkState
- current check state
public void checkingModeChanged(boolean recursive)
checkingModeChanged
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
recursive
- whether checked or unchecked node childs should be checked or unchecked recursively or notprotected void filterOutChildNodes(java.util.List<E> nodes)
nodes
- list of nodes to filterprotected boolean isChildNode(E node, E childOf)
node
- node to processchildOf
- node to compare parent nodes with
protected void repaintVisibleTreeRect()
protected void repaintTreeNodes(java.util.List<E> nodes)
nodes
- tree nodes to repaintpublic void addCheckStateChangeListener(CheckStateChangeListener listener)
addCheckStateChangeListener
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
listener
- check state change listener to addpublic void removeCheckStateChangeListener(CheckStateChangeListener listener)
removeCheckStateChangeListener
in interface TreeCheckingModel<E extends javax.swing.tree.DefaultMutableTreeNode>
listener
- check state change listener to removepublic void fireCheckStateChanged(java.util.List<CheckStateChange<E>> stateChanges)
stateChanges
- check state changes list
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |