- All Implemented Interfaces:
Styleable
,EventTarget
,Skinnable
The RangeSlider
control is simply a JavaFX
Slider
control with support for two 'thumbs', rather than one. A thumb is the
non-technical name for the draggable area inside the
Slider
/RangeSlider
that allows for a value to be set.
Because the RangeSlider has two thumbs, it also has a few additional rules and user interactions:
- The 'lower value' thumb can not move past the 'higher value' thumb.
- Whereas the
Slider
control only has onevalue
property, theRangeSlider
has alow value
and ahigh value
property, not surprisingly represented by the 'low value' and 'high value' thumbs. - The area between the low and high values represents the allowable range. For example, if the low value is 2 and the high value is 8, then the allowable range is between 2 and 8.
- The allowable range area is rendered differently. This area is able to be dragged with mouse/touch input to allow for the entire range to be modified. For example, following on from the previous example of the allowable range being between 2 and 8, if the user drags the range bar to the right, the low value will adjust to 3, and the high value 9, and so on until the user stops adjusting.
Code Samples
Instantiating a RangeSlider
is simple. The first decision is to
decide whether a horizontal or a vertical track is more appropriate. By
default RangeSlider
instances are horizontal, but this can be
changed by setting the
orientation
property.
Once the orientation is determined, the next most important decision is
to determine what the
min
/max
and default
low
/high
values are. The min
/max
values represent the smallest and
largest legal values for the thumbs to be set to, whereas the
low
/high
values represent where the thumbs are currently,
within the bounds of the min
/max
values. Because all four
values are required in all circumstances, they are all required parameters
to instantiate a RangeSlider
: the
constructor
takes four doubles, representing min
, max
, lowValue
and highValue
(in that order).
For example, here is a simple horizontal RangeSlider
that has a
minimum value of 0, a maximum value of 100, a low value of 10 and a high
value of 90:
final RangeSlider hSlider = new RangeSlider( 0, 100, 10, 90 );
To create a vertical slider, simply do the following:
final RangeSlider vSlider = new RangeSlider( 0, 200, 30, 150 );
vSlider.setOrientation( Orientation.VERTICAL );
This code creates a vertical RangeSlider
with a min
value of 0, a max
value of 200, a low
value of 30, and a
high
value of 150.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: RangeSlider.java 1121 2024-03-16 16:51:23Z tquadrat $
- Since:
- 0.4.6
- See Also:
- Inspired through:
- ControlsFX Project
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.fx.control.RangeSlider"
-
Property Summary
PropertiesTypePropertyDescriptionfinal DoubleProperty
Returns a reference to the property that holds the amount by which to adjust the slider if the track of the slider is clicked.final BooleanProperty
Returns a reference to the property that indicates a change to the high value of thisRangeSlider
.final DoubleProperty
Returns a reference to the property that holds the high value.final ObjectProperty
<StringConverter<Number>> Returns a reference to the property that holds theStringConverter
that is used to format the tick mark labels.final BooleanProperty
Returns a reference to the property that indicates a change to the low value of thisRangeSlider
.final DoubleProperty
Returns a reference to the property that holds the low value.final DoubleProperty
Returns a reference to the property that holds the unit distance between major tick marks.final DoubleProperty
Returns a reference to the property that holds the maximum value for thisRangeSlider
.final IntegerProperty
Returns a reference to the property that holds the number of minor ticks to place between any two major ticks.final DoubleProperty
Returns a reference to the property that holds the minimum value for thisRangeSlider
.final ObjectProperty
<Orientation> Returns a reference to the property that holds the orientation of thisRangeSlider
.final BooleanProperty
Returns a reference to the property that holds the flag that indicates that the labels for tick marks should be shown.final BooleanProperty
Returns a reference to the property that holds the flag that specifies whether theSkin
implementation should show tick marks.final BooleanProperty
Returns a reference to the property that holds the flag that indicates whether the low value/high value thumbs of theRangeSlider
should always be aligned with the tick marks.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltip
Properties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width
Properties inherited from class javafx.scene.Parent
needsLayout
Properties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, 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, viewOrder, visible
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final class
The styleable properties forRangeSlider
. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default style class forRangeSlider
instances: "range-slider".private static final PseudoClass
The CSS pseudo class for the horizontal orientation of aRangeSlider
.private final StyleableDoubleProperty
The property for the amount by which to adjust the slider if the track of the slider is clicked.private final BooleanProperty
The property that indicates a change to the high value of thisRangeSlider
.private final DoubleProperty
The high value property.private final BooleanProperty
The property that indicates a change to the low value of thisRangeSlider
.private final DoubleProperty
The low value property.private final StyleableDoubleProperty
The property for the unit distance between major tick marks.private final DoubleProperty
The property for the maximum value of thisRangeSlider
.private final StyleableIntegerProperty
The property for the number of minor ticks to place between any two major ticks.private final DoubleProperty
The property for the maximum value of thisRangeSlider
.private final StyleableObjectProperty
<Orientation> The property that holds the orientation of thisRangeSlider
.private final StyleableBooleanProperty
The property for the flag that indicates whether the labels for the tick marks are shown or not.private final StyleableBooleanProperty
The property that holds the flag that specifies whether theSkin
implementation should show tick marks for thisRangeSlider
.private final StyleableBooleanProperty
The property for the flag that controls whether the thumbs will snap to the tick marks.private final ObjectProperty
<StringConverter<Number>> The property for the tick label formatter.private static final PseudoClass
The CSS pseudo class for the vertical orientation of aRangeSlider
.Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZE
Fields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newRangeSlider
instance using default values of 0.0, 0.25, 0.75 and 1.0 for min/lowValue/highValue/max, respectively.RangeSlider
(double min, double max, double lowValue, double highValue) Instantiates a default, horizontalRangeSlider
instance with the specified min/max/low/high values. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
adjustHighValue
(double newHigh) private final void
Adjusts the high value.final void
adjustLowValue
(double newLow) private final void
Adjusts the low value.private final void
Ensures thatmin
is always <max
, that the currentvalue
is always somewhere between the two, and that ifsnapToTicks
is set then thevalue
will always be set to align with a tick mark.final DoubleProperty
Returns a reference to the property that holds the amount by which to adjust the slider if the track of the slider is clicked.protected final Skin
<?> final void
Decrements the high value by the block increment amount.final void
Decrements the low value by the block increment amount.final double
Returns the amount by which to adjust the slider if the track of the slider is clicked.static List
<CssMetaData<? extends Styleable, ?>> Gets theCssMetaData
associated with this class, which may include theCssMetaData
of its super classes.final List
<CssMetaData<? extends Styleable, ?>> final double
Returns the current high value for the range slider.final StringConverter
<Number> Returns the tick label formatter.final double
Returns the current low value for the range slider.final double
Returns the unit distance between major tick marks.final double
getMax()
Returns the maximum value for thisRangeSlider
.final double
getMin()
Returns the minimum value for thisRangeSlider
.final int
Returns the number of minor ticks to place between any two major ticks.final Orientation
Returns the orientation of theRangeSlider
.final String
final BooleanProperty
Returns a reference to the property that indicates a change to the high value of thisRangeSlider
.final DoubleProperty
Returns a reference to the property that holds the high value.final void
Increments the high value by the block increment amount.final void
Increments the low value value by the block increment amount.final boolean
Returns whether the high value of thisRangeSlider
is currently changing.final boolean
Returns whether the low value of thisRangeSlider
is currently changing.final boolean
Returns the flag indicating whether labels of tick marks are being shown.final boolean
Returns the flag indication whether the tick marks are shown.final boolean
Returns the flag that controls whether the thumbs will snap to the tick marks.final ObjectProperty
<StringConverter<Number>> Returns a reference to the property that holds theStringConverter
that is used to format the tick mark labels.final BooleanProperty
Returns a reference to the property that indicates a change to the low value of thisRangeSlider
.final DoubleProperty
Returns a reference to the property that holds the low value.final DoubleProperty
Returns a reference to the property that holds the unit distance between major tick marks.final DoubleProperty
Returns a reference to the property that holds the maximum value for thisRangeSlider
.final IntegerProperty
Returns a reference to the property that holds the number of minor ticks to place between any two major ticks.final DoubleProperty
Returns a reference to the property that holds the minimum value for thisRangeSlider
.final ObjectProperty
<Orientation> Returns a reference to the property that holds the orientation of thisRangeSlider
.final void
setBlockIncrement
(double value) Sets the amount by which to adjust the slider if the track of the slider is clicked.final void
setHighValue
(double high) final void
setHighValueChanging
(boolean flag) Call this when high value is changing.final void
setLabelFormatter
(StringConverter<Number> formatter) Sets the tick label formatter.final void
setLowValue
(double low) final void
setLowValueChanging
(boolean flag) Call this when the low value is changing.final void
setMajorTickUnit
(double tickUnit) Sets the unit distance between major tick marks.final void
setMax
(double max) Sets the maximum value for thisRangeSlider
.final void
setMin
(double min) Sets the minimum value for thisRangeSlider
.final void
setMinorTickCount
(int numberOfTicks) Sets the number of minor ticks to place between any two major ticks.final void
setOrientation
(Orientation orientation) Sets the orientation of theRangeSlider
.final void
setShowTickLabels
(boolean flag) Sets whether labels of tick marks should be shown or not.final void
setShowTickMarks
(boolean flag) Sets whether tick marks should be shown or not.final void
setSnapToTicks
(boolean flag) Sets the flag that controls whether the thumbs will snap to the tick marks.final BooleanProperty
Returns a reference to the property that holds the flag that indicates that the labels for tick marks should be shown.final BooleanProperty
Returns a reference to the property that holds the flag that specifies whether theSkin
implementation should show tick marks.final BooleanProperty
Returns a reference to the property that holds the flag that indicates whether the low value/high value thumbs of theRangeSlider
should always be aligned with the tick marks.private final double
snapValueToTicks
(double value) Aligns the given value with the nearest tick mark value.Methods inherited from class org.tquadrat.foundation.fx.internal.FoundationFXControl
getUserAgentStylesheet
Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty
Methods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, 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, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty
Methods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
Methods inherited from class javafx.scene.Node
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, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, 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, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, 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, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
blockIncrement
Returns a reference to the property that holds the amount by which to adjust the slider if the track of the slider is clicked. This is used when manipulating the slider position using keys. If
snapToTicks
istrue
then the nearest tick mark to the adjusted value will be used.- See Also:
-
highValueChanging
Returns a reference to the property that indicates a change to the high value of this
RangeSlider
.When the property is set to
true
, it indicates that the current high value of thisRangeSlider
is changing. It provides notification that the high value is changing. Once the high value is computed, it is set back tofalse
.- See Also:
-
highValue
Returns a reference to the property that holds the high value.
The high value property represents the current position of the high value thumb, and is within the allowable range as specified by the
min
andmax
properties. By default this value is 100.- See Also:
-
labelFormatter
Returns a reference to the property that holds the
StringConverter
that is used to format the tick mark labels.If
null
, a default will be used.- See Also:
-
lowValueChanging
Returns a reference to the property that indicates a change to the low value of this
RangeSlider
.When the property is set to
true
, it indicates that the current low value of thisRangeSlider
is changing. It provides notification that the low value is changing. Once the low value is computed, the property is set back tofalse
.- See Also:
-
lowValue
Returns a reference to the property that holds the low value.
The low value property represents the current position of the low value thumb, and is within the allowable range as specified by the
min
andmax
properties. By default this value is 0.- See Also:
-
majorTickUnit
Returns a reference to the property that holds the unit distance between major tick marks. For example, if the min value is 0 and the max value is 100 and the
majorTickUnit
is set to 25, then there would be 5 tick marks: one at position 0, one at position 25, one at position 50, one at position 75, and a final one at position 100.This value should be positive and should be a value less than the span. Out of range values are essentially the same as disabling tick marks.
- See Also:
-
max
Returns a reference to the property that holds the maximum value for this
RangeSlider
.- See Also:
-
minorTickCount
Returns a reference to the property that holds the number of minor ticks to place between any two major ticks. This number should be positive or zero. Out of range values will disable minor ticks, as will a value of zero.
- See Also:
-
min
Returns a reference to the property that holds the minimum value for this
RangeSlider
.- See Also:
-
orientation
Returns a reference to the property that holds the orientation of this
RangeSlider
.The orientation can either be horizontal or vertical.
- See Also:
-
showTickLabels
Returns a reference to the property that holds the flag that indicates that the labels for tick marks should be shown.
Typically, a
Skin
implementation will only show labels ifshowTickMarks
is alsotrue
.- See Also:
-
showTickMarks
Returns a reference to the property that holds the flag that specifies whether the
Skin
implementation should show tick marks.- See Also:
-
snapToTicks
Returns a reference to the property that holds the flag that indicates whether the low value/high value thumbs of the
RangeSlider
should always be aligned with the tick marks. This is honored even if the tick marks are not shown.- See Also:
-
-
Field Details
-
DEFAULT_STYLE_CLASS
The default style class forRangeSlider
instances: "range-slider".- See Also:
-
m_BlockIncrementProperty
The property for the amount by which to adjust the slider if the track of the slider is clicked. -
m_HighValueChangingProperty
The property that indicates a change to the high value of this
RangeSlider
. -
m_HighValueProperty
-
m_LowValueChangingProperty
The property that indicates a change to the low value of this
RangeSlider
. -
m_LowValueProperty
-
m_MajorTickUnitProperty
The property for the unit distance between major tick marks. -
m_MaxProperty
The property for the maximum value of thisRangeSlider
. -
m_MinorTickCountProperty
The property for the number of minor ticks to place between any two major ticks. -
m_MinProperty
The property for the maximum value of thisRangeSlider
. -
m_OrientationProperty
The property that holds the orientation of thisRangeSlider
. -
m_ShowTickLabelsProperty
The property for the flag that indicates whether the labels for the tick marks are shown or not. -
m_ShowTickMarksProperty
The property that holds the flag that specifies whether theSkin
implementation should show tick marks for thisRangeSlider
. -
m_SnapToTicksProperty
The property for the flag that controls whether the thumbs will snap to the tick marks. -
m_TickLabelFormatterProperty
The property for the tick label formatter. -
HORIZONTAL_PSEUDOCLASS_STATE
The CSS pseudo class for the horizontal orientation of aRangeSlider
. -
VERTICAL_PSEUDOCLASS_STATE
The CSS pseudo class for the vertical orientation of aRangeSlider
.
-
-
Constructor Details
-
RangeSlider
public RangeSlider()Creates a newRangeSlider
instance using default values of 0.0, 0.25, 0.75 and 1.0 for min/lowValue/highValue/max, respectively. -
RangeSlider
Instantiates a default, horizontalRangeSlider
instance with the specified min/max/low/high values.- Parameters:
min
- The minimum allowable value that theRangeSlider
will allow.max
- The maximum allowable value that theRangeSlider
will allow.lowValue
- The initial value for the low value in theRangeSlider
.highValue
- The initial value for the high value in theRangeSlider
.
-
-
Method Details
-
adjustHighValue
Adjusts highValue to match the given
newHigh
, or as closely as possible within the constraints imposed by themin
andmax
properties. This method also takes into account thesnapToTicks
flag, which is the main difference betweenadjustHighValue()
andsetHighValue()
.- Parameters:
newHigh
- The new value.
-
adjustHighValues
Adjusts the high value.- See Also:
-
adjustLowValue
Adjusts the lowValue to match the given
newLow
, or as closely as possible within the constraints imposed by themin
andmax
properties. This method also takes into account thesnapToTicks
flag, which is the main difference betweenadjustLowValue()
andsetLowValue()
.- Parameters:
newLow
- The new value.
-
adjustLowValues
Adjusts the low value.- See Also:
-
adjustValues
Ensures thatmin
is always <max
, that the currentvalue
is always somewhere between the two, and that ifsnapToTicks
is set then thevalue
will always be set to align with a tick mark. -
blockIncrementProperty
Returns a reference to the property that holds the amount by which to adjust the slider if the track of the slider is clicked. This is used when manipulating the slider position using keys. If
snapToTicks
istrue
then the nearest tick mark to the adjusted value will be used.- Returns:
- The property reference.
- See Also:
-
createDefaultSkin
- Overrides:
createDefaultSkin
in classControl
-
decrementHighValue
Decrements the high value by the block increment amount. -
decrementLowValue
Decrements the low value by the block increment amount. -
getBlockIncrement
Returns the amount by which to adjust the slider if the track of the slider is clicked.- Returns:
- The amount by which to adjust the slider if the track of the slider is clicked.
- See Also:
-
getClassCssMetaData
Gets theCssMetaData
associated with this class, which may include theCssMetaData
of its super classes.- Returns:
- The
CssMetaData
for this class.
-
getControlCssMetaData
- Overrides:
getControlCssMetaData
in classControl
-
getHighValue
Returns the current high value for the range slider.- Returns:
- The high value.
-
getLabelFormatter
Returns the tick label formatter.- Returns:
- The
StringConverter
that is used as the tick label formatter.
-
getLowValue
Returns the current low value for the range slider.- Returns:
- The low value.
-
getMajorTickUnit
Returns the unit distance between major tick marks.- Returns:
- The unit distance between major tick marks.
- See Also:
-
getMax
Returns the maximum value for this
RangeSlider
.100 is returned if the maximum value has never been set.
- Returns:
- The maximum value for this range slider.
-
getMin
Returns the minimum value for this
RangeSlider
.0 is returned if the minimum has never been set.
- Returns:
- The minimum value for this range slider.
-
getMinorTickCount
Returns the number of minor ticks to place between any two major ticks.- Returns:
- The number of minor ticks to place between any two major ticks.
- See Also:
-
getOrientation
Returns the orientation of theRangeSlider
.- Returns:
- The orientation of the
RangeSlider
.Orientation.HORIZONTAL
is returned by default.
-
getUserAgentStylesheet
- Overrides:
getUserAgentStylesheet
in classRegion
-
highValueChangingProperty
Returns a reference to the property that indicates a change to the high value of this
RangeSlider
.When the property is set to
true
, it indicates that the current high value of thisRangeSlider
is changing. It provides notification that the high value is changing. Once the high value is computed, it is set back tofalse
.- Returns:
- The property reference.
- See Also:
-
highValueProperty
Returns a reference to the property that holds the high value.
The high value property represents the current position of the high value thumb, and is within the allowable range as specified by the
min
andmax
properties. By default this value is 100.- Returns:
- The property reference.
- See Also:
-
incrementHighValue
Increments the high value by the block increment amount. -
incrementLowValue
Increments the low value value by the block increment amount. -
isHighValueChanging
Returns whether the high value of thisRangeSlider
is currently changing.- Returns:
true
if the high value is currently changing, otherwisefalse
.
-
isLowValueChanging
Returns whether the low value of thisRangeSlider
is currently changing.- Returns:
true
if the low value is currently changing, otherwisefalse
.
-
isShowTickLabels
Returns the flag indicating whether labels of tick marks are being shown.- Returns:
true
if the tick mark label are shown, otherwisefalse
.
-
isShowTickMarks
Returns the flag indication whether the tick marks are shown.- Returns:
true
if the tick marks are shown, otherwisefalse
.
-
isSnapToTicks
Returns the flag that controls whether the thumbs will snap to the tick marks.- Returns:
true
if the thumbs will snap to the tick marks, otherwisefalse
.- See Also:
-
labelFormatterProperty
Returns a reference to the property that holds the
StringConverter
that is used to format the tick mark labels.If
null
, a default will be used.- Returns:
- The property reference.
- See Also:
-
lowValueChangingProperty
Returns a reference to the property that indicates a change to the low value of this
RangeSlider
.When the property is set to
true
, it indicates that the current low value of thisRangeSlider
is changing. It provides notification that the low value is changing. Once the low value is computed, the property is set back tofalse
.- Returns:
- The property reference.
- See Also:
-
lowValueProperty
Returns a reference to the property that holds the low value.
The low value property represents the current position of the low value thumb, and is within the allowable range as specified by the
min
andmax
properties. By default this value is 0.- Returns:
- The property reference.
- See Also:
-
majorTickUnitProperty
Returns a reference to the property that holds the unit distance between major tick marks. For example, if the min value is 0 and the max value is 100 and the
majorTickUnit
is set to 25, then there would be 5 tick marks: one at position 0, one at position 25, one at position 50, one at position 75, and a final one at position 100.This value should be positive and should be a value less than the span. Out of range values are essentially the same as disabling tick marks.
- Returns:
- The property reference.
- See Also:
-
maxProperty
Returns a reference to the property that holds the maximum value for this
RangeSlider
.- Returns:
- The property reference.
- See Also:
-
minorTickCountProperty
Returns a reference to the property that holds the number of minor ticks to place between any two major ticks. This number should be positive or zero. Out of range values will disable minor ticks, as will a value of zero.
- Returns:
- The property reference.
- See Also:
-
minProperty
Returns a reference to the property that holds the minimum value for this
RangeSlider
.- Returns:
- The property reference.
- See Also:
-
orientationProperty
Returns a reference to the property that holds the orientation of this
RangeSlider
.The orientation can either be horizontal or vertical.
- Returns:
- The property reference.
- See Also:
-
setBlockIncrement
Sets the amount by which to adjust the slider if the track of the slider is clicked.- Parameters:
value
- The adjustment value.- See Also:
-
setHighValueChanging
Call this when high value is changing.- Parameters:
flag
-true
if the high value is currently changing,false
otherwise.
-
setHighValue
Sets the high value for the range slider, which may or may not be clamped to be within the allowable range as specified by themin
andmax
properties.- Parameters:
high
- The value.
-
setLabelFormatter
Sets the tick label formatter.- Parameters:
formatter
- TheStringConverter
that is used to format the tick labels.
-
setLowValue
Sets the low value for the range slider, which may or may not be clamped to be within the allowable range as specified by themin
andmax
properties.- Parameters:
low
- The value.
-
setLowValueChanging
Call this when the low value is changing.- Parameters:
flag
-true
if the low value is changing,false
otherwise.
-
setMajorTickUnit
Sets the unit distance between major tick marks.- Parameters:
tickUnit
- The unit distance.- See Also:
-
setMax
Sets the maximum value for thisRangeSlider
.- Parameters:
max
- The new value.
-
setMin
Sets the minimum value for thisRangeSlider
.- Parameters:
min
- The new value
-
setMinorTickCount
Sets the number of minor ticks to place between any two major ticks.- Parameters:
numberOfTicks
- The number of minor ticks; should be 0 or a positive number, out of range values will disable the feature.- See Also:
-
setOrientation
Sets the orientation of theRangeSlider
.- Parameters:
orientation
- The orientation.
-
setSnapToTicks
Sets the flag that controls whether the thumbs will snap to the tick marks.- Parameters:
flag
-true
if the thumbs snaps to the tick marks,false
if not.- See Also:
-
setShowTickLabels
Sets whether labels of tick marks should be shown or not.- Parameters:
flag
-true
if the tick mark labels should be shown,false
if not.
-
setShowTickMarks
Sets whether tick marks should be shown or not.- Parameters:
flag
-true
if the tick marks are shown,false
if not.
-
showTickLabelsProperty
Returns a reference to the property that holds the flag that indicates that the labels for tick marks should be shown.
Typically, a
Skin
implementation will only show labels ifshowTickMarks
is alsotrue
.- Returns:
- The property reference.
- See Also:
-
showTickMarksProperty
Returns a reference to the property that holds the flag that specifies whether the
Skin
implementation should show tick marks.- Returns:
- The property reference.
- See Also:
-
snapToTicksProperty
Returns a reference to the property that holds the flag that indicates whether the low value/high value thumbs of the
RangeSlider
should always be aligned with the tick marks. This is honored even if the tick marks are not shown.- Returns:
- The property reference.
- See Also:
-
snapValueToTicks
Aligns the given value with the nearest tick mark value.- Parameters:
value
- The value.- Returns:
- The adjusted value.
-