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

8307960: Create Table Column PopupMenu lazily #1133

Closed

Conversation

Maran23
Copy link
Member

@Maran23 Maran23 commented May 11, 2023

This PR changes the columnPopupMenu, so that it is created lazily.

The problem here is, that the columnPopupMenu is always initialized and updated via bindings, even if the table menu button is never shown (setTableMenuButtonVisible(false)) or the user never clicked on it.
This problem can be solved by creating the columnPopupMenu and related bindings when it should be shown the first time.

I also added many tests to ensure that everything still works (there are no tests for that area as of now).

Side note: There are a bunch of tickets with the wish to customize the Popup shown by the table menu button or show it programmatically. This ticket will prepare this, as now all Popup related code is on one place and in the future we can think of implementing a way to override this behaviour in a way that the Popup and all related bindings are never created and therefore do not decrease performance.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1133/head:pull/1133
$ git checkout pull/1133

Update a local copy of the PR:
$ git checkout pull/1133
$ git pull https://git.openjdk.org/jfx.git pull/1133/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1133

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1133.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 11, 2023

👋 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 May 11, 2023
@mlbridge
Copy link

mlbridge bot commented May 11, 2023

Webrevs

@kevinrushforth
Copy link
Member

Reviewer: @andy-goryachev-oracle

Copy link
Contributor

@lukostyra lukostyra left a comment

Choose a reason for hiding this comment

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

Left a couple very minor style-related comments

@@ -32,4 +34,11 @@ public static TableColumnHeader getColumnHeaderFor(TableHeaderRow tr, final Tabl
return tr.getColumnHeaderFor(col);
}

public static ContextMenu getColumnPopupMenu(TableHeaderRow tableHeaderRow) {
return tableHeaderRow.getColumnPopupMenu();
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I would keep tr instead of tableHeaderRow for consistency with already existing static method.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would too - avoids wrapping the line, and there is no need to spell the name for a one line method.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am more a fan of descriptive variable names. I know this is a one-line method - but on the other hand tr is just not a good understandable name, even for a very short method.
Since you read code more often than you write it, I'm for keeping the descriptive name, also in this simple case :)

}

public static Pane getCornerRegion(TableHeaderRow tableHeaderRow) {
return tableHeaderRow.getCornerRegion();
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

@andy-goryachev-oracle
Copy link
Contributor

andy-goryachev-oracle commented May 12, 2023

There is also a similar property in TreeTableView which also goes through the same code path in TableHeaderRow. Should we have a separate test or set of tests for TTV?
edit: please disregard, tests are there!

@andy-goryachev-oracle
Copy link
Contributor

Verified that the code works as expected with Tree- and TableView, with no ill effects (on Mac), using
https://github.com/andy-goryachev-oracle/MonkeyTest

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

Would it be possible to add test(s) for TreeTableView? Otherwise, looks good.
edit: tests are there, I must be blind!

@@ -32,4 +34,11 @@ public static TableColumnHeader getColumnHeaderFor(TableHeaderRow tr, final Tabl
return tr.getColumnHeaderFor(col);
}

public static ContextMenu getColumnPopupMenu(TableHeaderRow tableHeaderRow) {
return tableHeaderRow.getColumnPopupMenu();
Copy link
Contributor

Choose a reason for hiding this comment

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

I would too - avoids wrapping the line, and there is no need to spell the name for a one line method.

@openjdk
Copy link

openjdk bot commented May 12, 2023

@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:

8307960: Create Table Column PopupMenu lazily

Reviewed-by: angorya

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 2 new commits pushed to the master branch:

  • 7095364: 8307807: Replace use of System.getProperty("os.name") with PlatformUtil calls
  • 604fc26: 8307363: TextFlow.underlineShape()

Please see this link for an up-to-date comparison between the source branch of this pull request and 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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label May 12, 2023
@andy-goryachev-oracle
Copy link
Contributor

@Maran23 I'll re-approve if you want to make minor changes.

@Maran23
Copy link
Member Author

Maran23 commented May 12, 2023

/integrate

@openjdk
Copy link

openjdk bot commented May 12, 2023

Going to push as commit 8aff525.
Since your change was applied there have been 2 commits pushed to the master branch:

  • 7095364: 8307807: Replace use of System.getProperty("os.name") with PlatformUtil calls
  • 604fc26: 8307363: TextFlow.underlineShape()

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 12, 2023
@openjdk openjdk bot closed this May 12, 2023
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels May 12, 2023
@openjdk
Copy link

openjdk bot commented May 12, 2023

@Maran23 Pushed as commit 8aff525.

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

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
4 participants