T- The type of the elements contained within the TreeView TreeItem instances.
public class CheckBoxTreeCell<T> extends TreeCell<T>
TreeCellimplementation that draws a
CheckBoxnode inside the cell, along with support for common interactions (discussed in more depth shortly).
To make creating TreeViews with CheckBoxes easier, a convenience class
CheckBoxTreeItem is provided. It is highly recommended
that developers use this class, rather than the regular
class, when constructing their TreeView tree structures. Refer to the
CheckBoxTreeItem API documentation for an example on how these two classes
can be combined.
When used in a TreeView, the CheckBoxCell is rendered with a CheckBox to
the right of the 'disclosure node' (i.e. the arrow). The item stored in
TreeItem.getValue() will then have the StringConverter called
on it, and this text will take all remaining horizontal space. Additionally,
CheckBoxTreeItem, the TreeView will automatically handle
situations such as:
CheckBoxbeside an item that has children will result in all children also becoming selected/unselected.
CheckBoxbeside an item that has a parent will possibly toggle the state of the parent. For example, if you select a single child, the parent will become indeterminate (indicating partial selection of children). If you proceed to select all children, the parent will then show that it too is selected. This is recursive, with all parent nodes updating as expected.
CheckBoxTreeItemis not desirable, then it is necessary to call one of the constructors where a
Callbackis provided that can return an
ObservableValue<Boolean>should represent the boolean state of the given
Note that the CheckBoxTreeCell renders the CheckBox 'live', meaning that
the CheckBox is always interactive and can be directly toggled by the user.
This means that it is not necessary that the cell enter its
editing state (usually by the user double-clicking
on the cell). A side-effect of this is that the usual editing callbacks
on edit commit)
will not be called. If you want to be notified of changes,
it is recommended to directly observe the boolean properties that are
manipulated by the CheckBox.
|Type||Property and Description|
Property representing the