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

Alexey Ivanov aivanov at openjdk.org
Fri Sep 27 14:56:37 UTC 2024


On Fri, 27 Sep 2024 14:48:32 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>>> 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.

No, not directly.

But you can combine it with explicit call to `WindowLayouts`:


.positionTestUI((testWindows, instructionUI) -> {
    instructionUI.setLocation(200, 200);
    WindowLayouts.rightOneRow(testWindows, instructionUI);
})


So, this (rare) scenario still doesn't require you to reimplement everything.

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

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


More information about the client-libs-dev mailing list