Class MenuBarStateStore

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

public final class MenuBarStateStore extends Object
State holder for SJMenuBar (SD_sjmenubar).

Scoped per R_vaadin_first: tracks bookkeeping the Vaadin MenuBar has no counterpart for. Pure rendering state lives on Vaadin (the MenuItem tree built by every rebuildFromTree call); this holder carries the cross-rebuild pieces — accelerator Registrations that must tear down on the next rebuild, and the last-pushed MenuNode tree for diagnostics + idempotency checks.

  • Field Details

    • currentTree

      public List<MenuNode> currentTree
      Last snapshot pushed via rebuildFromTree; empty at construction. For diagnostics + tests asserting the tree-rebuild API saw exact items — not a rendering source of truth (Vaadin's MenuBar.getItems() is).
    • acceleratorRegistrations

      public final Map<KeyStroke, com.vaadin.flow.shared.Registration> acceleratorRegistrations
      Per-KeyStroke Registrations for installed UI-scoped Vaadin shortcuts. Torn down at the start of every rebuild; re-installed during the second walk over the new tree.
    • preventRebuild

      public boolean preventRebuild
      Re-entrancy guard. rebuildFromTree sets this before walking the snapshot and clears it in finally. Click handlers that fire inside a toggle commit can check this and short-circuit the emulator-side rebuild push, avoiding feedback into the click that triggered them. Same shape SJSpinner / SJSlider take per SD_sjslider / SD_sjspinner.
  • Method Details

    • of

      public static MenuBarStateStore of(com.vaadin.flow.component.Component target)