T
- ListViewに含まれる要素の型。public class ChoiceBoxListCell<T> extends ListCell<T>
ChoiceBox
ノードを描画するListCell
実装を含むクラス。
デフォルトでは、ChoiceBoxListCellは、編集されていない場合はLabel
としてレンダリングされ、編集モードの場合はChoiceBoxとしてレンダリングされます。 ChoiceBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。
ChoiceBoxListCellを作成するには、ChoiceBox
メニューが表示されるとユーザーに表示される0以上のアイテムを提供する必要があります。 これらのアイテムはListViewアイテム・シーケンスと同じ型である必要があり、これにより、たとえば、選択時にitems
リストの既存値を置き換えます。
Type | プロパティと説明 |
---|---|
ObjectProperty<StringConverter<T>> |
converter
StringConverter プロパティ。 |
index
alignment, contentDisplay, ellipsisString, font, graphic, graphicTextGap, labelPadding, lineSpacing, mnemonicParsing, textAlignment, textFill, textOverrun, text, underline, wrapText
contextMenu, skin, tooltip
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
needsLayout
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, visible
USE_COMPUTED_SIZE, USE_PREF_SIZE
BASELINE_OFFSET_SAME_AS_HEIGHT
コンストラクタと説明 |
---|
ChoiceBoxListCell()
空のアイテム・リストを持つデフォルトのChoiceBoxListCellを作成します。
|
ChoiceBoxListCell(ObservableList<T> items)
ChoiceBoxが表示されているときに
ChoiceBox の移入に使用される、指定されたアイテムを含むデフォルトのChoiceBoxListCell インスタンスを作成します。 |
ChoiceBoxListCell(StringConverter<T> converter, ObservableList<T> items)
ChoiceBox が表示されるときに、その値の移入に使用される、指定されたアイテムを含むChoiceBoxListCell インスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverter を作成します。 |
ChoiceBoxListCell(StringConverter<T> converter, T... items)
ChoiceBox が表示されるときに、その値の移入に使用される、指定されたアイテムを含むChoiceBoxListCell インスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverter を作成します。 |
ChoiceBoxListCell(T... items)
ChoiceBoxが表示されているときに
ChoiceBox の移入に使用される、指定されたアイテムを含むデフォルトのChoiceBoxListCell インスタンスを作成します。 |
修飾子と型 | メソッドと説明 |
---|---|
void |
cancelEdit()
この関数を呼び出して、ユーザーによる入力を保存せずに、編集状態から非編集状態に遷移します。
|
ObjectProperty<StringConverter<T>> |
converterProperty()
StringConverter プロパティ。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(ObservableList<T> items)
ListView コントロールで使用するChoiceBoxセル・ファクトリを作成します。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(StringConverter<T> converter, ObservableList<T> items)
ListView コントロールで使用するChoiceBoxセル・ファクトリを作成します。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(StringConverter<T> converter, T... items)
ListView コントロールで使用するChoiceBoxセル・ファクトリを作成します。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(T... items)
ListView コントロールで使用するChoiceBoxセル・ファクトリを作成します。 |
StringConverter<T> |
getConverter()
このセルで使用する
StringConverter を返します。 |
ObservableList<T> |
getItems()
ChoiceBoxが表示されているときにChoiceBoxに表示されるアイテムを返します。
|
void |
setConverter(StringConverter<T> value)
このセルで使用する
StringConverter を設定します。 |
void |
startEdit()
この関数を呼び出して、セルが編集可能な場合に、非編集状態から編集状態に遷移します。
|
void |
updateItem(T item, boolean empty)
updateItemメソッドは、開発者にとって、呼び出すことはできないが、オーバーライドしてセルのビジュアルをカスタマイズできる、最適なメソッドです。
|
commitEdit, createDefaultSkin, executeAccessibleAction, getListView, listViewProperty, queryAccessibleAttribute, updateListView
getIndex, indexProperty, updateIndex
editableProperty, editingProperty, emptyProperty, getItem, isEditable, isEditing, isEmpty, isItemChanged, isSelected, itemProperty, selectedProperty, setEditable, setItem, updateSelected
alignmentProperty, 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, wrapTextProperty
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getCssMetaData, getSkin, getTooltip, isResizable, layoutChildren, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
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, snapSize, snapSpace, snapToPixelProperty, widthProperty
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
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, 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, visibleProperty
public final ObjectProperty<StringConverter<T>> converterProperty
StringConverter
プロパティ。public ChoiceBoxListCell()
@SafeVarargs public ChoiceBoxListCell(T... items)
ChoiceBox
の移入に使用される、指定されたアイテムを含むデフォルトのChoiceBoxListCell
インスタンスを作成します。items
- ユーザーが選択した場合に、ChoiceBoxポップアップ・メニューに表示されるアイテム。@SafeVarargs public ChoiceBoxListCell(StringConverter<T> converter, T... items)
ChoiceBox
が表示されるときに、その値の移入に使用される、指定されたアイテムを含むChoiceBoxListCell
インスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverter
を作成します。converter
- 型Tのアイテムをユーザーが読取り可能な文字列に変換して、ChoiceBoxポップアップ・メニューに表示できるようにするStringConverter
。items
- ユーザーが選択した場合に、ChoiceBoxポップアップ・メニューに表示されるアイテム。public ChoiceBoxListCell(ObservableList<T> items)
ChoiceBox
の移入に使用される、指定されたアイテムを含むデフォルトのChoiceBoxListCell
インスタンスを作成します。items
- ユーザーが選択した場合に、ChoiceBoxポップアップ・メニューに表示されるアイテム。public ChoiceBoxListCell(StringConverter<T> converter, ObservableList<T> items)
ChoiceBox
が表示されるときに、その値の移入に使用される、指定されたアイテムを含むChoiceBoxListCell
インスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverter
を作成します。converter
- 型Tのアイテムをユーザーが読取り可能な文字列に変換して、ChoiceBoxポップアップ・メニューに表示できるようにするStringConverter
。items
- ユーザーが選択した場合に、ChoiceBoxポップアップ・メニューに表示されるアイテム。@SafeVarargs public static <T> Callback<ListView<T>,ListCell<T>> forListView(T... items)
@SafeVarargs public static <T> Callback<ListView<T>,ListCell<T>> forListView(StringConverter<T> converter, T... items)
ListView
コントロールで使用するChoiceBoxセル・ファクトリを作成します。 デフォルトでは、ChoiceBoxCellは、編集されていない場合はLabel
としてレンダリングされ、編集モードの場合はChoiceBoxとしてレンダリングされます。 ChoiceBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。 T
- ListViewに含まれる要素の型。converter
- (型Tの)指定されたアイテムをユーザーに表示するために文字列に変換するStringConverter
。items
- ChoiceBox
メニューが表示されるとユーザーに表示される0以上のアイテム。 これらのアイテムはListViewアイテム・リストと同じ型である必要があり、これにより、たとえば、選択時にitems
リストの既存値を置き換えます。 Callback
。public static <T> Callback<ListView<T>,ListCell<T>> forListView(ObservableList<T> items)
ListView
コントロールで使用するChoiceBoxセル・ファクトリを作成します。 デフォルトでは、ChoiceBoxCellは、編集されていない場合はLabel
としてレンダリングされ、編集モードの場合はChoiceBoxとしてレンダリングされます。 ChoiceBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。 T
- ListViewに含まれる要素の型。items
- ChoiceBox
メニューが表示されるとユーザーに表示される0以上のアイテムを含むObservableList
。 これらのアイテムはListViewアイテム・シーケンスと同じ型である必要があり、これにより、たとえば、選択時にitems
リストの既存値を置き換えます。 Callback
。public static <T> Callback<ListView<T>,ListCell<T>> forListView(StringConverter<T> converter, ObservableList<T> items)
ListView
コントロールで使用するChoiceBoxセル・ファクトリを作成します。 デフォルトでは、ChoiceBoxCellは、編集されていない場合はLabel
としてレンダリングされ、編集モードの場合はChoiceBoxとしてレンダリングされます。 ChoiceBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。 T
- ListViewに含まれる要素の型。converter
- (型Tの)指定されたアイテムをユーザーに表示するために文字列に変換するStringConverter
。items
- ChoiceBox
メニューが表示されるとユーザーに表示される0以上のアイテムを含むObservableList
。 これらのアイテムはListViewアイテム・シーケンスと同じ型である必要があり、これにより、たとえば、選択時にitems
リストの既存値を置き換えます。 Callback
。public final ObjectProperty<StringConverter<T>> converterProperty()
StringConverter
プロパティ。public final void setConverter(StringConverter<T> value)
StringConverter
を設定します。public final StringConverter<T> getConverter()
StringConverter
を返します。public ObservableList<T> getItems()
public void startEdit()
public void cancelEdit()
cancelEdit
、クラスListCell<T>
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.