Class SJCheckBox
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.checkbox.Checkbox>, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.checkbox.Checkbox>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.checkbox.Checkbox>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.checkbox.Checkbox>, 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.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.checkbox.Checkbox, Boolean>, Boolean>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.checkbox.Checkbox, Boolean>, Boolean>, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.checkbox.CheckboxVariant>, 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.checkbox.Checkbox, Boolean>, Boolean>, com.vaadin.flow.data.binder.HasValidator<Boolean>, ComponentMixin, ContainerMixin, AbstractButtonMixin, JComponentMixin, ItemSelectable, Serializable
public class SJCheckBox
extends com.vaadin.flow.component.checkbox.Checkbox
implements AbstractButtonMixin
Surrogate for Standalone, not
SJCheckBox stands alone over Override surface against
JCheckBox (SD_toggle_checkbox_first_cut, restructured SD_sjtogglebutton_button_peer).
Extends Vaadin Checkbox directly (is-a), rendering a checkbox
glyph — JCheckBox's actual Swing look. Reaches the migrator either
through :emulators.JCheckBox as peer, or as a richer-than-stock
Vaadin checkbox in its own right.
Standalone, not extends SJToggleButton
SJCheckBox stands alone over Checkbox + AbstractButtonMixin
rather than extending SJToggleButton, and duplicates the
Checkbox-peer toggle surface: SJToggleButton peers over a
Button for pressed chrome (SD_sjtogglebutton_button_peer),
so there is no shared Checkbox-peer basis to inherit. Same
parallel-not-shared duplication SJRadioButton carries (SD_sjpasswordfield) —
Vaadin Checkbox, Button, and our VaadinRadioButton
share no ancestor below Component, so a toggle over each needs its
own peer-bound wiring.
Override surface against AbstractButtonMixin
installButtonBindings()— installsJToggleButton.ToggleButtonModel(toggle semantics) and aHasValue<Boolean>ValueChangeListener(covers mouse AND keyboard-Space through one path); skips the mixin's inline-flex CSS seed (Checkbox shadow DOM doesn't honor host flex).setModel(ButtonModel)— adds a model→peer push ItemListener mirroringmodel.isSelected()intoCheckbox.setValueunderpreventPeerEvents.setText(String)/getText()— Checkbox isHasLabel, notHasText; route throughsetLabel/getLabel, normalisenull → ""(R_vaadin_first lossy).- Layout setters — validate per R_match_swing_errors (IAE on invalid
SwingConstants) then drop-and-WARN on non-default; shadow DOM doesn't honor host inline-flex, so silent CSS would deceive. setEnabled(boolean)— explicit redirect into the mixin chain, so the choice is pinned in source rather than resting on interface-default specificity.setIcon— not overridden. The mixin's default WARN-drops on the non-Buttonbranch (Checkbox has no icon slot).
JCheckBox-specific surface
borderPaintedFlat (drop-and-WARN per R_vaadin_first — no Vaadin counterpart),
getUIClassID() == "CheckBoxUI", and the JCheckBox paramString
tail. The emulator-side :emulators.JCheckBox keeps its own
borderPaintedFlat field + PCE for full JDK round-trip per R_swing_is_truth.
Browser-originated toggle wiring
TheValueChangeListener guards on preventPeerEvents
(echo from our own push) and model.isSelected() == newValue
(idempotency), then funnels through SHelper.callSwing(Runnable)
(this::synthesizePeerClick) so user-click and doClick deliver
identical Item + Change + Action sequences.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.checkbox.Checkbox
com.vaadin.flow.component.checkbox.Checkbox.CheckboxI18nNested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,V> Nested classes/interfaces inherited from interface AbstractButtonMixin
AbstractButtonMixin.ButtonActionPropertyChangeListenerNested 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 JComponentMixin
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW -
Constructor Summary
ConstructorsConstructorDescriptionSJCheckBox(String text) SJCheckBox(String text, boolean selected) SJCheckBox(String text, Icon icon) SJCheckBox(String text, Icon icon, boolean selected) SJCheckBox(Action action) SJCheckBox(Icon icon) SJCheckBox(Icon icon, boolean selected) -
Method Summary
Modifier and TypeMethodDescriptionintintintReads CSSgapback as an int.JDK default is null; no Vaadin counterpart.getText()Abstract — each concrete AbstractButton-lineage surrogate provides its owngetTextvia the parent Vaadin component'sHasTextcontract.Deliberate no-op — L&F key.intintvoidOverride of the mixin's default:JToggleButton.ToggleButtonModelas default model, aHasValue<Boolean> ValueChangeListener(covers mouse-click AND keyboard-Space without double-firing) instead of theClickNotifierwire, and skips the inline-flex CSS seed (Checkbox shadow DOM doesn't honor host flex).booleanReturns the JDK default; no shadow store per R_vaadin_first.protected StringJDK JCheckBox.paramString appends",borderPaintedFlat=<bool>".voidsetBorderPaintedFlat(boolean b) R_vaadin_first drop-and-WARN.voidsetEnabled(boolean enabled) Routes into the mixin chain somodel.setEnabled(...)stays in sync and SD_auto_pce's auto-PCE fires.voidsetHorizontalAlignment(int alignment) voidsetHorizontalTextPosition(int pos) voidsetIconTextGap(int gap) voidsetModel(ButtonModel newModel) Override ofAbstractButtonMixin.setModel(ButtonModel)to additionally install a model→peer push ItemListener that mirrorsmodel.isSelected()intoCheckbox.setValueunderpreventPeerEvents.voidAbstract — each concrete surrogate implements via super (its Vaadin parent's HasText.setText, e.g.voidsetVerticalAlignment(int alignment) voidsetVerticalTextPosition(int pos) voidvalidate()Visibility-widening override required byComponentMixin's publicvalidate()contract — VaadinCheckboxdeclares the inheritedvalidate()asprotected(input validation, not Swing's layout cycle).Methods inherited from class com.vaadin.flow.component.checkbox.Checkbox
bindIndeterminate, getAriaDescribedBy, getAriaLabel, getAriaLabelledBy, getDefaultValidator, getI18n, getLabel, isAutofocus, isIndeterminate, isRequiredIndicatorVisible, setAriaDescribedBy, setAriaLabel, setAriaLabelledBy, setAutofocus, setI18n, setIndeterminate, setLabel, setLabelComponent, setManualValidation, setRequiredIndicatorVisibleMethods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, getEmptyValue, getValue, isEmpty, setModelValue, setValue, 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 AbstractButtonMixin
actionPropertyChanged, addActionListener, addChangeListener, addItemListener, configurePropertiesFromAction, createActionPropertyChangeListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getItemListeners, getLabel, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setIcon, setLabel, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, synthesizePeerClick, updateUIMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods 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, updateMethods 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.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.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListenerMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, bindValue, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, setReadOnlyMethods 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, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction
-
Constructor Details
-
SJCheckBox
public SJCheckBox() -
SJCheckBox
-
SJCheckBox
-
SJCheckBox
-
SJCheckBox
-
SJCheckBox
-
SJCheckBox
-
SJCheckBox
-
-
Method Details
-
validate
public void validate()Visibility-widening override required byComponentMixin's publicvalidate()contract — VaadinCheckboxdeclares the inheritedvalidate()asprotected(input validation, not Swing's layout cycle). Same SD_toggle_checkbox_first_cut / SD_sjtextfield / SD_sjpasswordfield precedent; delegates to Checkbox's super.- Specified by:
validatein interfaceComponentMixin- Overrides:
validatein classcom.vaadin.flow.component.checkbox.Checkbox
-
installButtonBindings
public void installButtonBindings()Override of the mixin's default:JToggleButton.ToggleButtonModelas default model, aHasValue<Boolean> ValueChangeListener(covers mouse-click AND keyboard-Space without double-firing) instead of theClickNotifierwire, and skips the inline-flex CSS seed (Checkbox shadow DOM doesn't honor host flex). Idempotent.- Specified by:
installButtonBindingsin interfaceAbstractButtonMixin
-
setModel
Override ofAbstractButtonMixin.setModel(ButtonModel)to additionally install a model→peer push ItemListener that mirrorsmodel.isSelected()intoCheckbox.setValueunderpreventPeerEvents. Catches directmyModel.setSelected(...)mutations, not just mixin-routed ones.- Specified by:
setModelin interfaceAbstractButtonMixin
-
getText
Description copied from interface:AbstractButtonMixinAbstract — each concrete AbstractButton-lineage surrogate provides its owngetTextvia the parent Vaadin component'sHasTextcontract. SJButton's inheritedButton.getText()(which readstextNode) satisfies this requirement automatically. Mixin-internal callers (e.g.AbstractButtonMixin.getActionCommand()'s text fallback,AbstractButtonMixin.setDisplayedMnemonicIndex(int)'s length validation) reach the concrete impl via virtual dispatch.Pulled out of the mixin's default-implementation surface so the mixin doesn't need a reentry-flag dance to call back into the parent's HasText methods — the rendered text path is owned by the concrete surrogate, end of story.
- Specified by:
getTextin interfaceAbstractButtonMixin
-
setText
Description copied from interface:AbstractButtonMixinAbstract — each concrete surrogate implements via super (its Vaadin parent's HasText.setText, e.g. Button.setText → textSupport) plus the"text"PCE fire. Pulled out of the mixin's default surface for the same reason asAbstractButtonMixin.getText().- Specified by:
setTextin interfaceAbstractButtonMixin
-
setEnabled
public void setEnabled(boolean enabled) Routes into the mixin chain somodel.setEnabled(...)stays in sync and SD_auto_pce's auto-PCE fires.Not forced by a "classes beat interfaces" shadow — Vaadin
Checkboxdeclares nosetEnabledof its own, soAbstractButtonMixin's default would win on specificity anyway. Kept to pin the choice in source, and because the siblingSButtonreally does need it (VaadinButtondeclares one).- Specified by:
setEnabledin interfaceComponentMixin- Specified by:
setEnabledin interfacecom.vaadin.flow.component.HasEnabled- Specified by:
setEnabledin interfaceJComponentMixin
-
getHorizontalAlignment
public int getHorizontalAlignment()- Specified by:
getHorizontalAlignmentin interfaceAbstractButtonMixin
-
setHorizontalAlignment
public void setHorizontalAlignment(int alignment) - Specified by:
setHorizontalAlignmentin interfaceAbstractButtonMixin
-
getVerticalAlignment
public int getVerticalAlignment()- Specified by:
getVerticalAlignmentin interfaceAbstractButtonMixin
-
setVerticalAlignment
public void setVerticalAlignment(int alignment) - Specified by:
setVerticalAlignmentin interfaceAbstractButtonMixin
-
getHorizontalTextPosition
public int getHorizontalTextPosition()- Specified by:
getHorizontalTextPositionin interfaceAbstractButtonMixin
-
setHorizontalTextPosition
public void setHorizontalTextPosition(int pos) - Specified by:
setHorizontalTextPositionin interfaceAbstractButtonMixin
-
getVerticalTextPosition
public int getVerticalTextPosition()- Specified by:
getVerticalTextPositionin interfaceAbstractButtonMixin
-
setVerticalTextPosition
public void setVerticalTextPosition(int pos) - Specified by:
setVerticalTextPositionin interfaceAbstractButtonMixin
-
getIconTextGap
public int getIconTextGap()Description copied from interface:AbstractButtonMixinReads CSSgapback as an int. Lossy CSS round-trip per R_vaadin_first — agapCSS value with a non-px unit (we only ever write"Npx") would parse to the JDK default 4.- Specified by:
getIconTextGapin interfaceAbstractButtonMixin
-
setIconTextGap
public void setIconTextGap(int gap) - Specified by:
setIconTextGapin interfaceAbstractButtonMixin
-
getMargin
Description copied from interface:AbstractButtonMixinJDK default is null; no Vaadin counterpart.- Specified by:
getMarginin interfaceAbstractButtonMixin
-
setBorderPaintedFlat
public void setBorderPaintedFlat(boolean b) R_vaadin_first drop-and-WARN. Vaadin Checkbox owns its chrome — no counterpart for "paint border only when in toolbar". Defaultfalseis silent;trueWARNs and drops. No PCE (no state, no change). -
isBorderPaintedFlat
public boolean isBorderPaintedFlat()Returns the JDK default; no shadow store per R_vaadin_first. -
getUIClassID
Description copied from interface:JComponentMixinDeliberate no-op — L&F key.- Specified by:
getUIClassIDin interfaceAbstractButtonMixin- Specified by:
getUIClassIDin interfaceJComponentMixin
-
paramString
JDK JCheckBox.paramString appends",borderPaintedFlat=<bool>". We always reportfalse(the JDK default) since the surrogate doesn't store the value per R_vaadin_first. -
getAccessibleContext
-