- java.lang.Object
-
- javafx.scene.Node
-
- javafx.scene.Parent
-
- javafx.scene.layout.Region
-
- javafx.scene.control.Control
-
- javafx.scene.control.Labeled
-
- javafx.scene.control.Cell<T>
-
- javafx.scene.control.IndexedCell<T>
-
- javafx.scene.control.TreeCell<T>
-
- 参数类型
-
T
-TreeItem
属性中包含的值的类型。
- All Implemented Interfaces:
-
Styleable
,EventTarget
,Skinnable
- 已知直接子类:
-
CheckBoxTreeCell
,ChoiceBoxTreeCell
,ComboBoxTreeCell
,TextFieldTreeCell
public class TreeCell<T> extends IndexedCell<T>
Cell
类型与TreeView
控件一起使用。 除了在IndexedCell
上定义的API 之外 ,TreeCell公开了CSS使用的其他状态和伪类。TreeCell监视与之关联的TreeView的选择模型,确保它可视地向用户指示是否被选择。 当选择TreeCell时, 它将通过
selected
属性以及通过“选定”CSS伪类状态显示。由于TreeCell从
IndexedCell
延伸,每个TreeCell还提供了一个index
属性。 索引将在单元格展开和折叠时更新,因此应视为视图索引而不是模型索引。最后,每个TreeCell还有一个与它正在使用的TreeView的引用。 每个TreeCell属于唯一的一个TreeView。
-
-
Property Summary
Properties Type Property 描述 ObjectProperty<Node>
disclosureNode
公开节点通常被视为在屏幕上旋转的三角形,以指示其旁边放置的TreeItem是否被展开或折叠。ReadOnlyObjectProperty<TreeItem<T>>
treeItem
每个TreeCell最多代表一个TreeItem
,由该属性表示。ReadOnlyObjectProperty<TreeView<T>>
treeView
TreeCell显式链接到一个TreeView
实例,由该属性表示。-
Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltip
-
Properties inherited from class javafx.scene.control.IndexedCell
index
-
Properties inherited from class javafx.scene.control.Labeled
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, labelPadding, lineSpacing, mnemonicParsing, textAlignment, textFill, textOverrun, text, underline, wrapText
-
Properties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
Properties inherited from class javafx.scene.Parent
needsLayout
-
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
-
-
Field Summary
-
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
-
-
构造方法摘要
构造方法 Constructor 描述 TreeCell()
创建一个默认的TreeCell实例。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 void
cancelEdit()
调用此功能从编辑状态转换为非编辑状态,而不保存任何用户输入。void
commitEdit(T newValue)
在适当的时候调用此功能(根据您的单元格编辑用户界面的用户交互需求)来执行以下两件事:将相应的事件反馈回支持UI控件(例如protected Skin<?>
createDefaultSkin()
为此控件创建一个新的默认皮肤实例。ObjectProperty<Node>
disclosureNodeProperty()
公开节点通常被视为在屏幕上旋转的三角形,以指示其旁边放置的TreeItem是否被展开或折叠。void
executeAccessibleAction(AccessibleAction action, Object... parameters)
该方法由辅助技术调用,请求执行由参数指示的动作。Node
getDisclosureNode()
返回此TreeCell中设置的当前披露节点。TreeItem<T>
getTreeItem()
返回当前在此TreeCell中设置的TreeItem。TreeView<T>
getTreeView()
返回与此TreeCell关联的TreeView。Object
queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
该方法由辅助技术调用以请求属性的值。void
setDisclosureNode(Node value)
用作“披露”三角形的节点,或用于展开和折叠项目的切换。void
startEdit()
调用此功能从非编辑状态转换到编辑状态,如果单元格是可编辑的。ReadOnlyObjectProperty<TreeItem<T>>
treeItemProperty()
每个TreeCell最多代表一个TreeItem
,由该属性表示。ReadOnlyObjectProperty<TreeView<T>>
treeViewProperty()
TreeCell显式链接到一个TreeView
实例,由该属性表示。void
updateTreeItem(TreeItem<T> treeItem)
更新与TreeCell关联的TreeItem。void
updateTreeView(TreeView<T> tree)
更新与TreeCell相关联的TreeView。-
Methods inherited from class javafx.scene.control.Cell
editableProperty, editingProperty, emptyProperty, getInitialFocusTraversable, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, layoutChildren, selectedProperty, setEditable, setItem, updateItem, updateSelected
-
Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getCssMetaData, getSkin, getTooltip, isResizable, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
-
Methods inherited from class javafx.scene.control.IndexedCell
getIndex, indexProperty, updateIndex
-
Methods inherited from class javafx.scene.control.Labeled
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
-
Methods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
-
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
-
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
-
-
-
Property Detail
-
treeItem
public final ReadOnlyObjectProperty<TreeItem<T>> treeItemProperty
每个TreeCell最多代表一个TreeItem
,由该属性表示。- 结果
- 表示TreeCell的TreeItem属性
-
disclosureNode
public final ObjectProperty<Node> disclosureNodeProperty
公开节点通常被视为在屏幕上旋转的三角形,以指示其旁边放置的TreeItem是否被展开或折叠。
-
treeView
public final ReadOnlyObjectProperty<TreeView<T>> treeViewProperty
TreeCell显式链接到一个TreeView
实例,由该属性表示。- 另请参见:
-
getTreeView()
-
-
方法详细信息
-
getTreeItem
public final TreeItem<T> getTreeItem()
返回当前在此TreeCell中设置的TreeItem。- 结果
- TreeCell中当前设置的TreeItem
-
treeItemProperty
public final ReadOnlyObjectProperty<TreeItem<T>> treeItemProperty()
每个TreeCell最多表示一个TreeItem
,由该属性表示。- 结果
- 表示TreeCell的TreeItem属性
-
setDisclosureNode
public final void setDisclosureNode(Node value)
用作“披露”三角形的节点,或用于展开和折叠项目的切换。 这仅在包含子项目的树中的项目的情况下使用。 如果未指定,TreeCell的Skin实现负责提供默认的公开节点。- 参数
-
value
- 披露节点
-
getDisclosureNode
public final Node getDisclosureNode()
返回此TreeCell中设置的当前披露节点。- 结果
- 当前披露节点设置在此TreeCell中
-
disclosureNodeProperty
public final ObjectProperty<Node> disclosureNodeProperty()
公开节点通常被视为在屏幕上旋转的三角形,以指示其旁边放置的TreeItem是否被展开或折叠。
-
getTreeView
public final TreeView<T> getTreeView()
返回与此TreeCell关联的TreeView。- 结果
- 与TreeCell相关联的TreeView
-
treeViewProperty
public final ReadOnlyObjectProperty<TreeView<T>> treeViewProperty()
TreeCell显式链接到一个TreeView
实例,由该属性表示。- 另请参见:
-
getTreeView()
-
startEdit
public void startEdit()
调用此功能从非编辑状态转换到编辑状态,如果单元格是可编辑的。 如果这个单元格已经处于编辑状态,它将保留在它中。
-
commitEdit
public void commitEdit(T newValue)
在适当的时候调用此功能(基于您的单元格编辑用户界面的用户交互要求)来做两件事情:- 将适当的事件触发回到支持UI控件(例如
ListView
)。 这将开始将此编辑推回相关数据源/属性(尽管不能保证这将成功 - 这取决于正在使用的特定编辑提交处理程序)。 有关更多详细信息,请参阅UI控件类javadoc。 - 开始从编辑状态转换到非编辑状态。
一般来说,在自定义单元实现中无需重写此方法 - 在适当的时候简单地调用此方法就足够了(例如,当用户按Enter键时,可以执行像
cell.commitEdit(converter.fromString(textField.getText()));
- 重写:
-
commitEdit
在Cell<T>
- 参数
-
newValue
- 作为最终用户输入的值,应该以相关的方式newValue
给出支持用户界面的数据源和UI控件的安装编辑提交处理程序。
- 将适当的事件触发回到支持UI控件(例如
-
cancelEdit
public void cancelEdit()
调用此功能从编辑状态转换为非编辑状态,而不保存任何用户输入。- 重写:
-
cancelEdit
在Cell<T>
-
createDefaultSkin
protected Skin<?> createDefaultSkin()
为此控件创建一个新的默认皮肤实例。 如果没有通过CSS-fx-skin
提供皮肤或者在具有setSkin(...)
的子类中显式设置,则调用此控件创建皮肤。- 重写:
-
createDefaultSkin
在Control
- 结果
- 此控件的默认皮肤的新实例。 如果为null,则控件将没有皮肤,除非由css提供。
-
updateTreeView
public final void updateTreeView(TreeView<T> tree)
更新与TreeCell相关联的TreeView。- 参数
-
tree
- 应该与此TreeCell相关联的新TreeView。 注意:此功能主要由专家使用,主要由实施新皮肤的人员使用。 开发人员或设计师直接访问此功能并不常见。
-
updateTreeItem
public final void updateTreeItem(TreeItem<T> treeItem)
更新与TreeCell关联的TreeItem。- 参数
-
treeItem
- 应该与此TreeCell相关联的新TreeItem。 注意:此功能主要由专家使用,主要由实施新皮肤的人员使用。 开发人员或设计师直接访问此功能并不常见。
-
queryAccessibleAttribute
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)
该方法由辅助技术调用以请求属性的值。子类通常覆盖此方法来实现特定角色所需的属性。
如果未处理特定属性,则必须调用超类实现。- 重写:
-
queryAccessibleAttribute
在Control
- 参数
-
attribute
- 请求的属性 -
parameters
- 可选参数列表 - 结果
- 请求的属性的值
- 另请参见:
-
AccessibleAttribute
-
executeAccessibleAction
public void executeAccessibleAction(AccessibleAction action, Object... parameters)
该方法由辅助技术调用,请求执行由参数指示的动作。此方法通常被子类覆盖,以实现特定角色所需的操作。
如果未处理特定操作,则必须调用超类实现。- 重写:
-
executeAccessibleAction
在Control
- 参数
-
action
- 要执行的操作 -
parameters
- 可选参数列表 - 另请参见:
-
AccessibleAction
-
-