Class TreeStateStore
java.lang.Object
com.vaadin.swingbridge.surrogates.internal.TreeStateStore
State holder for
SJTree (SD_sjtree).
Holds only R_vaadin_first-legitimate state — UI-functionality source-of-truth
(the two models), navigation machinery (the identity parent map backing
Vaadin's getParent/getItemIndex contract + the SD_sjtree_selection_bridge
selection-path bridge), the SD_sjtree_hierarchy_render hierarchy-column render seam, behaviour
gates and live registrations. No round-trip shadow caches: JTree's
no-Vaadin-counterpart knobs (showsRootHandles, rowHeight,
toggleClickCount, visibleRowCount, …) round-trip on the
emulator layer per R_swing_is_truth — the asymmetric split SJToolBar (SD_sjtoolbar) /
SJSplitPane (SD_sjsplitpane) / SJList (SD_sjlist) established.
Source-of-truth fields per R_swing_is_truth:
model— installedTreeModel; the tree's nodes.selectionModel— installedTreeSelectionModel; path-set selection state (bridged onto Vaadin TreeGrid's item-set selection per SD_sjtree_selection_bridge).
javax.swing.tree.*
model/path/selection surface touches no java.awt.Component.-
Field Summary
FieldsModifier and TypeFieldDescriptionNode / visible-row-index of the item whose click is currently being dispatched, ornull/-1outside a dispatch.intSD_sjtree_hierarchy_render hierarchy-column render seam.Source of truth for the tree's nodes (R_swing_is_truth).final IdentityHashMap<Object, Object> child → parent identity map, recorded on everyfetchChildrenFromBackEndwalk (SD_sjtree_lazy_provider).booleanR_swing_is_truth feedback-loop guard.booleanWhether the model root renders as a Vaadin top-level item (JDK default true).Source of truth for path-set selection state.Listener installed onselectionModelthat watches the"selectionMode"PCE (DefaultTreeSelectionModelfires it fromsetSelectionMode) and re-maps the Vaadin Grid selection mode.com.vaadin.flow.shared.RegistrationVaadin GridSelectionListenerregistration that mirrors browser-side selection edits into theselectionModel. -
Method Summary
Modifier and TypeMethodDescriptionstatic TreeStateStoreof(com.vaadin.flow.component.Component target)
-
Field Details
-
model
Source of truth for the tree's nodes (R_swing_is_truth). Never null after ctor. -
selectionModel
Source of truth for path-set selection state. Never null after ctor. -
selectionModeListener
Listener installed onselectionModelthat watches the"selectionMode"PCE (DefaultTreeSelectionModelfires it fromsetSelectionMode) and re-maps the Vaadin Grid selection mode. JDK code idiomatically callstree.getSelectionModel().setSelectionMode(...)— there is noJTree.setSelectionMode— so the surrogate must observe the model, not a setter of its own. Moved acrosssetSelectionModelswaps. -
parentMap
child → parent identity map, recorded on everyfetchChildrenFromBackEndwalk (SD_sjtree_lazy_provider). Legitimate machinery, not an R_vaadin_first shadow cache: Vaadin'sHierarchicalDataProviderrequiresgetParent/getItemIndexforTreeGrid.scrollToItem, and the SD_sjtree_selection_bridge selection bridge needs node→TreePathreconstruction — the JDKTreeModelhas nogetParent, so this map is the only way to walk up. Identity-keyed to match SD_sjtree_node_identity's node-identity stance. -
componentProvider
SD_sjtree_hierarchy_render hierarchy-column render seam. The singleaddComponentHierarchyColumninstalled in the SJTree ctor reads this function live per render call — TreeGrid's expand/collapse toggle chrome lives inHierarchyColumnComponentRenderer's template, so the renderer itself is never re-installed; swapping render behaviour (the emulator's D_jtree_renderer_registry JDK-TreeCellRendererbridge) swaps this function instead. Defaults to a fresh-per-callSpanof the node's text (D_jcombobox DOM-adoption guard). -
rootVisible
public boolean rootVisibleWhether the model root renders as a Vaadin top-level item (JDK default true).falsereshapes the data provider's root level: the root hides and its children become top-level (SD_sjtree_lazy_provider). Drives real data- provider behaviour — a gate, not a round-trip shadow. -
preventPeerEvents
public boolean preventPeerEventsR_swing_is_truth feedback-loop guard. Set during selection pushes in both directions (JDK model → Grid, Grid → JDK model) so the cascade doesn't double-fire. Same shape SJTable / SJList take. -
clickNodeStash
Node / visible-row-index of the item whose click is currently being dispatched, ornull/-1outside a dispatch. Set/cleared around theSMouseListenerfan-out inSJTree.addMouseListener's item-click wire sogetRowForLocation/getPathForLocationresolve during the user'smousePressed/mouseClickedhandler (R_layouts_close_enough — no server-side pixel→row map; theCaseTreeView.selectOnRightClickidiom). Fields, not thread-locals: the emulator re-source may drain the dispatch in a UI fiber, and shared state survives that boundary (SD_sjlist's stash rationale). -
clickRowStash
public int clickRowStash -
vaadinSelectionRegistration
public com.vaadin.flow.shared.Registration vaadinSelectionRegistrationVaadin GridSelectionListenerregistration that mirrors browser-side selection edits into theselectionModel. Re-installed on every selection-mode re-map since Vaadin re-creates the Grid's internal selection backing on mode swap (SD_sjtable_selection_bridge/SD_sjlist).
-
-
Method Details
-
of
-