RFR: 8317116: Provide layouts for multiple test UI in PassFailJFrame [v2]

Alexander Zvegintsev azvegint at openjdk.org
Fri Sep 27 14:51:35 UTC 2024


On Fri, 27 Sep 2024 14:48:20 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> With the instruction frame exposed, it would be possible to create owned modeless `JDialog` or `Dialog` instead of `JFrame` and `Frame` which has a great benefit: all the windows are brought to the top when you switch back to the test from another application. And there's only a single window on the taskbar for the test.
>> 
>> I've been thinking about adding helper methods `createOwnedJDialog` and `createOwnedDialog` to cover this use case.
>> 
>> Currently, it's possible to host test UI in a modeless dialog if you use `testUI` with `PanelCreator` that is pass a method which creates `JComponent`. I admit I like navigating the UI much easier in this case.
>
>> If you call `.position(PassFailJFrame.Position.TOP_LEFT_CORNER)` after `.positionTestUIRightRow`, it is respected.
> 
> Perhaps, this behaviour should be called out in the docs somewhere. All `.positionTestUIRight*` as well as `.positionTestUIBottom*` *implicitly* set the position.

> You can do it by using the InstructionUI interface that's passed to you when you implement a custom layout.

But it cannot be combined with the newly added methods like:


        PassFailJFrame.builder()
                .instructions(INSTRUCTIONS)
                .rows(15)
                .columns(30)
                .testUI(() -> WindowCreator.createTestWindows(3))
                .positionTestUI((testWindows, instructionUI) -> instructionUI.setLocation(200, 200))
                // or add a new method like
                //.instructionFrameLocation(200, 200)
                .positionTestUIRightRow()
                .build()
                .awaitAndCheck();


The idea is to make it very simple without having to implement the `positionTestUI` interface (I am not talking about exposing the frame, see the snippet above).
Like place the instruction frame here, and layout other windows relative to it.

But I agree it is a rare case.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21207#discussion_r1778744890


More information about the client-libs-dev mailing list