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

Marius Hanl mhanl at openjdk.java.net
Thu Jul 8 22:40:25 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 indentation 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.

Marius Hanl has updated the pull request incrementally with one additional commit since the last revision:

  calculated indentation in every method now which was previously done via leftLabelPadding

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

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/568/files
  - new: https://git.openjdk.java.net/jfx/pull/568/files/e84ad594..c8698493

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jfx&pr=568&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=568&range=00-01

  Stats: 30 lines in 1 file changed: 29 ins; 0 del; 1 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