T - ListViewに含まれる要素の型。public class ComboBoxListCell<T> extends ListCell<T>
ComboBoxノードを描画するListCell実装を含むクラス。
デフォルトでは、ComboBoxListCellは、編集されていない場合はLabelとしてレンダリングされ、編集モードの場合はComboBoxとしてレンダリングされます。 ComboBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。
ComboBoxListCellを作成するには、ComboBoxメニューが表示されるとユーザーに表示される0以上のアイテムを提供する必要があります。 これらのアイテムはListViewアイテム・シーケンスと同じ型である必要があり、これにより、たとえば、選択時にitemsリストの既存値を置き換えます。
| Type | プロパティと説明 |
|---|---|
BooleanProperty |
comboBoxEditable
ユーザーに表示する場合にComboBoxを編集可能にするかどうかを表すプロパティ。
|
ObjectProperty<StringConverter<T>> |
converter
StringConverterプロパティ。 |
indexalignment, 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| コンストラクタと説明 |
|---|
ComboBoxListCell()
空のアイテム・リストを持つデフォルトのComboBoxListCellを作成します。
|
ComboBoxListCell(ObservableList<T> items)
ComboBoxが表示されているときに
ComboBoxの移入に使用される、指定されたアイテムを含むデフォルトのComboBoxListCellインスタンスを作成します。 |
ComboBoxListCell(StringConverter<T> converter, ObservableList<T> items)
ComboBoxが表示されるときに、その値の移入に使用される、指定されたアイテムを含むComboBoxListCellインスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverterを作成します。 |
ComboBoxListCell(StringConverter<T> converter, T... items)
ComboBoxが表示されるときに、その値の移入に使用される、指定されたアイテムを含むComboBoxListCellインスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverterを作成します。 |
ComboBoxListCell(T... items)
ComboBoxが表示されているときに
ComboBoxの移入に使用される、指定されたアイテムを含むデフォルトのComboBoxListCellインスタンスを作成します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void |
cancelEdit()
この関数を呼び出して、ユーザーによる入力を保存せずに、編集状態から非編集状態に遷移します。
|
BooleanProperty |
comboBoxEditableProperty()
ユーザーに表示する場合にComboBoxを編集可能にするかどうかを表すプロパティ。
|
ObjectProperty<StringConverter<T>> |
converterProperty()
StringConverterプロパティ。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(ObservableList<T> items)
ListViewコントロールで使用するComboBoxセル・ファクトリを作成します。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(StringConverter<T> converter, ObservableList<T> items)
ListViewコントロールで使用するComboBoxセル・ファクトリを作成します。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(StringConverter<T> converter, T... items)
ListViewコントロールで使用するComboBoxセル・ファクトリを作成します。 |
static <T> Callback<ListView<T>,ListCell<T>> |
forListView(T... items)
ListViewコントロールで使用するComboBoxセル・ファクトリを作成します。 |
StringConverter<T> |
getConverter()
このセルで使用する
StringConverterを返します。 |
ObservableList<T> |
getItems()
ChoiceBoxが表示されているときにChoiceBoxに表示されるアイテムを返します。
|
boolean |
isComboBoxEditable()
ComboBoxが編集可能な場合はtrueを返します。
|
void |
setComboBoxEditable(boolean value)
ComboBoxを編集可能に構成します(オプション以外のユーザー入力をドロップダウン・リストに提供することを許可します)。
|
void |
setConverter(StringConverter<T> value)
このセルで使用する
StringConverterを設定します。 |
void |
startEdit()
この関数を呼び出して、セルが編集可能な場合に、非編集状態から編集状態に遷移します。
|
void |
updateItem(T item, boolean empty)
updateItemメソッドは、開発者にとって、呼び出すことはできないが、オーバーライドしてセルのビジュアルをカスタマイズできる、最適なメソッドです。
|
commitEdit, createDefaultSkin, executeAccessibleAction, getListView, listViewProperty, queryAccessibleAttribute, updateListViewgetIndex, 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<T>> converterProperty
StringConverterプロパティ。public final BooleanProperty comboBoxEditableProperty
public ComboBoxListCell()
@SafeVarargs public ComboBoxListCell(T... items)
ComboBoxの移入に使用される、指定されたアイテムを含むデフォルトのComboBoxListCellインスタンスを作成します。items - ユーザーが選択した場合に、ComboBoxポップアップ・メニューに表示されるアイテム。@SafeVarargs public ComboBoxListCell(StringConverter<T> converter, T... items)
ComboBoxが表示されるときに、その値の移入に使用される、指定されたアイテムを含むComboBoxListCellインスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverterを作成します。converter - 型Tのアイテムをユーザーが読取り可能な文字列に変換して、ComboBoxポップアップ・メニューに表示できるようにするStringConverter。items - ユーザーが選択した場合に、ComboBoxポップアップ・メニューに表示されるアイテム。public ComboBoxListCell(ObservableList<T> items)
ComboBoxの移入に使用される、指定されたアイテムを含むデフォルトのComboBoxListCellインスタンスを作成します。items - ユーザーが選択した場合に、ComboBoxポップアップ・メニューに表示されるアイテム。public ComboBoxListCell(StringConverter<T> converter, ObservableList<T> items)
ComboBoxが表示されるときに、その値の移入に使用される、指定されたアイテムを含むComboBoxListCellインスタンス、およびアイテムをユーザーが読取り可能な形式に変換するために使用されるStringConverterを作成します。converter - 型Tのアイテムをユーザーが読取り可能な文字列に変換して、ComboBoxポップアップ・メニューに表示できるようにするStringConverter。items - ユーザーが選択した場合に、ComboBoxポップアップ・メニューに表示されるアイテム。@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コントロールで使用するComboBoxセル・ファクトリを作成します。 デフォルトでは、ComboBoxCellは、編集されていない場合はLabelとしてレンダリングされ、編集モードの場合はComboBoxとしてレンダリングされます。 ComboBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。 T - ListViewに含まれる要素の型。converter - (型Tの)指定されたアイテムをユーザーに表示するために文字列に変換するStringConverter。items - ComboBoxメニューが表示されるとユーザーに表示される0以上のアイテム。 これらのアイテムはListViewアイテム・リストと同じ型である必要があり、これにより、たとえば、選択時にitemsリストの既存値を置き換えます。 Callback。public static <T> Callback<ListView<T>,ListCell<T>> forListView(ObservableList<T> items)
ListViewコントロールで使用するComboBoxセル・ファクトリを作成します。 デフォルトでは、ComboBoxCellは、編集されていない場合はLabelとしてレンダリングされ、編集モードの場合はComboBoxとしてレンダリングされます。 ComboBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。 T - ListViewに含まれる要素の型。items - ComboBoxメニューが表示されるとユーザーに表示される0以上のアイテムを含むObservableList。 これらのアイテムはListViewアイテム・シーケンスと同じ型である必要があり、これにより、たとえば、選択時にitemsリストの既存値を置き換えます。 Callback。public static <T> Callback<ListView<T>,ListCell<T>> forListView(StringConverter<T> converter, ObservableList<T> items)
ListViewコントロールで使用するComboBoxセル・ファクトリを作成します。 デフォルトでは、ComboBoxCellは、編集されていない場合はLabelとしてレンダリングされ、編集モードの場合はComboBoxとしてレンダリングされます。 ComboBoxは、デフォルトで、リスト・セル全体に表示するように拡大されます。 T - ListViewに含まれる要素の型。converter - (型Tの)指定されたアイテムをユーザーに表示するために文字列に変換するStringConverter。items - ComboBoxメニューが表示されるとユーザーに表示される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 final BooleanProperty comboBoxEditableProperty()
public final void setComboBoxEditable(boolean value)
public final boolean isComboBoxEditable()
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.