T - TreeView TreeItemインスタンスに含まれている要素の型。public class CheckBoxTreeCell<T> extends TreeCell<T>
CheckBoxノードを描画し、それに加えて共通の操作に対するサポート(詳細は後述)を提供するTreeCell実装を含むクラス。
CheckBoxでのTreeViewの作成を簡易化するために、CheckBoxTreeItemというコンビニエンス・クラスが提供されています。 開発者は、TreeViewツリー構造を構築する場合、通常のTreeItemクラスではなく、このクラスを使用することを強くお薦めします。 これら2つのクラスを組み合せる方法の例は、CheckBoxTreeItemのAPIドキュメントを参照してください。
TreeViewで使用される場合、CheckBoxCellは公開ノード(つまり、矢印)の右にCheckBoxを配置してレンダリングされます。 TreeItem.getValue()に格納されているアイテムでは、StringConverterが呼び出され、このテキストが水平方向の残りのすべてのスペースを占めるようになります。 また、CheckBoxTreeItemを使用して、TreeViewは次のような状況を自動的に処理します。
CheckBoxをクリックすると、すべての子も選択または選択解除されます。
CheckBoxをクリックすると、親の状態が切り替わる可能性があります。 たとえば、単一の子を選択すると、親は不確定になります(複数の子の部分的選択を示します)。 続行してすべての子を選択すると、親も選択された状態になります。 これは再帰的で、すべての親ノードは予期したように更新されます。
CheckBoxTreeItemの使用が望ましくないと判断した場合は、TreeItemインスタンスを入力として、ObservableValue<Boolean>を返すことができるCallbackが提供される、いずれかのコンストラクタを呼び出す必要があります。 このObservableValue<Boolean>は、指定されたTreeItemのブール型状態を表す必要があります。
CheckBoxTreeCellはCheckBoxをライブ・レンダリングすること、つまり、CheckBoxは常に対話型で、ユーザーが直接切り替えることに注意してください。 これは、セルがそのediting stateに入る必要がないことを意味します(通常は、ユーザーがセル上をダブルクリックすると編集状態になります)。 これによる副次的影響は、通常の編集コールバック(on edit commitなど)が呼び出されないことです。 変更の通知を受け取る必要がある場合は、CheckBoxで操作されるブール型プロパティを直接監視することをお薦めします。
| Type | プロパティと説明 |
|---|---|
ObjectProperty<StringConverter<TreeItem<T>>> |
converter
StringConverterプロパティ。 |
ObjectProperty<Callback<TreeItem<T>,ObservableValue<Boolean>>> |
selectedStateCallback
画面上に表示されるCheckBoxでバインドされる
Callbackを表すプロパティ。 |
disclosureNode, treeItem, treeViewindexalignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, labelPadding, lineSpacing, mnemonicParsing, textAlignment, textFill, textOverrun, text, underline, wrapTextcontextMenu, skin, tooltipbackground, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthneedsLayoutaccessibleHelp, 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, visibleUSE_COMPUTED_SIZE, USE_PREF_SIZEBASELINE_OFFSET_SAME_AS_HEIGHT| コンストラクタと説明 |
|---|
CheckBoxTreeCell()
デフォルトの
TreeItemではなく、TreeViewがCheckBoxTreeItemインスタンスで構築されているとみなすデフォルトのCheckBoxTreeCellを作成します。 |
CheckBoxTreeCell(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty)
セル・ファクトリを経由してTreeViewコントロールで使用する
CheckBoxTreeCellを作成します。 |
CheckBoxTreeCell(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty, StringConverter<TreeItem<T>> converter)
セル・ファクトリを経由してTreeViewコントロールで使用する
CheckBoxTreeCellを作成します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
ObjectProperty<StringConverter<TreeItem<T>>> |
converterProperty()
StringConverterプロパティ。 |
static <T> Callback<TreeView<T>,TreeCell<T>> |
forTreeView()
TreeViewコントロールで使用するセル・ファクトリを作成しますが、このセル・ファクトリをTreeViewで使用する際には、TreeViewルートおよびすべての子が、通常使用されるデフォルトの
TreeItemではなくCheckBoxTreeItemのインスタンスであることが重要な前提となります。 |
static <T> Callback<TreeView<T>,TreeCell<T>> |
forTreeView(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty)
TreeViewコントロールで使用するセル・ファクトリを作成します。
|
static <T> Callback<TreeView<T>,TreeCell<T>> |
forTreeView(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty, StringConverter<TreeItem<T>> converter)
TreeViewコントロールで使用するセル・ファクトリを作成します。
|
StringConverter<TreeItem<T>> |
getConverter()
このセルで使用する
StringConverterを返します。 |
Callback<TreeItem<T>,ObservableValue<Boolean>> |
getSelectedStateCallback()
画面上に表示されるCheckBoxによってバインドされる
Callbackを返します。 |
ObjectProperty<Callback<TreeItem<T>,ObservableValue<Boolean>>> |
selectedStateCallbackProperty()
画面上に表示されるCheckBoxでバインドされる
Callbackを表すプロパティ。 |
void |
setConverter(StringConverter<TreeItem<T>> value)
このセルで使用する
StringConverterを設定します。 |
void |
setSelectedStateCallback(Callback<TreeItem<T>,ObservableValue<Boolean>> value)
画面上に表示されるCheckBoxによってバインドされる
Callbackを設定します。 |
void |
updateItem(T item, boolean empty)
updateItemメソッドは、開発者にとって、呼び出すことはできないが、オーバーライドしてセルのビジュアルをカスタマイズできる、最適なメソッドです。
|
cancelEdit, commitEdit, createDefaultSkin, disclosureNodeProperty, executeAccessibleAction, getDisclosureNode, getTreeItem, getTreeView, queryAccessibleAttribute, setDisclosureNode, startEdit, treeItemProperty, treeViewProperty, updateTreeItem, updateTreeViewgetIndex, indexProperty, updateIndexeditableProperty, editingProperty, emptyProperty, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, selectedProperty, setEditable, setItem, updateSelectedalignmentProperty, contentDisplayProperty, ellipsisStringProperty, fontProperty, getAlignment, getClassCssMetaData, getContentBias, getContentDisplay, getControlCssMetaData, getEllipsisString, getFont, getGraphic, getGraphicTextGap, 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, wrapTextPropertycomputeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getCssMetaData, getSkin, getTooltip, isResizable, layoutChildren, setContextMenu, setSkin, setTooltip, skinProperty, tooltipPropertybackgroundProperty, 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, snapSize, snapSpace, snapToPixelProperty, widthPropertygetChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsaccessibleHelpProperty, 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, 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, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic final ObjectProperty<StringConverter<TreeItem<T>>> converterProperty
StringConverterプロパティ。public final ObjectProperty<Callback<TreeItem<T>,ObservableValue<Boolean>>> selectedStateCallbackProperty
Callbackを表すプロパティ。public CheckBoxTreeCell()
TreeItemではなく、TreeViewがCheckBoxTreeItemインスタンスで構築されているとみなすデフォルトのCheckBoxTreeCellを作成します。 CheckBoxTreeItemを使用すると、ツリーの各アイテムの選択済状態と不確定状態が内部的に管理されます。 public CheckBoxTreeCell(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty)
CheckBoxTreeCellを作成します。 CheckBoxTreeCell()とは異なり、このメソッドはTreeViewのすべてのTreeItemインスタンスがCheckBoxTreeItemであるとはみなしません。
このメソッドを呼び出すには、TreeItemObservableValue<Boolean>を返すCallbackを指定する必要があります。ObservableValue<Boolean>は双方向にバインドされます(つまり、セルのCheckBoxが、ユーザー操作に基づいてこのプロパティを設定または設定解除すること、およびCheckBoxは変更が外部で行われた場合、ObservableValue<Boolean>の状態を反映します)。
アイテムがCheckBoxTreeItemインスタンスでない場合、親TreeItemと子TreeItemの状態の更新の処理は開発者の責任で行います。 これは、このクラスにTreeItemを指定すると、提供されているObservableValue<Boolean>を単に切り替えるのみで、それ以上のことは実行しないことを意味します。 この機能は外部で実装でき、その場合は、オブザーバをObservableValue<Boolean>に追加し、必要に応じて他のプロパティの状態を切り替えます。
getSelectedProperty - 指定されたアイテムが選択されているかどうかを表すObservableValue<Boolean>を返すCallback。public CheckBoxTreeCell(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty, StringConverter<TreeItem<T>> converter)
CheckBoxTreeCellを作成します。 CheckBoxTreeCell()とは異なり、このメソッドはTreeViewのすべてのTreeItemインスタンスがCheckBoxTreeItemであるとはみなしません。
このメソッドを呼び出すには、TreeItemObservableValue<Boolean>を返すCallbackを指定する必要があります。ObservableValue<Boolean>は双方向にバインドされます(つまり、セルのCheckBoxが、ユーザー操作に基づいてこのプロパティを設定または設定解除すること、およびCheckBoxは変更が外部で行われた場合、ObservableValue<Boolean>の状態を反映します)。
アイテムがCheckBoxTreeItemインスタンスでない場合、親TreeItemと子TreeItemの状態の更新の処理は開発者の責任で行います。 これは、このクラスにTreeItemを指定すると、提供されているObservableValue<Boolean>を単に切り替えるのみで、それ以上のことは実行しないことを意味します。 この機能は外部で実装でき、その場合は、オブザーバをObservableValue<Boolean>に追加し、必要に応じて他のプロパティの状態を切り替えます。
getSelectedProperty - 指定されたアイテムが選択されているかどうかを表すObservableValue<Boolean>を返すCallback。converter - TreeItem型のオブジェクトを指定するStringConverterpublic static <T> Callback<TreeView<T>,TreeCell<T>> forTreeView()
TreeItemではなくCheckBoxTreeItemのインスタンスであることが重要な前提となります。
TreeViewで使用される場合、CheckBoxCellは公開ノード(つまり、矢印)の右にCheckBoxを配置してレンダリングされます。 TreeItem.getValue()に格納されているアイテムでは、StringConverterが呼び出され、このテキストが水平方向の残りのすべてのスペースを占めるようになります。 また、CheckBoxTreeItemを使用して、TreeViewは次のような状況を自動的に処理します。
CheckBoxをクリックすると、すべての子も選択または選択解除されます。CheckBoxをクリックすると、親の状態が切り替わる可能性があります。 たとえば、単一の子を選択すると、親は不確定になります(複数の子の部分的選択を示します)。 続行してすべての子を選択すると、親も選択された状態になります。 これは再帰的で、すべての親ノードは予期したように更新されます。 Javaでの制限があるため、このメソッドを使用する場合は明示的なキャストを指定する必要があります。 たとえば:
final TreeView<String> treeView = new TreeView<String>();
treeView.setCellFactory(CheckBoxCell.<String>forTreeView());T - CheckBoxTreeItemインスタンスに含まれている要素の型。Callback(再帰的)。public static <T> Callback<TreeView<T>,TreeCell<T>> forTreeView(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty)
forTreeView()とは異なり、このメソッドはTreeViewのすべてのTreeItemインスタンスがCheckBoxTreeItemインスタンスであるとはみなしません。
TreeViewで使用される場合、CheckBoxCellは公開ノード(つまり、矢印)の右にCheckBoxを配置してレンダリングされます。 TreeItem.getValue()に格納されているアイテムでは、StringConverterが呼び出され、このテキストが水平方向の残りのすべてのスペースを占めるようになります。
forTreeView()とは異なり、このセル・ファクトリは、親TreeItemまたは子TreeItemの状態の更新を処理しません。提供されているObservableValue<Boolean>を単に切り替えるのみで、それ以上のことは実行しません。 この機能は外部で実装でき、その場合は、オブザーバをObservableValue<Boolean>に追加し、必要に応じて他のプロパティの状態を切り替えます。
T - TreeItemインスタンスに含まれている要素の型。getSelectedProperty - TreeItemObservableValue<Boolean>を返すCallback。ObservableValue<Boolean>は双方向に結合されます(つまり、セル内のCheckBoxは、ユーザー・インタラクションに基づいてこのプロパティを設定/設定解除し、CheckBoxは、外部で変更された場合、ObservableValue<Boolean>の状態を反映します)。 Callback(再帰的)。public static <T> Callback<TreeView<T>,TreeCell<T>> forTreeView(Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedProperty, StringConverter<TreeItem<T>> converter)
forTreeView()とは異なり、このメソッドは、TreeViewのすべてのTreeItemインスタンスがCheckBoxTreeItemであるとはみなしません。
TreeViewで使用される場合、CheckBoxCellは公開ノード(つまり、矢印)の右にCheckBoxを配置してレンダリングされます。 TreeItem.getValue()に格納されているアイテムでは、StringConverterが呼び出され、このテキストは水平方向の残りのすべてのスペースを占めるようになります。
forTreeView()とは異なり、このセル・ファクトリは、親TreeItemまたは子TreeItemの状態の更新を処理しません。提供されているObservableValue<Boolean>を単に切り替えるのみで、それ以上のことは実行しません。 この機能は外部で実装でき、その場合は、オブザーバをObservableValue<Boolean>に追加し、必要に応じて他のプロパティの状態を切り替えます。
T - TreeItemインスタンスに含まれている要素の型。getSelectedProperty - TreeItemObservableValue<Boolean>を返すCallback。ObservableValue<Boolean>は双方向に結合されます(つまり、セル内のCheckBoxは、ユーザー・インタラクションに基づいてこのプロパティを設定/設定解除し、CheckBoxは、外部で変更された場合、ObservableValue<Boolean>の状態を反映します)。 converter - TreeItemforTreeView(Callback)のデフォルトの実装では、null以外のすべてのアイテムに対して単純に.toString()をコールします(また、指定されたアイテムがnullの場合に空の文字列を返すだけです)。 Callback(再帰的)。public final ObjectProperty<StringConverter<TreeItem<T>>> converterProperty()
StringConverterプロパティ。public final void setConverter(StringConverter<TreeItem<T>> value)
StringConverterを設定します。public final StringConverter<TreeItem<T>> getConverter()
StringConverterを返します。public final ObjectProperty<Callback<TreeItem<T>,ObservableValue<Boolean>>> selectedStateCallbackProperty()
Callbackを表すプロパティ。public final void setSelectedStateCallback(Callback<TreeItem<T>,ObservableValue<Boolean>> value)
Callbackを設定します。public final Callback<TreeItem<T>,ObservableValue<Boolean>> getSelectedStateCallback()
Callbackを返します。public void updateItem(T item, boolean empty)
ListViewコントロールなどのUIコントロールによってのみ呼び出されるようにする必要があります。 ただし、updateItemメソッドが存在する理由は、開発者がカスタム・セル・ファクトリ(ListView cell factoryなど)を指定するときに、updateItemメソッドをオーバーライドして、セルを完全にカスタマイズできるようにすることです。
CellのサブクラスがupdateItemメソッドを適切にオーバーライドすることは非常に重要であり、これは、そのようにしないと、セルが空白になったり、セルに予期しないコンテンツが含まれるなどの問題が発生するためです。 updateItemメソッドを適切にオーバーライドする方法の例を次に示します。
protected void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(null);
setGraphic(null);
} else {
setText(item.toString());
}
}
このコード・サンプルには次の2つの重要なポイントがあることに注意してください。
empty状態をテストし、trueの場合は、textプロパティとgraphicプロパティをnullに設定します。 これを行わないと、ほぼ確実に、エンド・ユーザーに対して予想外のグラフィカル・アーティファクトがセル内に表示されます。 item - セルの新しいアイテム。empty - このセルがリストからのデータを表しているかどうか。 空の場合、いずれのドメイン・データも表しませんが、空の行のレンダリングに使用されるセルとなります。 Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.