RFR: 8301302: Platform preferences API [v3]

Alessadro Parisi duke at openjdk.org
Mon Jul 24 17:45:50 UTC 2023


On Thu, 11 May 2023 14:38:01 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Hi all,
>> 
>> First of all, thanks for the efforts to integrate this new API into JavaFX. As a style theme developer myself I think this API is missing nowadays and will be a good addition to the SDK!
>> 
>> A comment not related to this specific PR but... the discussion about this new API was being held on the mailing list some time ago, I was also involved in that discussion. It stopped so I thought this wasn't going to go forward. I've only recently realized the discussion moved to here. So, my comment is: is there a centralized place to check on all the new developments in the javafx platform including ongoing efforts (I thought the mailing list was that place) ...?
>> For instance, I was having a small discussion on Twitter with a prominent member of the JavaFX community about how having this kind of API would be of interest to JavaFX. I don't think anyone involved knows that this PR (that would add such a feature) is ongoing... they might also have interesting insights to add...
>
> @dukke I don't think there's a central place for all JavaFX discussions. I've observed that high-level discussions seem to happen on the mailing list, while discussions of concrete implementation proposals often happen on GitHub. You didn't get any notifications on the mailing list for this PR since it's still in the Draft state.
> 
> That being said, this proposal seems to be stuck in the "do we want this in JavaFX?" stage.

> @mstr2 I see minor bugs and minor features as well as implementation details being discussed in the mailing list. I think a centralized place to see all that's being done in the javafx sdk (including proposed features) would be nice.
> 
> Personally, I feel that the ability to specify multiple user-agent stylesheets is a no-brainer. Right now, my javafx theme JMetro has to be composed of scene stylesheets which can be a hassle for many developers using it (given how it overrides styles set in code).
> 
> The other features are also important and I would be happy to see them in the javafx sdk, especially since I'm a theme developer and I've been missing these features for a while.
> 
> Perhaps if these features are discussed individually (for example only discussing the ability to have multiple user agent stylesheets) they would be "easier to sell"? And all the other ones, each in its own PR. At least they would be easier to discuss (as each PR would be less complex) and so potentially easier to sell. Without however missing the whole picture like you're doing here...

I agree. Currently, the hardest challenge I'm facing is to find a way to style my applications entirely. Adding the stylesheets on the main Scene preserves the JavaFX user agent while still allowing me to style all my custom components in that Scene. The issue is that obviously, styles are not applied to other Windows/Scenes, which means that Dialogs are problematic components. Adding the entire theme on them leads to awful performance, and so the only way to also include them is to set the user agent...but then JavaFX controls would lose their styles. Recently, I came up with a naive workaround for this. I coded a mechanism that allows to merge/combine multiple stylesheets into one. The good thing about this is that I can produce a single user agent stylesheet that can cover both JavaFX controls and my controls in every single Window/Scene. The bad thing is that at-rules do not work, so no typefaces, no other stylesheets, only full themes can be merged. For the fonts, I found out th
 at it's enough to add the stylesheet containing the font-faces declarations on the main Scene, and they will be picked everywhere.

Talking about #511 and #1014. I think that both the APIs are quite nice additions to JavaFX. However I was thinking, @mstr2 can't the two features be split? It seems to me, correct me if I'm wrong, that the Platform Preferences API  still requires quite some work. On the other hand the support for themes seems to be easier and faster to implement. I think it would be worth splitting the two features, and trying to add the Theme API by the next release

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

PR Comment: https://git.openjdk.org/jfx/pull/1014#issuecomment-1566645669


More information about the openjfx-dev mailing list