T
- The type of the value contained within the
TreeItem
property.public class TreeCell<T> extends IndexedCell<T>
Cell
type used with the TreeView
control. In addition to
the API defined on IndexedCell
, the TreeCell
exposes additional states and pseudo classes for use by CSS.
A TreeCell watches the selection model of the TreeView for which it is
associated, ensuring that it visually indicates to the user whether it is
selected. When a TreeCell is selected, this is exposed both via the
selected
property, as well as via the 'selected'
CSS pseudo class state.
Due to the fact that TreeCell extends from IndexedCell
, each TreeCell
also provides an index
property. The index will be
updated as cells are expanded and collapsed, and therefore should be
considered a view index rather than a model index.
Finally, each TreeCell also has a reference back to the TreeView that it is being used with. Each TreeCell belongs to one and only one TreeView.
Type | Property and Description |
---|---|
<any> |
disclosureNode
The disclosure node is commonly seen represented as a triangle that rotates
on screen to indicate whether or not the TreeItem that it is placed
beside is expanded or collapsed.
|
<any> |
treeItem
Each TreeCell represents at most a single
TreeItem , which is
represented by this property. |
<any> |
treeView
A TreeCell is explicitly linked to a single
TreeView instance,
which is represented by this property. |
indexProperty
editableProperty, editingProperty, emptyProperty, itemProperty, selectedProperty
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, graphicProperty, graphicTextGapProperty, labelPaddingProperty, lineSpacingProperty, mnemonicParsingProperty, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, underlineProperty, wrapTextProperty
contextMenuProperty, skinClassNameProperty, skinProperty, tooltipProperty
Modifier and Type | Field and Description |
---|---|
private static PseudoClass |
COLLAPSED_PSEUDOCLASS_STATE |
private static java.lang.String |
DEFAULT_STYLE_CLASS
*
Stylesheet Handling *
*
|
private <any> |
disclosureNode |
private InvalidationListener |
editingListener |
private static PseudoClass |
EXPANDED_PSEUDOCLASS_STATE |
private InvalidationListener |
focusedListener |
private <any> |
focusModelPropertyListener
Listens to the focusModel property on the TreeView.
|
private boolean |
isFirstRun |
private InvalidationListener |
leafListener |
private boolean |
oldIsExpanded |
private InvalidationListener |
rootPropertyListener |
private <any> |
selectedListener
*
Callbacks and events *
*
|
private <any> |
selectionModelPropertyListener
Listens to the selectionModel property on the TreeView.
|
private <any> |
treeItem
*
Properties *
*
|
private InvalidationListener |
treeItemExpandedInvalidationListener |
private <any> |
treeView |
private boolean |
updateEditingIndex |
private WeakInvalidationListener |
weakEditingListener |
private WeakInvalidationListener |
weakFocusedListener |
private <any> |
weakFocusModelPropertyListener |
private WeakInvalidationListener |
weakLeafListener |
private WeakInvalidationListener |
weakRootPropertyListener |
private <any> |
weakSelectedListener |
private <any> |
weakSelectionModelPropertyListener |
private WeakInvalidationListener |
weakTreeItemExpandedInvalidationListener |
Constructor and Description |
---|
TreeCell()
Creates a default TreeCell instance.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelEdit()
Call this function to transition from an editing state into a non-editing
state, without saving any user input.
|
void |
commitEdit(T newValue)
Call this function when appropriate (based on the user interaction requirements
of your cell editing user interface) to do two things:
Fire the appropriate events back to the backing UI control (e.g.
|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
<any> |
disclosureNodeProperty()
The disclosure node is commonly seen represented as a triangle that rotates
on screen to indicate whether or not the TreeItem that it is placed
beside is expanded or collapsed.
|
void |
executeAccessibleAction(AccessibleAction action,
java.lang.Object... parameters) |
Node |
getDisclosureNode()
Returns the current disclosure node set in this TreeCell.
|
TreeItem<T> |
getTreeItem()
Returns the TreeItem currently set in this TreeCell.
|
TreeView<T> |
getTreeView()
Returns the TreeView associated with this TreeCell.
|
(package private) void |
indexChanged(int oldIndex,
int newIndex)
This method is called whenever the index is changed, regardless of whether
the new index is the same as the old index.
|
java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
void |
setDisclosureNode(Node value)
The node to use as the "disclosure" triangle, or toggle, used for
expanding and collapsing items.
|
private void |
setTreeItem(TreeItem<T> value) |
private void |
setTreeView(TreeView<T> value) |
void |
startEdit()
Call this function to transition from a non-editing state into an editing
state, if the cell is editable.
|
<any> |
treeItemProperty()
Each TreeCell represents at most a single
TreeItem , which is
represented by this property. |
<any> |
treeViewProperty()
A TreeCell is explicitly linked to a single
TreeView instance,
which is represented by this property. |
private void |
updateEditing() |
private void |
updateFocus() |
private void |
updateItem(int oldIndex) |
private void |
updateSelection() |
void |
updateTreeItem(TreeItem<T> treeItem)
Updates the TreeItem associated with this TreeCell.
|
void |
updateTreeView(TreeView<T> tree)
Updates the TreeView associated with this TreeCell.
|
getIndex, indexProperty, updateIndex
editableProperty, editingProperty, emptyProperty, getInitialFocusTraversable, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, layoutChildren, selectedProperty, setEditable, setItem, setSelected, updateItem, updateSelected
alignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getAlignment, getClassCssMetaData, getContentBias, getContentDisplay, getControlCssMetaData, getEllipsisString, getFont, getGraphic, getGraphicTextGap, getInitialAlignment, getLabelPadding, getLineSpacing, getText, getTextAlignment, getTextFill, getTextOverrun, graphicProperty, graphicTextGapProperty, isMnemonicParsing, isUnderline, isWrapText, labelPaddingProperty, lineSpacingProperty, mnemonicParsingProperty, setAlignment, setContentDisplay, setEllipsisString, setFont, setGraphic, setGraphicTextGap, setLineSpacing, setMnemonicParsing, setText, setTextAlignment, setTextFill, setTextOverrun, setUnderline, setWrapText, textAlignmentProperty, textFillProperty, textOverrunProperty, textProperty, toString, underlineProperty, wrapTextProperty
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getControlChildren, getCssMetaData, getSkin, getTooltip, isResizable, loadSkinClass, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
public final <any> treeItemProperty
TreeItem
, which is
represented by this property.public final <any> disclosureNodeProperty
getDisclosureNode()
,
setDisclosureNode(Node)
public final <any> treeViewProperty
TreeView
instance,
which is represented by this property.getTreeView()
private final <any> selectedListener
private final <any> selectionModelPropertyListener
private final InvalidationListener focusedListener
private final <any> focusModelPropertyListener
private final InvalidationListener editingListener
private final InvalidationListener leafListener
private boolean oldIsExpanded
private final InvalidationListener treeItemExpandedInvalidationListener
private final InvalidationListener rootPropertyListener
private final <any> weakSelectedListener
private final <any> weakSelectionModelPropertyListener
private final WeakInvalidationListener weakFocusedListener
private final <any> weakFocusModelPropertyListener
private final WeakInvalidationListener weakEditingListener
private final WeakInvalidationListener weakLeafListener
private final WeakInvalidationListener weakTreeItemExpandedInvalidationListener
private final WeakInvalidationListener weakRootPropertyListener
private <any> treeItem
private <any> disclosureNode
private <any> treeView
private boolean isFirstRun
private boolean updateEditingIndex
private static final java.lang.String DEFAULT_STYLE_CLASS
private static final PseudoClass EXPANDED_PSEUDOCLASS_STATE
private static final PseudoClass COLLAPSED_PSEUDOCLASS_STATE
public final TreeItem<T> getTreeItem()
public final <any> treeItemProperty()
TreeItem
, which is
represented by this property.public final void setDisclosureNode(Node value)
value
- the disclosure nodepublic final Node getDisclosureNode()
public final <any> disclosureNodeProperty()
getDisclosureNode()
,
setDisclosureNode(Node)
public final TreeView<T> getTreeView()
public final <any> treeViewProperty()
TreeView
instance,
which is represented by this property.getTreeView()
public void startEdit()
public void commitEdit(T newValue)
ListView
). This will begin the process of pushing this edit
back to the relevant data source / property (although it does not
guarantee that this will be successful - that is dependent upon the
specific edit commit handler being used). Refer to the UI control
class javadoc for more detail.In general there is no need to override this method in custom cell
implementations - it should be sufficient to simply call this method
when appropriate (e.g. when the user pressed the Enter key, you may do something
like cell.commitEdit(converter.fromString(textField.getText()));
commitEdit
in class Cell<T>
newValue
- The value as input by the end user, which should be
persisted in the relevant way given the data source underpinning the
user interface and the install edit commit handler of the UI control.public void cancelEdit()
cancelEdit
in class Cell<T>
protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.createDefaultSkin
in class Control
void indexChanged(int oldIndex, int newIndex)
indexChanged
in class IndexedCell<T>
private void updateItem(int oldIndex)
private void updateSelection()
private void updateFocus()
private void updateEditing()
public final void updateTreeView(TreeView<T> tree)
tree
- The new TreeView that should be associated with this TreeCell.
Note: This function is intended to be used by experts, primarily
by those implementing new Skins. It is not common
for developers or designers to access this function directly.public final void updateTreeItem(TreeItem<T> treeItem)
treeItem
- The new TreeItem that should be associated with this
TreeCell.
Note: This function is intended to be used by experts, primarily
by those implementing new Skins. It is not common
for developers or designers to access this function directly.public java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
queryAccessibleAttribute
in class Control
public void executeAccessibleAction(AccessibleAction action, java.lang.Object... parameters)
executeAccessibleAction
in class Control