de.cau.cs.kieler.core.ui.util
Class TreeViewerCheckStateHandler

java.lang.Object
  extended by de.cau.cs.kieler.core.ui.util.TreeViewerCheckStateHandler

public class TreeViewerCheckStateHandler
extends Object

Manages check states of checked tree viewers. When an item is checked, the check state manager goes up the hierarchy and updates the check state of the ancestors. (checked if all children are checked, grayed if some, but not all children are checked) Similarly, it goes down the hierarchy marking all children as checked.

If items should be checked programmatically, this should happen through the methods of this class to be able to update the ancestor and child elements. Since programmatically triggered changes on the check state of an element do not trigger events, the check state manager cannot cope with this on its own.

Rating yellow
2010-03-14 reviewed by haf, msp, pkl

Constructor Summary
TreeViewerCheckStateHandler(CheckboxTreeViewer treeViewer)
          Constructs a new instance managing the given tree viewer.
 
Method Summary
 void checkElement(Object element)
          Checks the given element, updating its ancestors and children in the process.
 void checkElements(Collection<?> elements)
          Checks the given elements, updating theirs ancestors and children in the process.
 void uncheckElement(Object element)
          Unchecks the given element, updating its ancestors and children in the process.
 void uncheckElements(Collection<?> elements)
          Unchecks the given elements, updating theirs ancestors and children in the process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeViewerCheckStateHandler

public TreeViewerCheckStateHandler(CheckboxTreeViewer treeViewer)
Constructs a new instance managing the given tree viewer.

Parameters:
treeViewer - the tree viewer to be managed.
Method Detail

checkElement

public void checkElement(Object element)
Checks the given element, updating its ancestors and children in the process.

Parameters:
element - the element to be checked.

checkElements

public void checkElements(Collection<?> elements)
Checks the given elements, updating theirs ancestors and children in the process.

Parameters:
elements - the elements to be checked.

uncheckElement

public void uncheckElement(Object element)
Unchecks the given element, updating its ancestors and children in the process.

Parameters:
element - the element to be unchecked.

uncheckElements

public void uncheckElements(Collection<?> elements)
Unchecks the given elements, updating theirs ancestors and children in the process.

Parameters:
elements - the elements to be unchecked.