RFR: 8340344: The first item in TreeView is not aligned in the beginning [v2]

Andy Goryachev angorya at openjdk.org
Thu May 8 15:11:12 UTC 2025


On Wed, 7 May 2025 15:56:57 GMT, Ziad El Midaoui <zelmidaoui at openjdk.org> wrote:

>> The issue occurred because items preceding an item with children (items with a disclosure node) had different widths, which led to misalignment. This can be fixed by requesting a cell relayout whenever the disclosure node's width changes.
>
> Ziad El Midaoui has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update TreeCellSkin.java

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeCellSkin.java line 225:

> 223:                     maxDisclosureWidthMap.put(tree, disclosureWidth);
> 224: 
> 225:                     final VirtualFlow<?> flow = getVirtualFlow();

`final` is not necessary here

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeCellSkin.java line 227:

> 225:                     final VirtualFlow<?> flow = getVirtualFlow();
> 226:                     for (IndexedCell cell : flow.cells) {
> 227:                         if (cell == null || cell.isEmpty()) continue;

minor: it might be better to place continue in a separate block surrounded by curly braces:

if (x) {
  continue;
}


alternatively, it can be made even clearer:

if (cell != null && !cell.isEmpty()) {
                        cell.requestLayout();
                        cell.layout();
}

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r2079863305
PR Review Comment: https://git.openjdk.org/jfx/pull/1715#discussion_r2079871343


More information about the openjfx-dev mailing list