Class CheckboxGroup

java.lang.Object
vaadinx.awt.CheckboxGroup
All Implemented Interfaces:
Serializable

public class CheckboxGroup extends Object implements Serializable
Emulator for CheckboxGroup — the AWT 1.0 radio-button mutex. Grouping is what turns a Checkbox into a radio button, both in behaviour and in glyph:
CheckboxGroup units = new CheckboxGroup();
Checkbox metric   = new Checkbox("metric", true, units);   // renders as a radio
Checkbox imperial = new Checkbox("imperial", false, units);
units.setSelectedCheckbox(imperial);   // silent: no ItemEvent, either box

Nothing here fires events and nothing here throws: a box belonging to another group is a documented silent no-op, and null legally deselects everything (R_match_swing_errors).

Lives in :emulators rather than :surrogates because there is nothing Vaadin-shaped for it to be — no element, no rendering, no HasValue — and D_buttongroup_browser_click already settled the analogous question for ButtonGroup: group mutex is an emulator-layer concern, and SCheckbox carries no awareness of any group.

getSelectedCheckbox() returns a vaadinx.awt.Checkbox, not the JDK type. Irreducible, and the same divergence D_buttongroup_cross_package accepted for ButtonGroup: migrated code compiles unchanged after the import swap.

See Also:
  • Constructor Details

    • CheckboxGroup

      public CheckboxGroup()
  • Method Details

    • getSelectedCheckbox

      public Checkbox getSelectedCheckbox()
    • getCurrent

      @Deprecated public Checkbox getCurrent()
      Deprecated.
      as of JDK 1.1, replaced by getSelectedCheckbox() — but this is the implementation, not the wrapper
    • setSelectedCheckbox

      public void setSelectedCheckbox(Checkbox box)
    • setCurrent

      @Deprecated public void setCurrent(Checkbox box)
      Deprecated.
      as of JDK 1.1, replaced by setSelectedCheckbox(Checkbox) — but this is the implementation, not the wrapper
      Moves the selection, forcing the outgoing box off and the incoming box on.

      The two directions deliberately use different setters, and the pointer moves before either. The outgoing box goes through the public Checkbox.setState(boolean), which re-enters this group's check but finds the pointer already moved, so its cannot-deselect veto does not fire; the incoming box goes through the package-private setStateInternal, which skips group logic entirely. Using one setter for both directions either recurses or leaves a stale selection.

      Parameters:
      box - null deselects everything; a box belonging to a different group is ignored — silently, as AWT does, and deliberately not an IllegalArgumentException (R_match_swing_errors)
    • toString

      public String toString()
      Overrides:
      toString in class Object