CheckBoxTreeCell installed.
A CheckBoxTreeItem can be independent or
dependent. By default, CheckBoxTreeItem instances are dependent, which means
that any changes to the selection state of a TreeItem will have an impact on
parent and children CheckBoxTreeItem instances. If a CheckBoxTreeItem is
set to be independent, this means that any changes to that CheckBoxTreeItem
will not directly impact the state of parent and children CheckBoxTreeItem
instances.
The indeterminate property is used to
represent the same concept as that in CheckBox#indeterminateProperty(),
namely, that the CheckBox is neither selected or unselected. This is commonly
used inside a TreeView when some, but not all, of a branches children are
selected.
A simple example of using the CheckBoxTreeItem class, in conjunction with
CheckBoxTreeCell is shown below:
// create the tree model
CheckBoxTreeItem<String> jonathanGiles = new CheckBoxTreeItem<>("Jonathan");
CheckBoxTreeItem<String> juliaGiles = new CheckBoxTreeItem<>("Julia");
CheckBoxTreeItem<String> mattGiles = new CheckBoxTreeItem<>("Matt");
CheckBoxTreeItem<String> sueGiles = new CheckBoxTreeItem<>("Sue");
CheckBoxTreeItem<String> ianGiles = new CheckBoxTreeItem<>("Ian");
CheckBoxTreeItem<String> gilesFamily = new CheckBoxTreeItem<>("Giles Family");
gilesFamily.setExpanded(true);
gilesFamily.getChildren().addAll(jonathanGiles, juliaGiles, mattGiles, sueGiles, ianGiles);
// create the treeView
final TreeView<String> treeView = new TreeView<>();
treeView.setRoot(gilesFamily);
// set the cell factory
treeView.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
CheckBoxTreeCell, TreeItem, CheckBox
| Modifier and Type | Class and Description |
|---|---|
| public static class | CheckBoxTreeItem.
The type of the value contained within the
T>value property.A TreeModificationEvent class that works in a similar vein to the
|
| Modifier and Type | Field and Description |
|---|---|
| private static final EventType | |
| private final BooleanProperty | |
| private final BooleanProperty | |
| private final BooleanProperty | |
| private final ChangeListener | |
| private static boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CheckBoxTreeItem(T
The object to be stored as the value of this TreeItem. value)Creates a CheckBoxTreeItem with the value property set to the provided object. |
| public | CheckBoxTreeItem(T
The object to be stored as the value of this CheckBoxTreeItem. value, Node The Node to show in the TreeView next to this CheckBoxTreeItem. graphic)Creates a CheckBoxTreeItem with the value property set to the provided object, and the graphic set to the provided Node. |
| public | CheckBoxTreeItem(T
The object to be stored as the value of this CheckBoxTreeItem. value, Node The Node to show in the TreeView next to this CheckBoxTreeItem. graphic, boolean The initial value of the
selected)selected property.Creates a CheckBoxTreeItem with the value property set to the provided
object, the graphic set to the provided Node, and the initial state
of the |
| public | CheckBoxTreeItem(T
The object to be stored as the value of this CheckBoxTreeItem. value, Node The Node to show in the TreeView next to this CheckBoxTreeItem. graphic, boolean The initial value of the
selected, boolean selected property.The initial value of the
independent)independent propertyCreates a CheckBoxTreeItem with the value property set to the provided
object, the graphic set to the provided Node, the initial state
of the |
| Modifier and Type | Method and Description |
|---|---|
| public static < The type of the value contained within the TreeItem. T> EventType | Returns: the EventType used when the CheckBoxTreeItem selection / indeterminate state changesAn EventType used when the CheckBoxTreeItem selection / indeterminate state changes. |
| private void | |
| public final BooleanProperty | Returns: the independent state property of this CheckBoxTreeItemA |
| public final BooleanProperty | Returns: the indeterminate state property of this CheckBoxTreeItemA |
| public final boolean | |
| public final boolean | Returns: true if CheckBoxTreeItem is indeterminate stateReturns the indeterminate state of this CheckBoxTreeItem. |
| public final boolean | Returns: true if CheckBoxTreeItem is selectedReturns the selected state of this CheckBoxTreeItem. |
| public final BooleanProperty | Returns: the selected state property of this CheckBoxTreeItemA |
| public final void | |
| public final void | setIndeterminate(boolean
the indeterminate state of this CheckBoxTreeItem value)Sets the indeterminate state of this CheckBoxTreeItem. |
| public final void | setSelected(boolean
the selected state of this CheckBoxTreeItem value)Sets the selected state of this CheckBoxTreeItem. |
| private void | |
| private void | |
| private void |
| CHECK_BOX_SELECTION_CHANGED_EVENT | back to summary |
|---|---|
| private static final EventType<? extends Event> CHECK_BOX_SELECTION_CHANGED_EVENT | |
| independent | back to summary |
|---|---|
| private final BooleanProperty independent | |
| indeterminate | back to summary |
|---|---|
| private final BooleanProperty indeterminate | |
| selected | back to summary |
|---|---|
| private final BooleanProperty selected | |
| stateChangeListener | back to summary |
|---|---|
| private final ChangeListener<Boolean> stateChangeListener | |
| updateLock | back to summary |
|---|---|
| private static boolean updateLock | |
| CheckBoxTreeItem | back to summary |
|---|---|
| public CheckBoxTreeItem() Creates an empty CheckBoxTreeItem. | |
| CheckBoxTreeItem | back to summary |
|---|---|
| public CheckBoxTreeItem(T value) Creates a CheckBoxTreeItem with the value property set to the provided object.
| |
| CheckBoxTreeItem | back to summary |
|---|---|
| public CheckBoxTreeItem(T value, Node graphic) Creates a CheckBoxTreeItem with the value property set to the provided object, and the graphic set to the provided Node.
| |
| CheckBoxTreeItem | back to summary |
|---|---|
| public CheckBoxTreeItem(T value, Node graphic, boolean selected) Creates a CheckBoxTreeItem with the value property set to the provided
object, the graphic set to the provided Node, and the initial state
of the | |
| CheckBoxTreeItem | back to summary |
|---|---|
| public CheckBoxTreeItem(T value, Node graphic, boolean selected, boolean independent) Creates a CheckBoxTreeItem with the value property set to the provided
object, the graphic set to the provided Node, the initial state
of the
| |
| checkBoxSelectionChangedEvent | back to summary |
|---|---|
| public static <T> EventType An EventType used when the CheckBoxTreeItem selection / indeterminate state changes. To use this, it is recommended that you use code along the lines of the following:
| |
| fireEvent | back to summary |
|---|---|
| private void fireEvent(CheckBoxTreeItem<T> item, boolean selectionChanged) | |
| independentProperty | back to summary |
|---|---|
| public final BooleanProperty independentProperty() A By default, the independent property is false, which means that when a CheckBoxTreeItem has state changes to the selected or indeterminate properties, the state of related CheckBoxTreeItems will possibly be changed. If the independent property is set to true, the state of related CheckBoxTreeItems will never change.
| |
| indeterminateProperty | back to summary |
|---|---|
| public final BooleanProperty indeterminateProperty() A
| |
| isIndependent | back to summary |
|---|---|
| public final boolean isIndependent() | |
| isIndeterminate | back to summary |
|---|---|
| public final boolean isIndeterminate() Returns the indeterminate state of this CheckBoxTreeItem.
| |
| isSelected | back to summary |
|---|---|
| public final boolean isSelected() Returns the selected state of this CheckBoxTreeItem.
| |
| selectedProperty | back to summary |
|---|---|
| public final BooleanProperty selectedProperty() A
| |
| setIndependent | back to summary |
|---|---|
| public final void setIndependent(boolean value) | |
| setIndeterminate | back to summary |
|---|---|
| public final void setIndeterminate(boolean value) Sets the indeterminate state of this CheckBoxTreeItem.
| |
| setSelected | back to summary |
|---|---|
| public final void setSelected(boolean value) Sets the selected state of this CheckBoxTreeItem.
| |
| updateDownwards | back to summary |
|---|---|
| private void updateDownwards() | |
| updateState | back to summary |
|---|---|
| private void updateState() | |
| updateUpwards | back to summary |
|---|---|
| private void updateUpwards() | |
value property.
javafx.scene.control.TreeItem.TreeModificationEvent class, in that
this event will bubble up the CheckBoxTreeItem hierarchy, until the parent
node is null.
| Modifier and Type | Field and Description |
|---|---|
| public static final EventType | ANY
Hides javafx. |
| private final boolean | |
| private static final long | |
| private final transient CheckBoxTreeItem |
| Access | Constructor and Description |
|---|---|
| public | TreeModificationEvent(EventType<? extends Event>
the eventType eventType, CheckBoxTreeItem<T> the treeItem treeItem, boolean represents whether the selection has changed selectionChanged)Creates a default TreeModificationEvent instance to represent the change in selection/indeterminate states for the given CheckBoxTreeItem instance. |
| Modifier and Type | Method and Description |
|---|---|
| public CheckBoxTreeItem | Returns: The CheckBoxTreeItem that this event occurred upon.Returns the CheckBoxTreeItem that this event occurred upon. |
| public boolean | Returns: has the CheckBoxTreeItem's indeterminate changedIndicates the reason for this event is that the indeterminate state on the CheckBoxTreeItem changed (as opposed to it becoming selected or unselected). |
| public boolean | Returns: has the CheckBoxTreeItem's selection changedIndicates the reason for this event is that the selection on the CheckBoxTreeItem changed (as opposed to it becoming indeterminate). |
| ANY | back to summary |
|---|---|
| public static final EventType<Event> ANY Hides javafx. Common supertype for all tree modification event types. | |
| selectionChanged | back to summary |
|---|---|
private final boolean selectionChanged
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| treeItem | back to summary |
|---|---|
| private final transient CheckBoxTreeItem<T> treeItem | |
| TreeModificationEvent | back to summary |
|---|---|
| public TreeModificationEvent(EventType<? extends Event> eventType, CheckBoxTreeItem<T> treeItem, boolean selectionChanged) Creates a default TreeModificationEvent instance to represent the change in selection/indeterminate states for the given CheckBoxTreeItem instance.
| |
| getTreeItem | back to summary |
|---|---|
| public CheckBoxTreeItem Returns the CheckBoxTreeItem that this event occurred upon.
| |
| wasIndeterminateChanged | back to summary |
|---|---|
| public boolean wasIndeterminateChanged() Indicates the reason for this event is that the indeterminate state on the CheckBoxTreeItem changed (as opposed to it becoming selected or unselected).
| |
| wasSelectionChanged | back to summary |
|---|---|
| public boolean wasSelectionChanged() Indicates the reason for this event is that the selection on the CheckBoxTreeItem changed (as opposed to it becoming indeterminate).
| |