Class SJRadioButton

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<VaadinRadioButton, Boolean>
com.vaadin.flow.component.AbstractSinglePropertyField<VaadinRadioButton, Boolean>
com.vaadin.swingbridge.surrogates.VaadinRadioButton
com.vaadin.swingbridge.surrogates.SJRadioButton
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<VaadinRadioButton>, com.vaadin.flow.component.ClickNotifier<VaadinRadioButton>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<VaadinRadioButton>, com.vaadin.flow.component.FocusNotifier<VaadinRadioButton>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<VaadinRadioButton, Boolean>, Boolean>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<VaadinRadioButton, Boolean>, Boolean>, ComponentMixin, ContainerMixin, AbstractButtonMixin, JComponentMixin, ItemSelectable, Serializable

public class SJRadioButton extends VaadinRadioButton implements AbstractButtonMixin
Surrogate for JRadioButton. Extends VaadinRadioButton (our re-host of the public vaadin-radio-button web component, since Vaadin's own RadioButton Java wrapper is package-private) so it reaches the migrator either through the :emulators JRadioButton as peer, or as a standalone Vaadin radio button in its own right.

Mirrors SJToggleButton's override surface (SD_toggle_checkbox_first_cut precedent)

JDK's JRadioButton extends JToggleButton — both use JToggleButton.ToggleButtonModel, both deliver ButtonModel-driven Item / Change / Action fan-out, both render a toggleable widget that fires ValueChange on browser-side click. The only difference is the chosen peer (Vaadin Checkbox vs. VaadinRadioButton) and the rendered glyph (square check vs. circular radio). The peer hierarchy is parallel-not-shared (Vaadin Checkbox and our VaadinRadioButton have no common ancestor below Component), so this surrogate duplicates SJToggleButton's overrides verbatim — same constraint that drove SD_sjpasswordfield (SJPasswordField duplicating SJTextField).

ButtonGroup mutex lives at the emulator layer (D_buttongroup_browser_click)

The surrogate carries no awareness of any ButtonGroup. Stage-3 users wanting radio-group mutex use the emulator-side JRadioButton + vaadinx.swing.ButtonGroup per D_buttongroup; the group's setSelectedButton cascades setSelected(false) on the previous selection's emulator wrapper, which in turn calls sjr.setSelected(false) on this surrogate. The model→peer push wire then drives checked=false on the sibling's peer under preventPeerEvents — same path as a programmatic setSelected from any other caller.

Standalone (no group): clicks toggle on/off like a checkbox per the underlying ToggleButtonModel pulse. The "radio stays selected when clicked while already-selected" behaviour is a ButtonGroup-vetoes-deselect effect that only materialises once an emulator-layer group is wired around it.

Override surface against AbstractButtonMixin

Identical to SJToggleButton's list: installButtonBindings() (use ToggleButtonModel + ValueChange wire), setModel(ButtonModel) (extra model→peer push), setText(String) / getText() (route through peer's label slot, normalise null→""), setEnabled(boolean) (Java "classes beat interfaces" redirect), layout setters drop-and-WARN (shadow DOM doesn't honor host flex), getUIClassID() returns "RadioButtonUI".
See Also:
  • Constructor Details

    • SJRadioButton

      public SJRadioButton()
    • SJRadioButton

      public SJRadioButton(String text)
    • SJRadioButton

      public SJRadioButton(String text, boolean selected)
    • SJRadioButton

      public SJRadioButton(Icon icon)
    • SJRadioButton

      public SJRadioButton(Icon icon, boolean selected)
    • SJRadioButton

      public SJRadioButton(String text, Icon icon)
    • SJRadioButton

      public SJRadioButton(String text, Icon icon, boolean selected)
    • SJRadioButton

      public SJRadioButton(Action action)
  • Method Details