Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class SelectionBox<T>

extends Control
Class Inheritance
Known Direct Subclasses
com.dlsc.gemsfx.TimeRangePicker, com.dlsc.gemsfx.DayOfWeekPicker
Imports
com.dlsc.gemsfx.skins.SelectionBoxSkin, com.dlsc.gemsfx.util.CustomMultipleSelectionModel, javafx.beans.InvalidationListener, javafx.beans.binding.ObjectBinding, javafx.beans.property.BooleanProperty, .ListProperty, .ObjectProperty, .ObjectPropertyBase, .ReadOnlyObjectProperty, .ReadOnlyObjectWrapper, .SimpleBooleanProperty, .SimpleListProperty, .SimpleObjectProperty, .SimpleStringProperty, .StringProperty, javafx.collections.FXCollections, .ObservableList, javafx.css.CssMetaData, .StyleConverter, .Styleable, .StyleableBooleanProperty, .StyleableProperty, javafx.event.EventHandler, javafx.scene.Node, javafx.scene.control.Button, .Control, .MultipleSelectionModel, .SelectionMode, .Skin, javafx.scene.layout.Region, .VBox, javafx.stage.WindowEvent, javafx.util.StringConverter, java.util.ArrayList, .Collection, .Collections, .List, .Objects

A versatile and customizable selection control that combines the features of ComboBox and ChoiceBox with enhanced selection capabilities.

Unlike ComboBox and ChoiceBox, which are limited to single selection modes, SelectionBox supports both single and multiple selection modes, providing greater flexibility for various UI requirements. Additionally, SelectionBox offers the ability to add extra buttons, enabling users to perform common selection actions swiftly, such as selecting all items, clearing selections, or applying predefined selection criteria.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private BooleanProperty
private BooleanProperty
private final ObjectProperty<Node>
private final ReadOnlyObjectWrapper<SelectionMode>
private static final boolean
private static final boolean
private static final String
private ObjectProperty<Node>
private ObjectProperty<StringConverter<T>>
private final ListProperty<T>
private final ObjectProperty<Node>
private ObjectProperty<EventHandler<WindowEvent>>
private ObjectProperty<EventHandler<WindowEvent>>
private ObjectProperty<EventHandler<WindowEvent>>
private ObjectProperty<EventHandler<WindowEvent>>
private final ObjectProperty<Node>
private StringProperty
private BooleanProperty
private final ObjectProperty<Node>
private ObjectProperty<StringConverter<List<T>>>
private final ObjectProperty<MultipleSelectionModel<T>>
private final ObjectProperty<Node>

Constructor Summary

AccessConstructor and Description
public
SelectionBox()

Constructs a new SelectionBox instance.

public
SelectionBox(Collection<T>
the collection of items to populate the SelectionBox
items
)

Constructs a new selection box with the specified collection of items.

public
SelectionBox(T...
The initial items to populate the selection box. These items will be added to the selection box's list of choices.
items
)

Constructs a new selection box and populates it with the provided items.

Method Summary

Modifier and TypeMethod and Description
public final BooleanProperty
public final BooleanProperty

Returns:

a BooleanProperty to control the auto-hide behavior of the popup.
autoHideOnSelectionProperty
()

Controls whether the popup should auto-hide when an item or the extra button is clicked.

public final ObjectProperty<Node>
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public Button

Returns:

the created Button instance
createExtraButton
(String
the text to be displayed on the button
text
,
Runnable
the action to be executed when the button is clicked
action
)

Creates an extra button with the specified text and action.

public Button

Returns:

the created Button instance
createExtraButton
(String
the text to be displayed on the button
text
,
Node
the graphic node to be displayed on the button
graphic
,
Runnable
the action to be executed when the button is clicked
action
)

Creates an extra button with the specified text, graphic, and action.

private Node
public final ReadOnlyObjectProperty<SelectionMode>

Returns:

a read-only SelectionMode property
currentSelectionModeProperty
()

Provides a read-only property that directly exposes the current SelectionMode of this control without requiring multilevel checks on the underlying javafx.scene.control.MultipleSelectionModel.

public final Node
public static List<CssMetaData<? extends Styleable, ?>>
getClassCssMetaData()

