Class TableStateStore

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

public final class TableStateStore extends Object
State holder for SJTable (SD_sjtable).

Holds only R_vaadin_first-legitimate state — UI-functionality source-of-truth (the three models + the row sorter), the behaviour-gating auto-create flags, and machinery (loop guard, live registrations). No shadow caches: JTable's no-Vaadin-counterpart knobs (rowHeight, rowMargin, intercellSpacing, gridColor, show*Lines, autoResizeMode, selection chrome, row/columnSelectionAllowed, dragEnabled, fillsViewportHeight, preferredScrollableViewportSize) round-trip on the emulator layer per R_swing_is_truth — the asymmetric split SJToolBar (SD_sjtoolbar) / SJSplitPane (SD_sjsplitpane) / SJList (SD_sjlist) established. The JDK selection-mode int isn't stored either: it is reconstructed from selectionModel's getSelectionMode().

Source-of-truth fields per R_swing_is_truth:

All JDK types reused per D_whitelist_porting/D_event_port_policy (no Component-touching public members).
  • Field Details

    • model

      public TableModel model
      Source of truth for cell values (R_swing_is_truth). Never null after ctor.
    • columnModel

      public TableColumnModel columnModel
      Source of truth for column order + per-column metadata. Never null after ctor.
    • selectionModel

      public ListSelectionModel selectionModel
      Source of truth for row selection state. Never null after ctor.
    • preventPeerEvents

      public boolean preventPeerEvents
      R_swing_is_truth feedback-loop guard. Set during model→peer pushes (push-items, push-selection) and during peer→model write-throughs so the cascade doesn't double-fire. Same shape SJComboBox / SJSlider take.
    • clickRowStash

      public int clickRowStash
      Row index / view-column index of the cell whose item-click is currently being dispatched, or -1 outside a dispatch. Set/cleared around the SMouseListener fan-out in SJTable.addMouseListener's item-click wire so rowAtPoint / columnAtPoint resolve during the user's mouseClicked handler (R_layouts_close_enough — no server-side pixel→cell map). Fields, not thread-locals: the emulator re-source may drain the dispatch in a UI fiber, and shared state survives that boundary.
    • clickColumnStash

      public int clickColumnStash
    • refreshProtectedRow

      public Integer refreshProtectedRow
      Model row currently protected from dataProvider.refreshItem, or null when none. Machinery (sibling to preventPeerEvents), not editing API: the emulator's cell-editing lifecycle sets this to the open editor's model row and clears it on teardown, so an external / concurrent setValueAt UPDATE on that row (a Timer, another action) can't re-render the row out from under the in-flight editor (D_jtable_cell_editing Task 2).
    • editorClosingForDataChange

      public boolean editorClosingForDataChange
      True while the Grid reacts to a data change — the window in which Vaadin closes an open editor. Machinery (sibling to refreshProtectedRow): lets the emulator tell that close from the user leaving the cell.
    • autoCreateColumnsFromModel

      public boolean autoCreateColumnsFromModel
      JDK default true. Drives whether model structure changes (HEADER_ROW events) trigger a column rebuild from the model. Gates real behaviour (UI-functionality, not a round-trip shadow).
    • autoCreateRowSorter

      public boolean autoCreateRowSorter
      JDK default false. When true, setModel auto-installs a fresh TableRowSorter for the new model — gates real behaviour (lights up the Vaadin Grid sort indicator).
    • sorterNotifiedByOwner

      public boolean sorterNotifiedByOwner
      Whoever forwards model events to tableChanged has already told rowSorter about each one, so the table must not tell it again. Gates real behaviour: a sorter told twice re-sorts on stale indices.
    • rowSorter

      public RowSorter<? extends TableModel> rowSorter
      Currently installed JDK row sorter, or null when no sort is active. Single source of truth for sort permutation — convertRowIndexToView/Model reads through it; the Vaadin Grid FetchCallback reads through it. JDK-reused per D_event_port_policy.
    • rowSorterEventListener

      public RowSorterListener rowSorterEventListener
      Listener installed on rowSorter that bridges programmatic rowSorter.setSortKeys(...) calls back into the Vaadin Grid's sort indicator + triggers a re-fetch via grid.sort(...). Tracked here so setRowSorter swap can detach cleanly.
    • vaadinSelectionRegistration

      public com.vaadin.flow.shared.Registration vaadinSelectionRegistration
      Vaadin Grid SelectionListener registration that mirrors browser-side selection edits into the selectionModel. Re-installed on setSelectionMode since Vaadin re-creates the Grid's internal selection backing on mode swap.
  • Method Details

    • of

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