Class CheckableTreeItem


  • public class CheckableTreeItem
    extends Object
    Class for representing tree item, that supports checkable state. Each tree item (or node) of a tree can be checkable or not. Since CheckboxTreeViewer does not support to hide checkboxes on some items, this additional tree structure has been created.
    See Also:
    CheckableTreeViewer
    • Constructor Detail

      • CheckableTreeItem

        public CheckableTreeItem​(boolean checkable)
        Initializes new checkable tree item instance, using checkable input parameter. Also allows child multi selection.
        Parameters:
        checkable - - determines, whether current item can be checked or not.
      • CheckableTreeItem

        public CheckableTreeItem​(boolean checkable,
                                 boolean allowChildMultiSelect)
        Initializes new checkable tree item instance.
        Parameters:
        checkable - - determines, whether current item can be checked or not.
        allowChildMultiSelect - - determines, whether it is allowed to select multiple items from children of current item
    • Method Detail

      • getParent

        public CheckableTreeItem getParent()
        Returns:
        the parent of current object, can be null
      • setParent

        public void setParent​(CheckableTreeItem parent)
        Sets parent of current object, can be null
        Parameters:
        parent - - the parent to set
      • addChild

        public void addChild​(CheckableTreeItem childItem)
        Adds new child to current tree item
        Parameters:
        childItem -
      • getValue

        public Object getValue()
        Returns:
        model object
      • setValue

        public void setValue​(Object value)
        Parameters:
        value - - model object to set
      • hasChildren

        public boolean hasChildren()
        Checks whether current object has children
        Returns:
        true if current object has children, false otherwise
      • isChecked

        public boolean isChecked()
        Returns current state of the element
        Returns:
        true if item is checked, false otherwise
      • setChecked

        public void setChecked​(boolean isChecked)
        Changes checked state of current element
        Parameters:
        true - if item is checked, false otherwise
      • setOppositeCheckedState

        public void setOppositeCheckedState()
        Changes checked state of current element
        Parameters:
        true - if item is checked, false otherwise
      • isCheckable

        public boolean isCheckable()
        Returns:
        true if current item can be checkable, false otherwise
      • allowChildMultiSelection

        public boolean allowChildMultiSelection()
        Determines whether multiple child elements can be selected.
        Returns:
        true if multiple child elements can be selected, false otherwise