RFR: 8231644: TreeTableView Regression: Indentation wrong using Label as column content type

Marius Hanl mhanl at openjdk.java.net
Wed Jul 7 00:30:14 UTC 2021


This PR fixes a long standing issue with the TreeTableView indentation.

![image](https://user-images.githubusercontent.com/66004280/124681647-473e7380-dec9-11eb-906d-4228fc39cbf9.png)

In short:
**TreeTableCellSkin** overrides **leftLabelPadding()** to calculate the indentation (the result of this method is added to **x**).
While this is fine, this method is not always called (by **LabeledSkinBase#layoutLabelInArea**), e.g. when no text is set. 
So when a TreeTableCell only sets a graphic (e.g. via **setGraphic()** in **updateItem()**), the indentaation will be messed up.

Fixed this by adding the calculated indentation to **x** before we call **layoutChildren()**.

-> We basically add the indentation to **x** when we call **layoutChildren()** instead of letting **layoutLabelInArea()** do it sometimes via **leftLabelPadding()**. (which is called directly by **layoutChildren()**)

Note: I also added some tests which pass before and pass after.

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

Commit messages:
 - 8231644: fixed wrong indentation for tree cells with graphic only

Changes: https://git.openjdk.java.net/jfx/pull/568/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=568&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8231644
  Stats: 183 lines in 2 files changed: 168 ins; 0 del; 15 mod
  Patch: https://git.openjdk.java.net/jfx/pull/568.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/568/head:pull/568

PR: https://git.openjdk.java.net/jfx/pull/568


More information about the openjfx-dev mailing list