RFR: 8231644: TreeTableView Regression: Indentation wrong using Label as column content type
Kevin Rushforth
kcr at openjdk.java.net
Thu Jul 8 00:00:53 UTC 2021
On Wed, 7 Jul 2021 00:25:15 GMT, Marius Hanl <mhanl at openjdk.org> wrote:
> This PR fixes a long standing issue with the TreeTableView indentation.
>
> 
>
> 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.
modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableCellSkin.java line 107:
> 105:
> 106: @Override
> 107: protected void layoutChildren(double x, double y, double w, double h) {
This isn't a review, but just a question and a comment.
Are there any other callers of `leftLabelPadding` that could be affected by the removal of the override?
Btw, you should add `/** {@inheritDoc} */` to the overridden `layoutChildren` method, since it is public API.
-------------
PR: https://git.openjdk.java.net/jfx/pull/568
More information about the openjfx-dev
mailing list