Top Description Fields Constructors Methods
com.dlsc.pickerfx

public Class Segment<T, S>

extends Control
Class Inheritance
Known Direct Subclasses
com.dlsc.pickerfx.DigitsSegment
Type Parameters
<T>
The picker's value type.
<S>
The segment's value type.
Imports
com.dlsc.pickerfx.skins.SegmentSkin, javafx.beans.property.BooleanProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ObservableList, javafx.css.CssMetaData, .Styleable, javafx.scene.control.Control, .Skin, javafx.scene.layout.Region, javafx.util.Callback, java.util.List, .Objects

A segment represents one single selection block that contains elements which the user can pick from. Basically a segment is composed by a predefined list of elements (items), and one selected value.

Usually a segment is one piece of a bigger control called Picker, so in order to use segments a picker must be created. In that sense, every time a Segment instance is required, it is also necessary to have a Picker instance. The segment's value is independent of the picker value, so they do not have any direct binding. However the segment's value can be used to compose the picker's value.

See Also
Picker

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Callback<Segment<T, S>, SegmentCell<S>>>
private final ObservableList<S>
private final Picker<T>
private final BooleanProperty
private final ObjectProperty<S>
private final BooleanProperty

Constructor Summary

AccessConstructor and Description
public
Segment(Picker<T>
The picker parent of this segment control.
picker
)

Creates a new instance of a segment with the given list of items and null value.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Callback<Segment<T, S>, SegmentCell<S>>>
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

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

public final Callback<Segment<T, S>, SegmentCell<S>>
protected List<CssMetaData<? extends Styleable, ?>>
getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

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

public final ObservableList<S>

Returns:

The list of items available for the segment.
getItems
()

public final Picker<T>

Returns:

The picker parent of this segment instance.
getPicker
()

public final S
public final boolean
public final boolean
public final BooleanProperty
public final void
setCellFactory(Callback<Segment<T, S>, SegmentCell<S>> cellFactory)

public final void
setReadOnly(boolean readOnly)

public final void
setValue(S value)

public final void
setWrapItems(boolean wrapItems)

public final ObjectProperty<S>

Returns:

The object property that holds the selected value.
valueProperty
()

public final BooleanProperty
Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetClassCssMetaDatagetContextMenugetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

cellFactoryback to summary
private final ObjectProperty<Callback<Segment<T, S>, SegmentCell<S>>> cellFactory
itemsback to summary
private final ObservableList<S> items
pickerback to summary
private final Picker<T> picker
readOnlyback to summary
private final BooleanProperty readOnly
valueback to summary
private final ObjectProperty<S> value
wrapItemsback to summary
private final BooleanProperty wrapItems

Constructor Detail

Segmentback to summary
public Segment(Picker<T> picker)

Creates a new instance of a segment with the given list of items and null value.

Parameters
picker:Picker<T>

The picker parent of this segment control.

Method Detail

cellFactoryPropertyback to summary
public final ObjectProperty<Callback<Segment<T, S>, SegmentCell<S>>> cellFactoryProperty()
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Returns:Skin<?>

new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.

Annotations
@Override
getCellFactoryback to summary
public final Callback<Segment<T, S>, SegmentCell<S>> getCellFactory()
getControlCssMetaDataback to summary
protected List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData()

Overrides javafx.scene.control.Control.getControlCssMetaData.

Doc from javafx.scene.control.Control.getControlCssMetaData.

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

Returns:List<CssMetaData<? extends Styleable, ?>>

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

Annotations
@Override
getItemsback to summary
public final ObservableList<S> getItems()
Returns:ObservableList<S>

The list of items available for the segment.

getPickerback to summary
public final Picker<T> getPicker()
Returns:Picker<T>

The picker parent of this segment instance.

getValueback to summary
public final S getValue()
isReadOnlyback to summary
public final boolean isReadOnly()
isWrapItemsback to summary
public final boolean isWrapItems()
readOnlyPropertyback to summary
public final BooleanProperty readOnlyProperty()
setCellFactoryback to summary
public final void setCellFactory(Callback<Segment<T, S>, SegmentCell<S>> cellFactory)
setReadOnlyback to summary
public final void setReadOnly(boolean readOnly)
setValueback to summary
public final void setValue(S value)
setWrapItemsback to summary
public final void setWrapItems(boolean wrapItems)
valuePropertyback to summary
public final ObjectProperty<S> valueProperty()
Returns:ObjectProperty<S>

The object property that holds the selected value.

wrapItemsPropertyback to summary
public final BooleanProperty wrapItemsProperty()