-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8294148: Support JSplitPane for instructions and test UI #17845
Conversation
The test to be updated separately.
👋 Welcome back aivanov! A progress list of the required criteria for merging this PR into |
@aivanov-jdk The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
See PR #17847 for a real-life usage example of |
* already set | ||
* @throws IllegalArgumentException if {panelCreator} is {@code null} | ||
*/ | ||
public Builder splitUI(PanelCreator panelCreator) { |
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.
public Builder splitUI(PanelCreator panelCreator) { | |
public Builder splitUI(PanelCreator panelCreator, int splitUIOrientation ) { |
Would it be easier if we use splitUIOrientation
or an enum similar to Position to determine the split than have three different methods - splitUI, splitUIRight & splitUIBottom
? And eliminate the private splitUI()
and have the orientation logic within public splitUI()
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.
I don't think so… I find the Position
cumbersome too.
Using JSplitPane.HORIZONTAL_SPLIT
or JSplitPane.VERTICAL_SPLIT
in a public method of Builder exposes the internal detail that JSplitPane
is used. What if we decide to implement it differently? After all, the UI could be placed into a horizontal or vertical Box
? Passing an int
as the orientation is not type-safe, we'll need to verify the parameter or let JSplitPane
constructor do it.
An enum is type-safe but it's cumbersome to type:
splitUI(() -> new JPanel(), PassFailJFrame.SplitOrientation.HORIZONTAL)
// or
splitUI(() -> new JPanel(), JSplitPane.HORIZONTAL_SPLIT)
does not look as good to me as
splitUIRight(() -> new JPanel())
-Right
explicitly conveys the chosen position and is much shorter than the above samples with enum
or constants from JSplitPane
.
Initially, I wanted to re-use Position
but decided not to … for flexibility. Split UI could be combined with additional test UI windows… Not that I see a use case for such a use…
The three methods make the Builder
more crowded for the sake of brevity of its usage in the test code. I expect it would be splitUI
in majority of cases.
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.
In terms of flexibility & future extensibility (if any) your approach works better.
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.
JSplitPane addition to PassFailJFame looks good.
@aivanov-jdk 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 67 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 |
/integrate |
Going to push as commit b419e95.
Your commit was automatically rebased without conflicts. |
@aivanov-jdk Pushed as commit b419e95. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This enhancement adds three methods to
PassFailJFrame.Builder
:splitUIRight
to display test UI to the right of the instructions;splitUIBottom
to display test UI to the bottom of the instructions;splitUI
: a convenience method for a default split orientation, currently defaults tosplitUIRight
.If UI of a test is simple, it's reasonable to embed the test UI into the instruction UI. In this case, there's only one frame the tester will be interacting with.
The implementation is similar to that of
testUI
provided under JDK-8294156. ThesplitUI-
method accept a reference toPanelCreator
interface. Instead of creating an entire frame, you create only a component, usually aJPanel
orBox
, which contains all the test UI.For example,
In addition to it, there's an advanced
testUI
method which acceptsPanelCreator
; in this case the test UI is hosted inJDialog
with the instruction frame being its owner. Because the test UI is in a modeless owned dialog, it always displays above the instruction frame, switch to the test app brings up both the instructions and test UI. I don't expect it'd be used often, yet it's easy to implement.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17845/head:pull/17845
$ git checkout pull/17845
Update a local copy of the PR:
$ git checkout pull/17845
$ git pull https://git.openjdk.org/jdk.git pull/17845/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17845
View PR using the GUI difftool:
$ git pr show -t 17845
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17845.diff
Webrev
Link to Webrev Comment