Top Description Fields Constructors Methods
javafx.scene.control.skin

public Class ComboBoxListViewSkin<T>

extends ComboBoxPopupControl<T>
Class Inheritance
Type Parameters
<T>
the type of the ComboBox control
Imports
java.util.List, java.util.function.Supplier, javafx.beans.property.BooleanProperty, .SimpleBooleanProperty, javafx.beans.value.ObservableValue, javafx.collections.FXCollections, .ListChangeListener, .ObservableList, .WeakListChangeListener, javafx.css.PseudoClass, javafx.event.ActionEvent, .EventTarget, javafx.scene.AccessibleAttribute, .AccessibleRole, .Node, .Parent, javafx.scene.control.ComboBox, .Control, .ListCell, .ListView, .SelectionMode, .SelectionModel, .SingleSelectionModel, .TextField, javafx.scene.input.KeyCode, .MouseEvent, javafx.util.Callback, .StringConverter, com.sun.javafx.scene.control.IDisconnectable, .ListenerHelper, com.sun.javafx.scene.control.behavior.ComboBoxBaseBehavior, .ComboBoxListViewBehavior

Default skin implementation for the ComboBox control.
Since
9
See Also
ComboBox

Field Summary

Modifier and TypeField and Description
private final ComboBoxListViewBehavior<T>
private ListCell<T>
private Callback<ListView<T>, ListCell<T>>
private static final String
private final ComboBox<T>
private ObservableList<T>
private final BooleanProperty
hideOnClick

By default this skin hides the popup whenever the ListView is clicked in. By setting hideOnClick to false, the popup will not be hidden when the ListView is clicked in. This is beneficial in some scenarios (for example, when the ListView cells have checkboxes).

private boolean
private boolean
private final ListView<T>
private ObservableList<T>
private final ListChangeListener<T>
private boolean
private static final PseudoClass
private static final PseudoClass
private static final PseudoClass
private IDisconnectable
private final WeakListChangeListener<T>
Inherited from javafx.scene.control.skin.ComboBoxPopupControl:
popup

Constructor Summary

AccessConstructor and Description
public
ComboBoxListViewSkin(final ComboBox<T>
The control that this skin should be installed onto.
control
)

Creates a new ComboBoxListViewSkin instance, installing the necessary child nodes into the Control children list, as well as the necessary input mappings for handling key, mouse, etc events.

Method Summary

