Class TableStateStore
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:
model— installedTableModel; rows × columns × cells.columnModel— installedTableColumnModel; column order, widths, headers.selectionModel— installed rowListSelectionModel.rowSorter— installedRowSorter; sort permutation + filter.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanJDK default true.booleanJDK default false.intintRow index / view-column index of the cell whose item-click is currently being dispatched, or-1outside a dispatch.Source of truth for column order + per-column metadata.booleanTrue while the Grid reacts to a data change — the window in which Vaadin closes an open editor.Source of truth for cell values (R_swing_is_truth).booleanR_swing_is_truth feedback-loop guard.Model row currently protected fromdataProvider.refreshItem, ornullwhen none.RowSorter<? extends TableModel> Currently installed JDK row sorter, ornullwhen no sort is active.Listener installed onrowSorterthat bridges programmaticrowSorter.setSortKeys(...)calls back into the Vaadin Grid's sort indicator + triggers a re-fetch viagrid.sort(...).Source of truth for row selection state.booleanWhoever forwards model events totableChangedhas already toldrowSorterabout each one, so the table must not tell it again.com.vaadin.flow.shared.RegistrationVaadin GridSelectionListenerregistration that mirrors browser-side selection edits into theselectionModel. -
Method Summary
Modifier and TypeMethodDescriptionstatic TableStateStoreof(com.vaadin.flow.component.Component target)
-
Field Details
-
model
Source of truth for cell values (R_swing_is_truth). Never null after ctor. -
columnModel
Source of truth for column order + per-column metadata. Never null after ctor. -
selectionModel
Source of truth for row selection state. Never null after ctor. -
preventPeerEvents
public boolean preventPeerEventsR_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 clickRowStashRow index / view-column index of the cell whose item-click is currently being dispatched, or-1outside a dispatch. Set/cleared around theSMouseListenerfan-out inSJTable.addMouseListener's item-click wire sorowAtPoint/columnAtPointresolve during the user'smouseClickedhandler (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
Model row currently protected fromdataProvider.refreshItem, ornullwhen none. Machinery (sibling topreventPeerEvents), 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 / concurrentsetValueAtUPDATE 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 editorClosingForDataChangeTrue while the Grid reacts to a data change — the window in which Vaadin closes an open editor. Machinery (sibling torefreshProtectedRow): lets the emulator tell that close from the user leaving the cell. -
autoCreateColumnsFromModel
public boolean autoCreateColumnsFromModelJDK default true. Drives whethermodelstructure changes (HEADER_ROW events) trigger a column rebuild from the model. Gates real behaviour (UI-functionality, not a round-trip shadow). -
autoCreateRowSorter
public boolean autoCreateRowSorterJDK default false. When true,setModelauto-installs a freshTableRowSorterfor the new model — gates real behaviour (lights up the Vaadin Grid sort indicator). -
sorterNotifiedByOwner
public boolean sorterNotifiedByOwnerWhoever forwards model events totableChangedhas already toldrowSorterabout each one, so the table must not tell it again. Gates real behaviour: a sorter told twice re-sorts on stale indices. -
rowSorter
Currently installed JDK row sorter, ornullwhen no sort is active. Single source of truth for sort permutation —convertRowIndexToView/Modelreads through it; the Vaadin GridFetchCallbackreads through it. JDK-reused per D_event_port_policy. -
rowSorterEventListener
Listener installed onrowSorterthat bridges programmaticrowSorter.setSortKeys(...)calls back into the Vaadin Grid's sort indicator + triggers a re-fetch viagrid.sort(...). Tracked here sosetRowSorterswap can detach cleanly. -
vaadinSelectionRegistration
public com.vaadin.flow.shared.Registration vaadinSelectionRegistrationVaadin GridSelectionListenerregistration that mirrors browser-side selection edits into theselectionModel. Re-installed onsetSelectionModesince Vaadin re-creates the Grid's internal selection backing on mode swap.
-
-
Method Details
-
of
-