This component internally manages two separate Slider instances—one for the lower value and one for the upper value. Both sliders enforce a minimal gap to ensure the lower value does not exceed the upper, and vice versa.
Example:
RangeSlider slider = RangeSlider.create(0, 100)
.setStep(5)
.setValue(Range.of(20.0, 80.0))
.addChangeListener((oldValue, newValue) -> {
console.log("Range changed: " + newValue);
});
In this example, the slider covers values from 0 to 100. Both the lower and upper slider thumbs move in increments of 5, and their combined range is enforced by a minimal gap (if specified).
public void RangeSlider(double minValue, double maxValue, double lowerValue, double upperValue, double minGap)
RangeSlider with the specified minimum, maximum, initial lower/upper values, and minimal gap.
minValue
the minimum allowed value
maxValue
the maximum allowed value
lowerValue
the initial lower slider value
upperValue
the initial upper slider value
minGap
the minimal gap (distance) enforced between lower and upper values
public static RangeSlider create(double minValue, double maxValue)
RangeSlider from minValue to maxValue with a default gap of 1 , initially covering the entire range.
minValue
the minimum value
maxValue
the maximum value
a new range slider
public static RangeSlider create(double minValue, double maxValue, double minGap)
RangeSlider from minValue to maxValue with a specified minGap , initially covering the entire range.
minValue
the minimum value
maxValue
the maximum value
minGap
the minimum distance between the lower and upper slider values
a new range slider
public static RangeSlider create(double minValue, double maxValue, double lowerValue, double upperValue)
RangeSlider from minValue to maxValue with a default gap of 1 , and sets the initial lower/upper values.
minValue
the minimum value
maxValue
the maximum value
lowerValue
the initial value of the lower slider
upperValue
the initial value of the upper slider
a new range slider
public static RangeSlider create(double minValue, double maxValue, double lowerValue, double upperValue, double minGap)
RangeSlider from minValue to maxValue with a specified minGap , and sets the initial lower/upper values.
minValue
the minimum value
maxValue
the maximum value
lowerValue
the initial value of the lower slider
upperValue
the initial value of the upper slider
minGap
the minimum distance between the lower and upper slider values
a new range slider
public RangeSlider pauseChangeListeners()
public RangeSlider resumeChangeListeners()
public RangeSlider togglePauseChangeListeners(boolean toggle)
public Set<ChangeListener<? super Range<Double>>> getChangeListeners()
public boolean isChangeListenersPaused()
public RangeSlider triggerChangeListeners(Range<Double> oldValue, Range<Double> newValue)
public RangeSlider withThumb()
this RangeSlider
public RangeSlider setMaxValue(double max)
max
the new maximum
this RangeSlider
public RangeSlider setMinValue(double min)
min
the new minimum
this RangeSlider
public RangeSlider setValue(Range<Double> newValue)
newValue
the new range value
this RangeSlider
public RangeSlider setValue(Range<Double> newValue, boolean silent)
newValue
the new range value
silent
if true, change listeners are not triggered
this RangeSlider
public Range<Double> getValue()
the current Range
public RangeSlider setShowThumb(boolean withThumb)
withThumb
true to show thumbs
this RangeSlider
public RangeSlider setAutoHideThumb(boolean autoHideThumb)
autoHideThumb
true if the thumbs should auto-hide
this RangeSlider
public boolean isAutoHideThumb()
true if thumbs auto-hide
public RangeSlider setThumbStyle(ThumbStyle thumbStyle)
thumbStyle
the new ThumbStyle
this RangeSlider
public RangeSlider setStep(double step)
step
the step size
this RangeSlider
public RangeSlider anyStep()
this RangeSlider
public SlidersConfig getOwnConfig()
public RangeSlider setConfig(SlidersConfig config)
config
the new SlidersConfig
this RangeSlider
public RangeSlider withLowerSlider(ChildHandler<RangeSlider, Slider> handler)
handler
a functional interface that receives this RangeSlider and its lower Slider
this RangeSlider
public RangeSlider withUpperSlider(ChildHandler<RangeSlider, Slider> handler)
handler
a functional interface that receives this RangeSlider and its upper Slider
this RangeSlider
public RangeSlider addSliderMoveListener(Handler<RangeSlider> handler)
handler
a Handler for RangeSlider movement events
this RangeSlider
public RangeSlider removeSliderMoveListener(Handler<Slider> handler)
handler
the handler to remove
this RangeSlider
public HTMLDivElement element()
Returns the root