-
Notifications
You must be signed in to change notification settings - Fork 458
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
8301797: Pagination control has the wrong size #1021
8301797: Pagination control has the wrong size #1021
Conversation
👋 Welcome back angorya! A progress list of the required criteria for merging this PR into |
Webrevs
|
A fix request in JBS is in progress (since we're in RDP2), which I'll review along with the code. @aghaisas Can I ask you to also review it? /reviewers 2 |
@kevinrushforth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the fix works for the specific case in the bug report, I don't think it's quite right.
In your description you say:
while making sure no properties of the control are touched in the constructor (only in install()).
However, the current fix does touch properties of the control in the constructor via the moved resetIndexes
method. First, the "if" check you added to avoid calling setCurrentPageIndex
on the control is backwards, meaning that it is being called in the case you were trying to avoid. Second, createPage, which is also called from resetIndexes
has a code path that also calls setCurrentPageIndex
.
If it really is important that the skin constructor not call any setter on the control, then you will need to rework the solution. Possibly by moving the call to resetIndexes
back to install, and figuring out why calling it later isn't causing the pref size to be recomputed.
@@ -649,7 +651,11 @@ private void resetIndexes(boolean usePageIndex) { | |||
currentStackPane.getChildren().clear(); | |||
nextStackPane.getChildren().clear(); | |||
|
|||
getSkinnable().setCurrentPageIndex(currentIndex); | |||
if (usePageIndex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be !usePageIndex
, given the stated intent? The resetIndexes
method is called twice: once from the constructor with usePageIndex = true
and once from resetIndiciesAndNav
with usePageIndex = false
.
@@ -194,6 +194,8 @@ public PaginationSkin(final Pagination control) { | |||
nextStackPane.getStyleClass().add("page"); | |||
nextStackPane.setVisible(false); | |||
|
|||
resetIndexes(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will end up calling into the control in a couple places, which the PR description says you are trying to avoid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, but since it sets to the same value it will be a no-op
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
You are right! In fact, the added logic to bypass setting control properties in the constructor is unnecessary - it will be essentially a no-op, since it uses the control's current page index. Thank you! |
The changes you just made look good to me, since everything is now internally consistent. I'll retest and then finish my review. |
Thank you, @kevinrushforth . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@@ -194,6 +194,8 @@ public PaginationSkin(final Pagination control) { | |||
nextStackPane.getStyleClass().add("page"); | |||
nextStackPane.setVisible(false); | |||
|
|||
resetIndexes(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simplified fix looks good to me!
Thanks for fixing this regression.
@andy-goryachev-oracle 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:
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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 192ba4f. |
@andy-goryachev-oracle Pushed as commit 192ba4f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Fixed regression introduced by JDK-8295754, targeting upstream jfx20 branch.
The method PaginationSkin.resetIndexes(true) has been moved to the original position in the constructor, fixing the initialization, while making sure no properties of the control are touched in the constructor (only in install()).
Added a test case.
Tested with the PaginationDisappear.java and the LeakTest app
https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/apps/LeakTestApp.java
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/1021/head:pull/1021
$ git checkout pull/1021
Update a local copy of the PR:
$ git checkout pull/1021
$ git pull https://git.openjdk.org/jfx pull/1021/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1021
View PR using the GUI difftool:
$ git pr show -t 1021
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1021.diff