RFR: 8317836: FX nodes embedded in JFXPanel need to track component orientation [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Mon Oct 30 07:22:41 UTC 2023
On Sat, 28 Oct 2023 18:25:53 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> I have tried to put in place what you suggested. Can you please take a look at the PR and see if it's in the right direction and suggest further.
>> I have few doubts
>>
>> - It seems JFXPanel call EmbeddedStage interface methods and not the other way round, so I am not sure how to "call a method in embedded stage that would delegate to JFXPanel".
>> - It seems [Scene::calcEffectiveNodeOrientation](https://github.com/openjdk/jfx/blob/9b93c962f45e5cf0b3a9f1090f307603be130a0e/modules/javafx.graphics/src/main/java/javafx/scene/Scene.java#L6343) is private and not part of swing-interop code/package so I am not sure how to leverage it from JFXPanel/EmbeddedStage....I have tried setting EmbeddedStage orientation from JFXPanel and query it from Scene but am not sure how to call `calcEffectiveNodeOrientation`
>
> Yes, you are right that JFXPanel needs to call into the stage and not the other way around. The general approach now looks correct, however, you'll need to add the orientation attribute on the JavaFX Window (`EmbeddedWindow`) not on the peer (`EmbeddedStage`). The other thing you will need is to to call `SceneHelper::parentEffectiveOrientationInvalidated` from `EmbeddedWindow::setOrientation` when the value of the orientation changes.
I have made the suggested changes and updated the PR.
But it seems the orientation of the text in the test attached in JBS is at the middle initially (and not at LTR or RTL) and it only begins to track the orientation after 1 iteration of changing JFrame orientation. Is it because of INHERIT default value which causes the effective orientation to not follow the changed orientation immediately? Does it need to be looked at or is it expected?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1271#discussion_r1375760666
More information about the openjfx-dev
mailing list