Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 3 commits into from

Conversation

Maran23
Copy link
Member

@Maran23 Maran23 commented Jul 7, 2021

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

image

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 also need/should adjust every other location where leftLabelPadding() was used:

  • computePrefHeight -> prefWidth() is always called with -1, so nothing got broken by not overriding this, but we should do it of course to be accurate in case we do one day.
  • computePrefWidth -> this is needed for auto sizing. I saw that it was slightly off without, so this 100% needed.
  • computeMinWidth -> the min width of a cell is not used, so nothing got broken by not overriding this but same as in computePrefHeight(), we should comply with the specs.
  • layoutChildren -> I saw a slight off sizing if the indentation is not subtracted to the width.

As a result of this, all method do effectively the same as they did with an overridden leftLabelPadding() (just earlier/later and always now of course).
Note: I also added some tests which pass before and pass after.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8231644: TreeTableView Regression: Indentation wrong using Label as column content type

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/568/head:pull/568
$ git checkout pull/568

Update a local copy of the PR:
$ git checkout pull/568
$ git pull https://git.openjdk.java.net/jfx pull/568/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 568

View PR using the GUI difftool:
$ git pr show -t 568

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/568.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 7, 2021

👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Jul 7, 2021
@mlbridge
Copy link

mlbridge bot commented Jul 7, 2021

Webrevs

@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Jul 7, 2021

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@kevinrushforth kevinrushforth self-requested a review July 9, 2021 13:36
…indentation

� Conflicts:
�	modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableCellSkin.java
@aghaisas
Copy link
Collaborator

Overall the fix looks ok. The new test fails without the fix and passes with it.

Can you please confirm the test programs provided in 2 duplicated bugs of JDK-8231644 also work as expected with this fix?

@Maran23
Copy link
Member Author

Maran23 commented Sep 24, 2021

Overall the fix looks ok. The new test fails without the fix and passes with it.

Can you please confirm the test programs provided in 2 duplicated bugs of JDK-8231644 also work as expected with this fix?

Just tried them. They both work fine. :)

@aghaisas
Copy link
Collaborator

Overall the fix looks ok. The new test fails without the fix and passes with it.
Can you please confirm the test programs provided in 2 duplicated bugs of JDK-8231644 also work as expected with this fix?

Just tried them. They both work fine. :)

Overall the fix looks ok. The new test fails without the fix and passes with it.
Can you please confirm the test programs provided in 2 duplicated bugs of JDK-8231644 also work as expected with this fix?

Just tried them. They both work fine. :)
That's great!

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the fix and test look good.

@openjdk
Copy link

openjdk bot commented Sep 29, 2021

@Maran23 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: aghaisas, kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 37 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@aghaisas, @kevinrushforth) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label Sep 29, 2021
@Maran23
Copy link
Member Author

Maran23 commented Sep 29, 2021

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label Sep 29, 2021
@openjdk
Copy link

openjdk bot commented Sep 29, 2021

@Maran23
Your change (at version 3776a37) is now ready to be sponsored by a Committer.

@kevinrushforth
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 29, 2021

Going to push as commit 30f5606.
Since your change was applied there have been 37 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Sep 29, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated rfr Ready for review sponsor Ready to sponsor labels Sep 29, 2021
@openjdk
Copy link

openjdk bot commented Sep 29, 2021

@kevinrushforth @Maran23 Pushed as commit 30f5606.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Maran23 Maran23 deleted the 8231644-indentation branch November 9, 2021 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
3 participants