RFR: 8340344: The first item in TreeView is not aligned in the beginning [v5]
Ziad El Midaoui
zelmidaoui at openjdk.org
Wed May 14 14:45:58 UTC 2025
On Wed, 14 May 2025 14:28:23 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
>> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeCellSkin.java line 232:
>>
>>> 230: cell.layout();
>>> 231: }
>>> 232: }
>>
>> 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.
>>
>> Can there be a way to avoid re-layout of previous cells, too ? 🤔
>
> Also noticed a scenario: When a TreeCell with disclosureNode is currently not shown on screen but becomes visible on scrolling. In that case the TreeCells are layout while the scroll is in progress. I see only one way to avoid this that maxDisclosureWidthMap should reflect the correct value before starting the layout.
Yes true,
the default value of the `defaultDisclosureWidth` when there is no disclosureNode is 18 and when we come across a TreeCell that has a disclosure node the `defaultDisclosureWidth` changes to 20 that is what causes the TreeCells to move visually.
My first thought was to change the default value as that would avoid doing the re-layout and would reflect the the correct value before starting the layout also visually we won't see that change in the TreeCells position.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r2089122257
More information about the openjfx-dev
mailing list