fix: find Grid header, footer and editor components - #203
Open
totally-not-ai[bot] wants to merge 1 commit into
Open
fix: find Grid header, footer and editor components#203totally-not-ai[bot] wants to merge 1 commit into
totally-not-ai[bot] wants to merge 1 commit into
Conversation
Grid column header/footer components are virtual children of the Column (or ColumnGroup) that owns them, and both of those branches of getAllChildren() drop virtual children on purpose so that a component in a merged cell is not reported once per spanned column. The Grid branch that was meant to report them instead was left commented out, so those components were dropped from the component tree altogether and find() never returned them. The same applied to column editor components. Enable the Grid branch, collecting header cell, footer cell and editor components once per Grid on top of the regular child traversal. Fixes #199
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Components you set as a Grid column header, footer or editor could not be found by
find(...). They are now part of the component tree, so lookups work again.Fixes #199
What changed
The
Gridbranch ofTestingLifecycleHook.getAllChildren()was left commented out. TheGrid.ColumnandColumnGroupbranches skip virtual children on purpose, so that a component in a merged cell is not reported once per spanned column. With theGridbranch disabled, nobody reported those components at all and they were missing from the tree.The
Gridbranch is now enabled. It collects the header cell components, footer cell components and column editor components once per Grid, on top of the normal child traversal. Duplicates are removed, so a component in a merged cell is still reported exactly once. Comments in theGrid.ColumnandColumnGroupbranches now point to theGridbranch instead of the old, wrong explanation.Test summary
Column.setHeader(Component)is found byfind(Button.class)Column.setFooter(Component)is foundColumn.setEditorComponent(Component)is foundfind(Button.class).all()returns exactly 3Columnbranch drops virtual children; a regression here would break_get()with "found 2 matches"GridSlotTraversalTest.columnComponents_headerFooterAndEditor_allLocatable— rows 1, 2, 3, 4GridSlotTraversalTest.mergedHeaderCellComponent_reportedOnce— row 5Deliberately untested: multi-row headers and footers beyond the joined-cell case, and the plain child traversal of a Grid, which is already covered by the existing lookup tests.