Withdrawn: 8267546: Add CSS themes as a first-class concept
duke
duke at openjdk.org
Sat May 27 03:01:08 UTC 2023
On Fri, 21 May 2021 04:30:28 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
> This PR adds style themes as a first-class concept to OpenJFX. A style theme is a collection of stylesheets and the logic that governs them. Style themes can respond to OS notifications and update their stylesheets dynamically. This PR also re-implements Caspian and Modena as style themes.
>
> ### New APIs in `javafx.graphics`
> The new theming-related APIs in `javafx.graphics` provide a basic framework to support application-wide style themes. Higher-level theming concepts (for example, "dark mode" detection or accent coloring) are not a part of this basic framework, because any API invented here might soon be out of date. Implementations can build on top of this framework to add useful higher-level features.
> #### 1. StyleTheme
> A style theme is an implementation of the `javafx.css.StyleTheme` interface:
>
> /**
> * {@code StyleTheme} is a collection of user-agent stylesheets that specify the appearance of UI controls and
> * other nodes in the application. {@code StyleTheme} is implicitly used by all JavaFX nodes in the scene graph,
> * unless it is overridden by any of the following properties:
> * <ul>
> * <li>{@link Application#userAgentStylesheetProperty() Application.userAgentStylesheet}
> * <li>{@link Scene#userAgentStylesheetProperty() Scene.userAgentStylesheet}
> * <li>{@link SubScene#userAgentStylesheetProperty() SubScene.userAgentStylesheet}
> * </ul>
> * <p>
> * The list of stylesheets that comprise a {@code StyleTheme} can be modified while the application is running,
> * enabling applications to create dynamic themes that respond to changing user preferences.
> * <p>
> * A {@code StyleTheme} can be applied using the {@link Application#setUserAgentStyleTheme(StyleTheme)} method:
> * <pre>{@code
> * public class App extends Application {
> * @Override
> * public void start(Stage primaryStage) {
> * setUserAgentStyleTheme(new MyCustomTheme());
> *
> * primaryStage.setScene(...);
> * primaryStage.show();
> * }
> * }
> * }</pre>
> *
> * @since 21
> */
> public interface StyleTheme {
> /**
> * Gets the list of stylesheet URLs that comprise this {@code StyleTheme}.
> * <p>
> * If the list of stylesheets that comprise this {@code StyleTheme} is changed at runtime, this
> * method must return an {@link ObservableList} to allow the CSS subsystem to subscribe to list
> * change notifications.
> *
> * @implSpec Implementations of this method that...
This pull request has been closed without being integrated.
-------------
PR: https://git.openjdk.org/jfx/pull/511
More information about the openjfx-dev
mailing list