Class ComboBoxStateStore

java.lang.Object
com.vaadin.swingbridge.surrogates.internal.ComboBoxStateStore

public final class ComboBoxStateStore extends Object
State holder for SJComboBox (SD_sjcombobox).

Scoped per R_vaadin_first: the model + its bridge listener registration + the surrogate-level fan-out lists belong here because they have no Vaadin counterpart we can read back. Selection state itself does not live here — the installed ComboBoxModel.getSelectedItem() is the source of truth (R_swing_is_truth) and Vaadin's getValue() mirrors it on the peer.

  • Field Details

    • model

      public ComboBoxModel<?> model
      Source of truth for items + selection (R_swing_is_truth). Never null after ctor.
    • modelListener

      public ListDataListener modelListener
      The ListDataListener we attach to model to push items into the Vaadin peer and to fan out the model's ListDataEvents to user listeners. Held so setModel can detach from the old model before attaching to the new one.
    • preventPeerEvents

      public boolean preventPeerEvents
      R_swing_is_truth feedback-loop guard. Set during model→peer pushes and during fire-side updates; checked by the peer ValueChangeListener and the customValue listener so they bail instead of re-writing the model.
    • editable

      public boolean editable
      Editable shadow. Vaadin's ComboBox.isAllowCustomValue() round-trips, but pairing the bit with customValueRegistration here keeps the swap atomic — flipping editable also tears down / installs the customValue subscription.
    • customValueRegistration

      public com.vaadin.flow.shared.Registration customValueRegistration
      Registration for the Vaadin addCustomValueSetListener subscription that commits typed-but-unmatched input into the model; null when not editable. Recreated on every setEditable(true) / model swap so a stale registration can't fire against the wrong model.
    • valueChangeRegistration

      public com.vaadin.flow.shared.Registration valueChangeRegistration
      Registration for the Vaadin ValueChangeListener that mirrors browser-side selection edits into the model. One-shot install per surrogate lifetime — survives model swaps (the Vaadin HasValue channel doesn't re-source on model change, only its items do); stored so a teardown path could detach it.
    • listenerList

      public final EventListenerList listenerList
      Type-keyed listener lists for ItemListener / ActionListener / PopupMenuListener / ListDataListener surrogate-level fan-out.
    • actionCommand

      public String actionCommand
      No Vaadin analog. JDK actionCommand drives the ActionEvent payload delivered to user ActionListeners on selection commit. Defaults to "comboBoxChanged" — JDK's own constant for non-edit selection commits.
    • action

      public Action action
      Currently installed Action; null when none.
    • actionPropertyChangeListener

      public PropertyChangeListener actionPropertyChangeListener
      PCL on action that propagates per-property mutations back to the surrogate.
    • maximumRowCount

      public int maximumRowCount
      maximumRowCount — JDK default 8. Mirrors Vaadin's setPageSize; we read it back from a stored field rather than from peer.getPageSize() since the two map cleanly.
    • lastSelected

      public Object lastSelected
      Cached previous selected item, used by the ItemEvent fan-out to deliver the JDK-canonical DESELECTED-prev + SELECTED-new pair on every selection change. Initialized to the model's initial selection in the surrogate ctor; updated as part of every commit.
  • Method Details