RFR: 8340344: The first item in TreeView is not aligned in the beginning [v5]
Ambarish Rapte
arapte at openjdk.org
Tue May 20 09:37:57 UTC 2025
On Thu, 15 May 2025 11:49:45 GMT, Ziad El Midaoui <zelmidaoui at openjdk.org> wrote:
>>> This would perform a layout of all cells, re-layout of previous cells and layout of next cells. but, layout of next cells is performed again as continuation layout of TreeView. A solution would be to break the loop when `cell` is current cell being layouted, so that at least the layout of next cells is not performed twice.
>>
>> Would it be possible to avoid re-layout of the cells that are after the Cell with a disclosureNode ?
>
>> Would it be possible to avoid re-layout of the cells that are after the Cell with a disclosureNode ?
>
> This is actually what is happening, when we scroll down and find a TreeCell that has a disclosure node this is when the condition `disclosureWidth > defaultDisclosureWidth` is true and we do a re-layout of the visible previous cells before the disclosure node and the new value is saved in the `maxDisclosureWidthMap` so the cells that are layouted after the disclosure node when scrolling are using the new value of `defaultDisclosureWidth`.
Yes, the cells after disclosure node use the new `defaultDisclosureWidth`. But their layout happens twice using the new `defaultDisclosureWidth`.
**First time**: The loop `for (IndexedCell cell : flow.cells) {` initiates the layout of all the cells, including the cells that are after the disclosure node.
**Second time**: and layout of those after cells happens again as part of ongoing layout of `TreeView` from this method `Parent.layout()`
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r2097495175
More information about the openjfx-dev
mailing list