T - TreeTableColumnに含まれる要素の型。public class CheckBoxTreeTableCell<S,T> extends TreeTableCell<S,T>
CheckBoxノードを描画し、オプションでチェック・ボックスの意味を示すラベルを追加するTreeTableCell実装を含むクラス。
デフォルトでは、CheckBoxTreeTableCellは、TreeTableColumnの中央にCheckBoxを配置してレンダリングされます。 ラベルが必要な場合は、非nullのStringConverterインスタンスをCheckBoxTreeTableCell(Callback, StringConverter)コンストラクタに提供する必要があります。
このクラスのインスタンスを構築するには、型Tのオブジェクトを入力とし、指定されたアイテムが選択されているかどうかを表すObservableProperty<Boolean>を返すCallbackを指定する必要があります。 このObservableValueは、双方向にバインドされます(つまり、セル内のCheckBoxがユーザー操作に基づいてこのプロパティを設定または設定解除し、CheckBoxは変更が外部で行われた場合、ObservableValueの状態を反映します)。
CheckBoxTreeTableCellはCheckBoxをライブ・レンダリングすること、つまり、CheckBoxは常に対話型で、ユーザーが直接切り替えることに注意してください。 これは、セルがそのediting stateに入る必要がないことを意味します(通常は、ユーザーがセル上をダブルクリックすると編集状態になります)。 これによる副次的影響は、通常の編集コールバック(on edit commitなど)が呼び出されないことです。 変更の通知を受け取る必要がある場合は、CheckBoxで操作されるブール型プロパティを直接監視することをお薦めします。
| Type | プロパティと説明 |
|---|---|
ObjectProperty<StringConverter<T>> |
converter
StringConverterプロパティ。 |
ObjectProperty<Callback<Integer,ObservableValue<Boolean>>> |
selectedStateCallback
画面上に表示されるCheckBoxでバインドされる
Callbackを表すプロパティ。 |
tableColumn, tableRow, treeTableViewindexalignment, 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| コンストラクタと説明 |
|---|
CheckBoxTreeTableCell()
デフォルトのCheckBoxTreeTableCellを作成します。
|
CheckBoxTreeTableCell(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty)
カスタム
Callbackを使用してデフォルトのCheckBoxTreeTableCellを作成して、指定されたセル索引のObservableValueを取得します。 |
CheckBoxTreeTableCell(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty, StringConverter<T> converter)
カスタム文字列コンバータを使用して、CheckBoxTreeTableCellを作成します。
|
cancelEdit, commitEdit, createDefaultSkin, executeAccessibleAction, getTableColumn, getTreeTableRow, getTreeTableView, layoutChildren, queryAccessibleAttribute, startEdit, tableColumnProperty, tableRowProperty, treeTableViewProperty, updateSelected, updateTreeTableColumn, updateTreeTableRow, updateTreeTableViewgetIndex, indexProperty, updateIndexeditableProperty, editingProperty, emptyProperty, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, selectedProperty, setEditable, setItemalignmentProperty, 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, 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<T>> converterProperty
StringConverterプロパティ。public final ObjectProperty<Callback<Integer,ObservableValue<Boolean>>> selectedStateCallbackProperty
Callbackを表すプロパティ。public CheckBoxTreeTableCell()
public CheckBoxTreeTableCell(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty)
Callbackを使用してデフォルトのCheckBoxTreeTableCellを作成して、指定されたセル索引のObservableValueを取得します。getSelectedProperty - TreeTableColumnからのインデックスを入力とし、ObservableValueを返すCallback。public CheckBoxTreeTableCell(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty, StringConverter<T> converter)
getSelectedProperty - TreeTableColumnからのインデックスを入力とし、ObservableValueを返すCallback。converter - 型Tのオブジェクトを入力とし、オブジェクトを視覚的に表すために使用できる文字列を返すStringConverter。public static <S> Callback<TreeTableColumn<S,Boolean>,TreeTableCell<S,Boolean>> forTreeTableColumn(TreeTableColumn<S,Boolean> column)
TreeTableColumnセル・ファクトリで使用するセル・ファクトリを作成します。 このメソッドでは、TreeTableColumnがBoolean型である必要があります。
TreeTableColumnで使用される場合、CheckBoxCellは列の中央にCheckBoxを配置してレンダリングされます。
列の各セル内に含まれているObservableValue<Boolean>は、双方向にバインドされます。 これは、セルのCheckBoxが、ユーザー操作に基づいてこのプロパティを設定または設定解除すること、およびCheckBoxは変更が外部で行われた場合、ObservableValue<Boolean>の状態を反映することを意味します。
TreeTableCellを返すCallback。public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty)
TreeTableColumnセル・ファクトリで使用するセル・ファクトリを作成します。 このメソッドでは、TreeTableColumnがObservableValue<Boolean>型である必要があります。
TreeTableColumnで使用される場合、CheckBoxCellは列の中央にCheckBoxを配置してレンダリングされます。
T - TreeTableColumnインスタンスに含まれている要素の型。getSelectedProperty - 型TreeTableColumn<S,T>のオブジェクトを入力とし、指定されたアイテムが選択されているかどうかを表すObservableValue<Boolean>を返すCallback。 ObservableValue<Boolean>は双方向にバインドされます(つまり、セルのCheckBoxが、ユーザー操作に基づいてこのプロパティを設定または設定解除すること、およびCheckBoxは変更が外部で行われた場合、ObservableValue<Boolean>の状態を反映します)。 TreeTableCellを返すCallback。public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty, boolean showLabel)
TreeTableColumnセル・ファクトリで使用するセル・ファクトリを作成します。 このメソッドでは、TreeTableColumnがObservableValue<Boolean>型である必要があります。
TreeTableColumnで使用される場合、CheckBoxCellは列の中央にCheckBoxを配置してレンダリングされます。
T - TreeTableColumnインスタンスに含まれている要素の型。getSelectedProperty - 型TreeTableColumn<S,T>のオブジェクトを入力とし、指定されたアイテムが選択されているかどうかを表すObservableValue<Boolean>を返すCallback。 ObservableValue<Boolean>は双方向にバインドされます(つまり、セルのCheckBoxが、ユーザー操作に基づいてこのプロパティを設定または設定解除すること、およびCheckBoxは変更が外部で行われた場合、ObservableValue<Boolean>の状態を反映します)。 showLabel - 場合によっては、CheckBoxの横のTreeTableCellにラベルを表示することが必要になる場合があります。 デフォルトでは、ラベルは表示されませんが、これをtrueに設定すると、セルのアイテムでもtoString()が呼び出されるようになります。 これが目的の動作でない場合は、該当する行アイテムのラベルを指定するコールバックを指定できるforTreeTableColumn(javafx.util.Callback, javafx.util.StringConverter)を使用することを検討します。 TreeTableCellを返すCallback。public static <S,T> Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>> forTreeTableColumn(Callback<Integer,ObservableValue<Boolean>> getSelectedProperty, StringConverter<T> converter)
TreeTableColumnセル・ファクトリで使用するセル・ファクトリを作成します。 このメソッドでは、TreeTableColumnがObservableValue<Boolean>型である必要があります。
TreeTableColumnで使用される場合、CheckBoxCellは列の中央にCheckBoxを配置してレンダリングされます。
T - TreeTableColumnインスタンスに含まれている要素の型。getSelectedProperty - 型TreeTableColumn<S,T>のオブジェクトを入力とし、指定されたアイテムが選択されているかどうかを表すObservableValue<Boolean>を返すCallback。 ObservableValue<Boolean>は双方向にバインドされます(つまり、セルのCheckBoxが、ユーザー操作に基づいてこのプロパティを設定または設定解除すること、およびCheckBoxは変更が外部で行われた場合、ObservableValue<Boolean>の状態を反映します)。 converter - 型Tのオブジェクトを入力とし、オブジェクトを視覚的に表すために使用できる文字列を返すStringConverter。 forTreeTableColumn(Callback, boolean)のデフォルト実装(showLabelがtrueの場合)は、すべての非nullアイテムでtoString()を単に呼び出します(指定されたアイテムがnullの場合、単に空の文字列を返します)。 TreeTableCellを返すCallback。public final ObjectProperty<StringConverter<T>> converterProperty()
StringConverterプロパティ。public final void setConverter(StringConverter<T> value)
StringConverterを設定します。public final StringConverter<T> getConverter()
StringConverterを返します。public final ObjectProperty<Callback<Integer,ObservableValue<Boolean>>> selectedStateCallbackProperty()
Callbackを表すプロパティ。public final void setSelectedStateCallback(Callback<Integer,ObservableValue<Boolean>> value)
Callbackを設定します。public final Callback<Integer,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に設定します。 これを行わないと、ほぼ確実に、エンド・ユーザーに対して予想外のグラフィカル・アーティファクトがセル内に表示されます。 updateItem、クラスCell<T>item - セルの新しいアイテム。empty - このセルがリストからのデータを表しているかどうか。 空の場合、いずれのドメイン・データも表しませんが、空の行のレンダリングに使用されるセルとなります。 Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.