Modifier and TypeMethod and Description
protected double
computeMaxHeight(double
The width of the Skin, in case this value might dictate the maximum height.
width
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

protected double
computeMaxWidth(double
The height of the Skin, in case this value might dictate the maximum width.
height
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computeMaxWidth.

Computes the maximum allowable width of the Skin, based on the provided height.

protected double
computeMinHeight(double
The width of the Skin, in case this value might dictate the minimum height.
width
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

protected double
computeMinWidth(double
The height of the Skin, in case this value might dictate the minimum width.
height
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.SkinBase.computeMinWidth.

Computes the minimum allowable width of the Skin, based on the provided height.

protected double
computePrefHeight(double
the width that should be used if preferred height depends on it
width
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computePrefHeight.

Calculates the preferred height of this SkinBase.

protected double
computePrefWidth(double
the height that should be used if preferred width depends on it
height
,
double
the pixel snapped top inset
topInset
,
double
the pixel snapped right inset
rightInset
,
double
the pixel snapped bottom inset
bottomInset
,
double
the pixel snapped left inset
leftInset
)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computePrefWidth.

Calculates the preferred width of this SkinBase.

private ListView<T>
public void
dispose()

Overrides javafx.scene.control.skin.ComboBoxPopupControl.dispose.

Implements javafx.scene.control.Skin.dispose.

Called when a previously installed skin is about to be removed from its associated control.

pack-priv ComboBoxBaseBehavior<T>
protected StringConverter<T>
getConverter()

Implements abstract javafx.scene.control.skin.ComboBoxPopupControl.getConverter.

Subclasses are responsible for getting the converter.

private Callback<ListView<T>, ListCell<T>>
public Node
getDisplayNode()

Implements abstract javafx.scene.control.skin.ComboBoxBaseSkin.getDisplayNode.

This method should return a Node that will be positioned within the ComboBox 'button' area.

protected TextField
getEditor()

Implements abstract javafx.scene.control.skin.ComboBoxPopupControl.getEditor.

Subclasses are responsible for getting the editor.

private int
pack-priv ListView<T>
private double
public Node
getPopupContent()

Implements abstract javafx.scene.control.skin.ComboBoxPopupControl.getPopupContent.

This method should return the Node that will be displayed when the user clicks on the ComboBox 'button' area.

public final BooleanProperty
public final boolean
protected void
layoutChildren(final double
the x position
x
,
final double
the y position
y
,
final double
the width
w
,
final double
the height
h
)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.layoutChildren.

Called during the layout pass of the scenegraph.

public Object
queryAccessibleAttribute(AccessibleAttribute
the requested attribute
attribute
,
Object...
optional list of parameters
parameters
)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

public final void
setHideOnClick(boolean value)

private void
private void
private void
pack-priv void
private boolean
updateDisplayText(ListCell<T> cell, T item, boolean empty)

private void
private void
Inherited from javafx.scene.control.skin.ComboBoxPopupControl:
getEditableInputNodegetPopuphideinstallreconfigurePopupsetTextFromTextFieldIntoComboBoxValueshowupdateEditable

Field Detail

behaviorback to summary
private final ComboBoxListViewBehavior<T> behavior
buttonCellback to summary
private ListCell<T> buttonCell
cellFactoryback to summary
private Callback<ListView<T>, ListCell<T>> cellFactory
COMBO_BOX_ROWS_TO_MEASURE_WIDTH_KEYback to summary
private static final String COMBO_BOX_ROWS_TO_MEASURE_WIDTH_KEY
comboBoxback to summary
private final ComboBox<T> comboBox
comboBoxItemsback to summary
private ObservableList<T> comboBoxItems
hideOnClickback to summary
private final BooleanProperty hideOnClick

By default this skin hides the popup whenever the ListView is clicked in. By setting hideOnClick to false, the popup will not be hidden when the ListView is clicked in. This is beneficial in some scenarios (for example, when the ListView cells have checkboxes).

itemCountDirtyback to summary
private boolean itemCountDirty
listSelectionLockback to summary
private boolean listSelectionLock
listViewback to summary
private final ListView<T> listView
listViewItemsback to summary
private ObservableList<T> listViewItems
listViewItemsListenerback to summary
private final ListChangeListener<T> listViewItemsListener
listViewSelectionDirtyback to summary
private boolean listViewSelectionDirty
PSEUDO_CLASS_EMPTYback to summary
private static final PseudoClass PSEUDO_CLASS_EMPTY
PSEUDO_CLASS_FILLEDback to summary
private static final PseudoClass PSEUDO_CLASS_FILLED
PSEUDO_CLASS_SELECTEDback to summary
private static final PseudoClass PSEUDO_CLASS_SELECTED
selectedItemWatcherback to summary
private IDisconnectable selectedItemWatcher
weakListViewItemsListenerback to summary
private final WeakListChangeListener<T> weakListViewItemsListener

Constructor Detail

ComboBoxListViewSkinback to summary
public ComboBoxListViewSkin(final ComboBox<T> control)

Creates a new ComboBoxListViewSkin instance, installing the necessary child nodes into the Control children list, as well as the necessary input mappings for handling key, mouse, etc events.

Parameters
control:ComboBox<T>

The control that this skin should be installed onto.

Method Detail

computeMaxHeightback to summary
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computeMaxHeight.

Doc from javafx.scene.control.skin.ComboBoxBaseSkin.computeMaxHeight.

Computes the maximum allowable height of the Skin, based on the provided width.

Parameters
width:double

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

The width of the Skin, in case this value might dictate the maximum height.

topInset:double

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

the pixel snapped top inset

rightInset:double

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

the pixel snapped right inset

bottomInset:double

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

the pixel snapped bottom inset

leftInset:double

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

the pixel snapped left inset

Returns:double

Doc from javafx.scene.control.SkinBase.computeMaxHeight.

A double representing the maximum height of this Skin.

Annotations
@Override
computeMaxWidthback to summary
protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computeMaxWidth.

Doc from javafx.scene.control.skin.ComboBoxBaseSkin.computeMaxWidth.

Computes the maximum allowable width of the Skin, based on the provided height.

Parameters
height:double

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

The height of the Skin, in case this value might dictate the maximum width.

topInset:double

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

the pixel snapped top inset

rightInset:double

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

the pixel snapped right inset

bottomInset:double

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

the pixel snapped bottom inset

leftInset:double

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

the pixel snapped left inset

Returns:double

Doc from javafx.scene.control.SkinBase.computeMaxWidth.

A double representing the maximum width of this Skin.

Annotations
@Override
computeMinHeightback to summary
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinHeight.

Doc from javafx.scene.control.SkinBase.computeMinHeight.

Computes the minimum allowable height of the Skin, based on the provided width.

Parameters
width:double

The width of the Skin, in case this value might dictate the minimum height.

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

A double representing the minimum height of this Skin.

Annotations
@Override
computeMinWidthback to summary
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.SkinBase.computeMinWidth.

Doc from javafx.scene.control.SkinBase.computeMinWidth.

Computes the minimum allowable width of the Skin, based on the provided height.

Parameters
height:double

The height of the Skin, in case this value might dictate the minimum width.

topInset:double

the pixel snapped top inset

rightInset:double

the pixel snapped right inset

bottomInset:double

the pixel snapped bottom inset

leftInset:double

the pixel snapped left inset

Returns:double

A double representing the minimum width of this Skin.

Annotations
@Override
computePrefHeightback to summary
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computePrefHeight.

Doc from javafx.scene.control.skin.ComboBoxBaseSkin.computePrefHeight.

Calculates the preferred height of this SkinBase. The default implementation calculates this height as the height of the area occupied by its managed children when they are positioned at their current positions at their preferred heights.

Parameters
width:double

Doc from javafx.scene.control.SkinBase.computePrefHeight.

the width that should be used if preferred height depends on it

topInset:double

Doc from javafx.scene.control.SkinBase.computePrefHeight.

the pixel snapped top inset

rightInset:double

Doc from javafx.scene.control.SkinBase.computePrefHeight.

the pixel snapped right inset

bottomInset:double

Doc from javafx.scene.control.SkinBase.computePrefHeight.

the pixel snapped bottom inset

leftInset:double

Doc from javafx.scene.control.SkinBase.computePrefHeight.

the pixel snapped left inset

Returns:double

Doc from javafx.scene.control.SkinBase.computePrefHeight.

the calculated preferred height

Annotations
@Override
computePrefWidthback to summary
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.computePrefWidth.

Doc from javafx.scene.control.skin.ComboBoxBaseSkin.computePrefWidth.

Calculates the preferred width of this SkinBase. The default implementation calculates this width as the width of the area occupied by its managed children when they are positioned at their current positions at their preferred widths.

Parameters
height:double

Doc from javafx.scene.control.SkinBase.computePrefWidth.

the height that should be used if preferred width depends on it

topInset:double

Doc from javafx.scene.control.SkinBase.computePrefWidth.

the pixel snapped top inset

rightInset:double

Doc from javafx.scene.control.SkinBase.computePrefWidth.

the pixel snapped right inset

bottomInset:double

Doc from javafx.scene.control.SkinBase.computePrefWidth.

the pixel snapped bottom inset

leftInset:double

Doc from javafx.scene.control.SkinBase.computePrefWidth.

the pixel snapped left inset

Returns:double

Doc from javafx.scene.control.SkinBase.computePrefWidth.

the calculated preferred width

Annotations
@Override
createListViewback to summary
private ListView<T> createListView()
disposeback to summary
public void dispose()

Overrides javafx.scene.control.skin.ComboBoxPopupControl.dispose.

Implements javafx.scene.control.Skin.dispose.

Doc from javafx.scene.control.SkinBase.dispose.

Called when a previously installed skin is about to be removed from its associated control. This allows the skin to do clean up, like removing listeners and bindings, and undo any changes to the control's properties. After this method completes, getSkinnable() and getNode() should return null.

Calling dispose() more than once has no effect.

Annotations
@Override
getBehaviorback to summary
pack-priv ComboBoxBaseBehavior<T> getBehavior()

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.getBehavior.

Annotations
@Override
getConverterback to summary
protected StringConverter<T> getConverter()

Implements abstract javafx.scene.control.skin.ComboBoxPopupControl.getConverter.

Doc from javafx.scene.control.skin.ComboBoxPopupControl.getConverter.

Subclasses are responsible for getting the converter. This will be removed in FX 9 when the converter property is moved up to ComboBoxBase with JDK-8130354.

Returns:StringConverter<T>

the string converter

Annotations
@Override
getDefaultCellFactoryback to summary
private Callback<ListView<T>, ListCell<T>> getDefaultCellFactory()
getDisplayNodeback to summary
public Node getDisplayNode()

Implements abstract javafx.scene.control.skin.ComboBoxBaseSkin.getDisplayNode.

Doc from javafx.scene.control.skin.ComboBoxBaseSkin.getDisplayNode.

This method should return a Node that will be positioned within the ComboBox 'button' area.

Returns:Node

the node that will be positioned within the ComboBox 'button' area

Annotations
@Override
getEditorback to summary
protected TextField getEditor()

Implements abstract javafx.scene.control.skin.ComboBoxPopupControl.getEditor.

Doc from javafx.scene.control.skin.ComboBoxPopupControl.getEditor.

Subclasses are responsible for getting the editor. This will be removed in FX 9 when the editor property is moved up to ComboBoxBase with JDK-8130354 Note: ComboBoxListViewSkin should return null if editable is false, even if the ComboBox does have an editor set.

Returns:TextField

the editor

Annotations
@Override
getIndexOfComboBoxValueInItemsListback to summary
private int getIndexOfComboBoxValueInItemsList()
getListViewback to summary
pack-priv ListView<T> getListView()
getListViewPrefHeightback to summary
private double getListViewPrefHeight()
getPopupContentback to summary
public Node getPopupContent()

Implements abstract javafx.scene.control.skin.ComboBoxPopupControl.getPopupContent.

Doc from javafx.scene.control.skin.ComboBoxPopupControl.getPopupContent.

This method should return the Node that will be displayed when the user clicks on the ComboBox 'button' area.

Returns:Node

the Node that will be displayed when the user clicks on the ComboBox 'button' area

Annotations
@Override
hideOnClickPropertyback to summary
public final BooleanProperty hideOnClickProperty()
isHideOnClickback to summary
public final boolean isHideOnClick()
layoutChildrenback to summary
protected void layoutChildren(final double x, final double y, final double w, final double h)

Overrides javafx.scene.control.skin.ComboBoxBaseSkin.layoutChildren.

Doc from javafx.scene.control.skin.ComboBoxBaseSkin.layoutChildren.

Called during the layout pass of the scenegraph.

Parameters
x:double

Doc from javafx.scene.control.SkinBase.layoutChildren.

the x position

y:double

Doc from javafx.scene.control.SkinBase.layoutChildren.

the y position

w:double

Doc from javafx.scene.control.SkinBase.layoutChildren.

the width

h:double

Doc from javafx.scene.control.SkinBase.layoutChildren.

the height

Annotations
@Override
queryAccessibleAttributeback to summary
public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters)

Overrides javafx.scene.control.SkinBase.queryAccessibleAttribute.

Doc from javafx.scene.control.SkinBase.queryAccessibleAttribute.

This method is called by the assistive technology to request the value for an attribute.

This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
If a particular attribute is not handled, the superclass implementation must be called.

Parameters
attribute:AccessibleAttribute

the requested attribute

parameters:Object[]

optional list of parameters

Returns:Object

the value for the requested attribute

Annotations
@Override
setHideOnClickback to summary
public final void setHideOnClick(boolean value)
updateButtonCellback to summary
private void updateButtonCell()
updateCellFactoryback to summary
private void updateCellFactory()
updateComboBoxItemsback to summary
private void updateComboBoxItems()
updateDisplayNodeback to summary
pack-priv void updateDisplayNode()

Overrides javafx.scene.control.skin.ComboBoxPopupControl.updateDisplayNode.

Annotations
@Override
updateDisplayTextback to summary
private boolean updateDisplayText(ListCell<T> cell, T item, boolean empty)
updateListViewItemsback to summary
private void updateListViewItems()
updateValueback to summary
private void updateValue()