Spec-Zone .ru
спецификации, руководства, описания, API
|
public class CheckBoxTreeItem<T> extends TreeItem<T>
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<String>("Jonathan");
CheckBoxTreeItem<String> juliaGiles = new CheckBoxTreeItem<String>("Julia");
CheckBoxTreeItem<String> mattGiles = new CheckBoxTreeItem<String>("Matt");
CheckBoxTreeItem<String> sueGiles = new CheckBoxTreeItem<String>("Sue");
CheckBoxTreeItem<String> ianGiles = new CheckBoxTreeItem<String>("Ian");
CheckBoxTreeItem<String> gilesFamily = new CheckBoxTreeItem<String>("Giles Family");
gilesFamily.setExpanded(true);
gilesFamily.getChildren().addAll(jonathanGiles, juliaGiles, mattGiles, sueGiles, ianGiles);
// create the treeView
final TreeView<String> treeView = new TreeView<String>();
treeView.setRoot(gilesFamily);
// set the cell factory
treeView.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
CheckBoxTreeCell
,
TreeItem
,
CheckBox
Type | Property and Description |
---|---|
BooleanProperty |
independent
A
BooleanProperty used to represent the independent state of this CheckBoxTreeItem. |
BooleanProperty |
indeterminate
A
BooleanProperty used to represent the indeterminate state of this CheckBoxTreeItem. |
BooleanProperty |
selected
A
BooleanProperty used to represent the selected state of this CheckBoxTreeItem. |
Modifier and Type | Class and Description |
---|---|
static class |
CheckBoxTreeItem.TreeModificationEvent<T>
A TreeModificationEvent class that works in a similar vein to the
TreeItem.TreeModificationEvent class, in that
this event will bubble up the CheckBoxTreeItem hierarchy, until the parent
node is null. |
Constructor and Description |
---|
CheckBoxTreeItem()
Creates an empty CheckBoxTreeItem.
|
CheckBoxTreeItem(T value)
Creates a CheckBoxTreeItem with the value property set to the provided
object.
|
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(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
selectedProperty() set to the provided boolean value. |
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
selectedProperty() set to the provided boolean value, and
the initial state of the independent
property to the provided boolean value. |
Modifier and Type | Method and Description |
---|---|
static <T> EventType<CheckBoxTreeItem.TreeModificationEvent<T>> |
checkBoxSelectionChangedEvent()
An EventType used when the CheckBoxTreeItem selection / indeterminate
state changes.
|
BooleanProperty |
independentProperty()
A
BooleanProperty used to represent the independent state of this CheckBoxTreeItem. |
BooleanProperty |
indeterminateProperty()
A
BooleanProperty used to represent the indeterminate state of this CheckBoxTreeItem. |
java.lang.Boolean |
isIndependent()
Gets the value of the property independent.
|
java.lang.Boolean |
isIndeterminate()
Returns the indeterminate state of this CheckBoxTreeItem.
|
java.lang.Boolean |
isSelected()
Returns the selected state of this CheckBoxTreeItem.
|
BooleanProperty |
selectedProperty()
A
BooleanProperty used to represent the selected state of this CheckBoxTreeItem. |
void |
setIndependent(java.lang.Boolean value)
Sets the value of the property independent.
|
void |
setIndeterminate(java.lang.Boolean value)
Sets the indeterminate state of this CheckBoxTreeItem.
|
void |
setSelected(java.lang.Boolean value)
Sets the selected state of this CheckBoxTreeItem.
|
addEventHandler, branchCollapsedEvent, branchExpandedEvent, buildEventDispatchChain, childrenModificationEvent, expandedProperty, getChildren, getGraphic, getParent, getValue, graphicChangedEvent, graphicProperty, isExpanded, isLeaf, leafProperty, nextSibling, nextSibling, parentProperty, previousSibling, previousSibling, removeEventHandler, setExpanded, setGraphic, setValue, toString, treeItemCountChangeEvent, treeNotificationEvent, valueChangedEvent, valueProperty
public final BooleanProperty selectedProperty
BooleanProperty
used to represent the selected state of this CheckBoxTreeItem.isSelected()
,
setSelected(Boolean)
public final BooleanProperty indeterminateProperty
BooleanProperty
used to represent the indeterminate state of this CheckBoxTreeItem.isIndeterminate()
,
setIndeterminate(Boolean)
public final BooleanProperty independentProperty
BooleanProperty
used to represent the independent state of this CheckBoxTreeItem.
The independent state is used to represent whether changes to a single
CheckBoxTreeItem should influence the state of its parent and children.
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.
isIndependent()
,
setIndependent(Boolean)
public CheckBoxTreeItem()
public CheckBoxTreeItem(T value)
value
- The object to be stored as the value of this TreeItem.public CheckBoxTreeItem(T value, Node graphic)
value
- The object to be stored as the value of this CheckBoxTreeItem.graphic
- The Node to show in the TreeView next to this CheckBoxTreeItem.public CheckBoxTreeItem(T value, Node graphic, boolean selected)
selectedProperty()
set to the provided boolean value.value
- The object to be stored as the value of this CheckBoxTreeItem.graphic
- The Node to show in the TreeView next to this CheckBoxTreeItem.selected
- The initial value of the
selected
property.public CheckBoxTreeItem(T value, Node graphic, boolean selected, boolean independent)
selectedProperty()
set to the provided boolean value, and
the initial state of the independent
property to the provided boolean value.value
- The object to be stored as the value of this CheckBoxTreeItem.graphic
- The Node to show in the TreeView next to this CheckBoxTreeItem.selected
- The initial value of the
selected
property.independent
- The initial value of the
independent
propertypublic static <T> EventType<CheckBoxTreeItem.TreeModificationEvent<T>> checkBoxSelectionChangedEvent()
T
- The type of the value contained within the TreeItem.public final void setSelected(java.lang.Boolean value)
public final java.lang.Boolean isSelected()
public final BooleanProperty selectedProperty()
BooleanProperty
used to represent the selected state of this CheckBoxTreeItem.isSelected()
,
setSelected(Boolean)
public final void setIndeterminate(java.lang.Boolean value)
public final java.lang.Boolean isIndeterminate()
public final BooleanProperty indeterminateProperty()
BooleanProperty
used to represent the indeterminate state of this CheckBoxTreeItem.isIndeterminate()
,
setIndeterminate(Boolean)
public final BooleanProperty independentProperty()
BooleanProperty
used to represent the independent state of this CheckBoxTreeItem.
The independent state is used to represent whether changes to a single
CheckBoxTreeItem should influence the state of its parent and children.
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.
isIndependent()
,
setIndependent(Boolean)
public final void setIndependent(java.lang.Boolean value)
BooleanProperty
used to represent the independent state of this CheckBoxTreeItem.
The independent state is used to represent whether changes to a single
CheckBoxTreeItem should influence the state of its parent and children.
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.
public final java.lang.Boolean isIndependent()
BooleanProperty
used to represent the independent state of this CheckBoxTreeItem.
The independent state is used to represent whether changes to a single
CheckBoxTreeItem should influence the state of its parent and children.
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.
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to