Hides javafx.scene.control.Control.getClassCssMetaData.

Gets the CssMetaData associated with this class, which may include the CssMetaData of its superclasses.

public List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Gets the unmodifiable list of the control's CSS-styleable properties.

public final SelectionMode
private ObjectBinding<SelectionMode>

Returns:

an ObjectBinding that provides the current SelectionMode of the MultipleSelectionModel, or null if no selection model is set
getCurrentSelectionModeBinding
()

Creates and returns an ObjectBinding that observes changes to the selectionModelProperty() and its associated selectionModeProperty().

public final Node
public final StringConverter<T>
public final ObservableList<T>
public final Node
public final EventHandler<WindowEvent>
public final EventHandler<WindowEvent>
public final EventHandler<WindowEvent>
public final EventHandler<WindowEvent>
public final Node
public final String
public final Node
public final StringConverter<List<T>>
public final MultipleSelectionModel<T>
public final Node
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final ObjectProperty<Node>

Returns:

the ObjectProperty containing the graphical Node.
graphicProperty
()

Returns the graphic property of this ChoicePicker.

public final void
hide()

Hides the popup by setting the "showPopup" property to false on the component's properties.

public final boolean
public final boolean
public final boolean
public final ObjectProperty<StringConverter<T>>

Returns:

the property object for the string converter used to format individual items.
itemConverterProperty
()

Retrieves the property object for the string converter that formats the display of individual items.

public final ListProperty<T>

Returns:

the list property containing the items
itemsProperty
()

The list of items to be displayed in the SelectionBox.

public final ObjectProperty<Node>
public final ObjectProperty<EventHandler<WindowEvent>>

Returns:

the property holding the handler invoked after the popup is hidden
onHiddenProperty
()

The event handler property invoked after the SelectionPopup has been hidden.

public final ObjectProperty<EventHandler<WindowEvent>>

Returns:

the property holding the handler invoked before the popup is hidden
onHidingProperty
()

The event handler property invoked before the SelectionPopup is hidden.

public final ObjectProperty<EventHandler<WindowEvent>>

Returns:

the property holding the handler invoked before showing the popup
onShowingProperty
()

The event handler property invoked before the SelectionPopup is shown.

public final ObjectProperty<EventHandler<WindowEvent>>

Returns:

the property holding the handler invoked after the popup is shown
onShownProperty
()

The event handler property invoked after the SelectionPopup has been shown.

public final ObjectProperty<Node>

Returns:

the placeholder property
placeholderProperty
()

Returns the property holding the placeholder node, which is displayed when there are no items.

public final StringProperty

Returns:

the StringProperty containing the prompt text.
promptTextProperty
()

Returns the prompt text property of this SelectionBox.

public final BooleanProperty

Returns:

the BooleanProperty controlling the read-only state of the SelectionBox.
readOnlyProperty
()

Returns the BooleanProperty that controls the read-only state of the SelectionBox.

public final ObjectProperty<Node>
public final ObjectProperty<StringConverter<List<T>>>

Returns:

the property object for the string converter that formats the display of selected items.
selectedItemsConverterProperty
()

Retrieves the property object for a string converter used to format the display of selected items.

public final ObjectProperty<MultipleSelectionModel<T>>

Returns:

the ObjectProperty containing the selection model.
selectionModelProperty
()

Returns the property object for the selection model used by this SelectionBox.

public final void
setAnimationEnabled(boolean value)

public final void
setAutoHideOnSelection(boolean autoHideOnSelection)

public final void
setBottom(Node bottom)

public final void
setGraphic(Node graphic)

public final void
public final void
public final void
setLeft(Node left)

public final void
public final void
public final void
public final void
public final void
setPlaceholder(Node placeholder)

public final void
setPromptText(String promptText)

public final void
setReadOnly(boolean readOnly)

public final void
setRight(Node right)

public final void
setSelectedItemsConverter(StringConverter<List<T>> selectedItemsConverter)

public final void
public final void
setTop(Node top)

public final void
show()

Displays the popup by setting the "showPopup" property to true on the component's properties.

public final ObjectProperty<Node>
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty