-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8370465: Right to Left Orientation Issues with MenuItem Component #27968
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
Conversation
|
👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into |
|
@prsadhuk 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 121 new commits pushed to the
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. ➡️ To integrate this PR with the above commit message to the |
|
/touch |
|
@prsadhuk The pull request is being re-evaluated and the inactivity timeout has been reset. |
Webrevs
|
|
That is expected as for WIndows L&F we are having dedicated offset for icon and checkmark/bullet so that they dont overlap as earlier before JDK-8348760 the icon and radiobutton bullet/checkmark was overlapping so checkmark was not visible so now each is drawn on its own dedicated position |
| if (icon != null) { | ||
| icon.paintIcon(c, g, x + VistaMenuItemCheckIconFactory.getIconWidth(), | ||
| y + OFFSET); | ||
| if (!c.getComponentOrientation().equals(ComponentOrientation.RIGHT_TO_LEFT)) { |
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.
Why not just if(c.getComponentOrientation().isLeftToRight()) ? Then you will not need the extra import and the documentation for ComponentOrientation clearly says that direct comparison should be avoided.
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.
Yes, I have modified to use the existing LTR check already used in the file
| Rectangle rect = lr.getTextRect(); | ||
|
|
||
| rect.x += lh.getAfterCheckIconGap(); | ||
| if (menuItem.getHorizontalTextPosition() != SwingConstants.LEADING) { |
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.
Not sure i understand why we only checking for "LEADING" text position. What if it is specified specifically as "LEFT" or "RIGHT"? What would result look like in the different component orientations with this fix?
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.
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.
Actually I have modified the PR to rectify layouting ensuring radiobutton bullet/checkmark are drawn at dedicated position and doesn't interfere with icon position for RTL too..Previous PR iteration was not taking into account of this for RTL so if the menuitem was selected in RTL, it was not shown..
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.
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.
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.
Yes, new version works correctly. I would suggest to add these menu items to the regression test but that is optional.
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.
As @azuev-java suggested, it might be a good idea to add the extra cases to the test.
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.
Added the menu items
@azuev-java Please take a look
should be ok now in latest iteration.. |
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.
Updated fix LGTM apart from minor test suggestions.
| /* | ||
| * @test id=windows | ||
| * @bug 4211052 | ||
| * @bug 4211052 8370465 |
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.
Instead of multiple separate jtreg tags for each LaF we can combine it using @run tags as below:
/*
...
...
* @run main/manual RightLeftOrientation windows
* @run main/manual RightLeftOrientation motif
* @run main/manual RightLeftOrientation metal
*/
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.
We decided to use it that way in [8346753](#25907 (comment)) sometime back
| Rectangle rect = lr.getTextRect(); | ||
|
|
||
| rect.x += lh.getAfterCheckIconGap(); | ||
| if (menuItem.getHorizontalTextPosition() != SwingConstants.LEADING) { |
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.
As @azuev-java suggested, it might be a good idea to add the extra cases to the test.
|
/integrate |
|
Going to push as commit fc5df4a.
Your commit was automatically rebased without conflicts. |







Icon rendering offset is wrong for RTL orientation which is why the icon was not rendered properly..Also, LEADING horizontal text position was not accounted for..
Before fix
With fix
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27968/head:pull/27968$ git checkout pull/27968Update a local copy of the PR:
$ git checkout pull/27968$ git pull https://git.openjdk.org/jdk.git pull/27968/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27968View PR using the GUI difftool:
$ git pr show -t 27968Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27968.diff
Using Webrev
Link to Webrev Comment