RFR: 8301302: Platform preferences API [v3]

Andy Goryachev angorya at openjdk.org
Mon Jul 24 17:45:45 UTC 2023


On Mon, 24 Apr 2023 20:13:30 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

> Do you mean that you want `Preferences.appearanceProperty()`, `Preferences.backgroundColorProperty()` and `Preferences.foregroundColorProperty()` to be returned as a list? For example, by adding another method like:

I meant 

ObjectProperty<?> Preferences.getProperty(String key);
Set<String> listPropertyKeys();


it would also be nice to obtain a typed property right away.  That might be more difficult, since one needs to use a dedicated class for the key what contains the value type, which might be clunky.

> `ObservableMap` is my preferred solution.

Map.containsValue() would have to resolve values for all the keys.  Is this expected?
If the code already resolves all values, I presume on the first call to `getPreferences`, the Map is probably ok.

Does querying for  all the values take long? Any possibility of getting blocked waiting for something?

> What I've been calling `Appearance` in this PR is _one_ of those knobs.

I think we are on the same page here.

My point here is that, from the API design standpoint, it is better to think ahead and consider controlling multiple attributes instead of a singularly invented Appearance enum.  Why not have `Stage.setAttributes(Set)` instead of `setAppearance()` then?

We can still have an Apperance enum, but this time it will be just one of many possible attributes.  it could be platform-independent if we agree that it's well defined, or it could be platform-specific like DWMWA_USE_IMMERSIVE_DARK_MODE.

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

PR Comment: https://git.openjdk.org/jfx/pull/1014#issuecomment-1520892988
PR Comment: https://git.openjdk.org/jfx/pull/1014#issuecomment-1520935390
PR Comment: https://git.openjdk.org/jfx/pull/1014#issuecomment-1520944848


More information about the openjfx-dev mailing list