Class SJSlider
java.lang.Object
com.vaadin.flow.component.Component
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.slider.IntegerSlider>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.slider.IntegerSlider>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.slider.IntegerSlider>, com.vaadin.flow.component.HasAriaDescription, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.slider.IntegerSlider, Integer>, Integer>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.slider.IntegerSlider, Integer>, Integer>, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.slider.IntegerSlider, Integer>, Integer>, com.vaadin.flow.data.value.HasValueChangeMode, ComponentMixin, ContainerMixin, JComponentMixin, Serializable
public class SJSlider
extends com.vaadin.flow.component.slider.IntegerSlider
implements JComponentMixin
Surrogate for Model flow (reused from
The installed Server-side snapping (
When
JSlider (SD_sjslider). Extends Vaadin
IntegerSlider directly (is-a) so it reaches the migrator either
through the :emulators JSlider as peer, or as a
richer-than-stock Vaadin component in its own right.
Vaadin's typed IntegerSlider (value type Integer) is the
natural peer for JSlider's int-valued model — a Double-typed peer
would need lossy casts on every value/min/max push.
Model flow (reused from :emulators.JSlider under SD_sjslider)
The installed BoundedRangeModel is the source of truth. A single
ChangeListener on the model fans out to user ChangeListeners and
pushes value changes to the peer (this Slider's own element) under the
preventPeerEvents R_swing_is_truth guard. The peer's ValueChangeListener
mirrors browser-originated edits back into the model via
SHelper.callSwing(Runnable) (R_callswing_envelope seam); the resulting model ChangeEvent
re-enters fanOutModelChange(), hits the preventPeerEvents guard,
and only the Swing-side fan-out runs — no second peer write.
CSS-only rendering (orientation / inverted)
VERTICAL rotates the host element -90deg. inverted
flips the horizontal axis via scaleX(-1). Combinations compose
through applyTransformCss() — a single transform rule
per setter so neither knob leaks the other's state when changed.
Server-side snapping (snapToTicks)
When snapToTicks is enabled and a non-zero tick spacing is
installed, browser-originated values round to the nearest tick before
reaching the model. minorTickSpacing wins over
majorTickSpacing when both are set — matches JDK JSlider's
snap priority.
Deferred rendering (upstream ticket)
Tick marks, value labels, and track-hiding all need addressable CSS parts or slots onvaadin-slider that the component doesn't
currently expose. Filed as
vaadin/flow-components#9181.
Until upstream lands, setPaintTicks(boolean),
setPaintLabels(boolean), setPaintTrack(boolean),
setLabelTable(Dictionary), and createStandardLabels(int)
field-round-trip, fire their PCE, but log a WARN on visual-effect
arguments (true / non-null). The deferral is scoped to rendering only —
snapToTicks and the tick-spacing fields work for their
non-visual uses (snap logic, BeanInfo introspection).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E>Nested classes/interfaces inherited from interface JComponentMixin
JComponentMixin.ActionStandin -
Field Summary
Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUTFields inherited from interface JComponentMixin
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcom.vaadin.flow.dom.SignalBinding<Integer> com.vaadin.flow.dom.SignalBinding<Integer> com.vaadin.flow.dom.SignalBinding<Integer> voidclear()protected ChangeListenerJDK hook for subclasses that want to swap the model-attached listener.createStandardLabels(int increment) JDK builds a Hashtable of JLabel-per-major-tick.createStandardLabels(int increment, int start) Two-arg overload.protected voidintbooleanintgetMax()intgetMin()intintgetModel()intbooleanbooleanbooleanbooleangetStep()JDK JSlider returns"SliderUI".com.vaadin.flow.data.value.ValueChangeModeintbooleanprotected booleanbooleanprotected booleanbooleanprotected booleanisValueWithinMinMax(Integer arg0) voidvoidsetAriaDescribedBy(String arg0) voidsetAriaLabel(String arg0) voidsetAriaLabelledBy(String arg0) voidsetExtent(int extent) voidsetInverted(boolean b) voidsetLabelTable(Dictionary labels) voidsetMajorTickSpacing(int n) voidvoidsetMaximum(int maximum) voidvoidsetMinimum(int minimum) voidsetMinMaxVisible(boolean arg0) voidsetMinorTickSpacing(int n) voidsetModel(BoundedRangeModel newModel) voidsetOrientation(int orientation) voidsetPaintLabels(boolean b) voidsetPaintTicks(boolean b) voidsetPaintTrack(boolean b) voidsetSnapToTicks(boolean b) voidvoidsetValue(int n) Int-valued setValue — overload ofIntegerSlider's inheritedsetValue(Integer).voidvoidsetValueAlwaysVisible(boolean arg0) voidsetValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode arg0) voidsetValueChangeTimeout(int arg0) voidsetValueIsAdjusting(boolean b) Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, getEmptyValue, getValue, isEmpty, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface ComponentMixin
_installSwingClass, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, dispatchEvent, doLayout, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getComponentListeners, getCursor, getFocusListeners, getFont, getForeground, getGraphics, getHierarchyBoundsListeners, getHierarchyListeners, getKeyListeners, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getName, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolTipText, getX, getY, grabFocus, hasFocus, invalidate, isDisplayable, isFocusable, isFocusOwner, isShowing, paint, paintAll, print, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, revalidate, setBackground, setBounds, setBounds, setCursor, setFocusable, setFont, setForeground, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateMethods inherited from interface ContainerMixin
addContainerListener, getContainerListeners, getLayout, paintComponents, printComponents, removeContainerListener, setLayoutMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasAriaDescription
setAriaDescribedByMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, bindValue, getEmptyValue, getOptionalValue, getValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisibleMethods inherited from interface JComponentMixin
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, requestDefaultFocus, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateUIMethods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
Constructor Details
-
SJSlider
public SJSlider() -
SJSlider
public SJSlider(int orientation) -
SJSlider
public SJSlider(int min, int max) -
SJSlider
public SJSlider(int min, int max, int value) -
SJSlider
public SJSlider(int orientation, int min, int max, int value) -
SJSlider
-
-
Method Details
-
setValue
public void setValue(int n) Int-valued setValue — overload ofIntegerSlider's inheritedsetValue(Integer). Routes through the model so the single ChangeListener path handles both user-code mutations and peer-originated ones. -
getMinimum
public int getMinimum() -
setMinimum
public void setMinimum(int minimum) -
getMaximum
public int getMaximum() -
setMaximum
public void setMaximum(int maximum) -
getExtent
public int getExtent() -
setExtent
public void setExtent(int extent) -
getValueIsAdjusting
public boolean getValueIsAdjusting() -
setValueIsAdjusting
public void setValueIsAdjusting(boolean b) -
getModel
-
setModel
-
getOrientation
public int getOrientation() -
setOrientation
public void setOrientation(int orientation) -
getInverted
public boolean getInverted() -
setInverted
public void setInverted(boolean b) -
getMajorTickSpacing
public int getMajorTickSpacing() -
setMajorTickSpacing
public void setMajorTickSpacing(int n) -
getMinorTickSpacing
public int getMinorTickSpacing() -
setMinorTickSpacing
public void setMinorTickSpacing(int n) -
getSnapToTicks
public boolean getSnapToTicks() -
setSnapToTicks
public void setSnapToTicks(boolean b) -
getPaintTicks
public boolean getPaintTicks() -
setPaintTicks
public void setPaintTicks(boolean b) -
getPaintTrack
public boolean getPaintTrack() -
setPaintTrack
public void setPaintTrack(boolean b) -
getPaintLabels
public boolean getPaintLabels() -
setPaintLabels
public void setPaintLabels(boolean b) -
getLabelTable
-
setLabelTable
-
createStandardLabels
JDK builds a Hashtable of JLabel-per-major-tick. Rendering is deferred (see class-level note); return an empty table so callers iterating it don't NPE. Raw type matches JDK's own signature. -
createStandardLabels
Two-arg overload. Same deferral ascreateStandardLabels(int). -
addChangeListener
-
removeChangeListener
-
getChangeListeners
-
fireStateChanged
protected void fireStateChanged() -
createChangeListener
JDK hook for subclasses that want to swap the model-attached listener. We allocatemodelListenerdirectly ininstallModel(BoundedRangeModel); an override wouldn't reach our code path today, but we expose this so a migrated subclass can callsuper.createChangeListener()and get the real listener. -
getUIClassID
JDK JSlider returns"SliderUI". We don't drive a pluggableComponentUI(R_layouts_close_enough — Vaadin owns the DOM), but keep the ID so migrated code that introspects via BeanInfo still finds the expected value.- Specified by:
getUIClassIDin interfaceJComponentMixin
-
setAriaLabel
- Specified by:
setAriaLabelin interfacecom.vaadin.flow.component.HasAriaLabel
-
getAriaLabel
-
setAriaLabelledBy
- Specified by:
setAriaLabelledByin interfacecom.vaadin.flow.component.HasAriaLabel
-
getAriaLabelledBy
-
setAriaDescribedBy
- Specified by:
setAriaDescribedByin interfacecom.vaadin.flow.component.HasAriaDescription
-
getAriaDescribedBy
-
clear
public void clear()- Specified by:
clearin interfacecom.vaadin.flow.component.HasValue<TComponent extends com.vaadin.flow.component.slider.NumberSlider<TComponent, TValue>, TValue extends Number>
-
isValueWithinMinMax
-
isValueAlignedWithStep
-
getMin
-
setMin
-
getMax
-
setMax
-
getStep
-
setStep
-
bindMin
-
bindMax
-
bindStep
-
setValueAlwaysVisible
public void setValueAlwaysVisible(boolean arg0) -
isValueAlwaysVisible
public boolean isValueAlwaysVisible() -
setMinMaxVisible
public void setMinMaxVisible(boolean arg0) -
isMinMaxVisible
public boolean isMinMaxVisible() -
getValueChangeMode
public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()- Specified by:
getValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValueChangeMode
public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode arg0) - Specified by:
setValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValueChangeTimeout
public void setValueChangeTimeout(int arg0) - Specified by:
setValueChangeTimeoutin interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
getValueChangeTimeout
public int getValueChangeTimeout()- Specified by:
getValueChangeTimeoutin interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValue
- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent, TValue, TNumber, TPresentation>, TValue>- Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent, TValue, TNumber, TPresentation>, TValue>
-
hasValidValue
protected boolean hasValidValue()- Overrides:
hasValidValuein classcom.vaadin.flow.component.AbstractSinglePropertyField<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent, TValue, TNumber, TPresentation>, TValue>
-