Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8097832

[CSS] Changing user_agent stylesheet on scene or subscene

XMLWordPrintable

      Today it is not possible to change a user_agent stylesheet (theme) for a separate window (i.e. a different Scene). When setting the user_agent css, the whole application is impacted.
      This is required for applications such as Scene Builder, which needs to view a user design with different styles: Caspian, themes related to embedded or touch devices, etc... without impacting the theme of SB itself.

      Based on feedback from the SceneBuilder team, the current proposal is to add the following API to SubScene. The API will also be added to Scene to keep the two parallel.

      Note that a user-agent stylesheet set on a SubScene or Scene will be used _in place of_ the platform-default user-agent stylesheet (which, in 1.8, is modena). Support is being added for @import make it easier to customize something like caspian or modena without having to duplicate all of the rules.

          public ObjectProperty<String> userAgentStylesheetProperty()

          /**
           * Get the URL of the user-agent stylesheet that will be used by this SubScene. If the URL has not been set,
           * the platform-default user-agent stylesheet will be used.
           * <p>
           * For additional information about using CSS with the scene graph,
           * see the <a href="doc-files/cssref.html">CSS Reference Guide</a>.
           * </p>
           * @return The URL of the user-agent stylesheet that will be used by this SubScene,
           * or null if has not been set.
           */
          public String getUserAgentStylesheet()

          /**
           * Set the URL of the user-agent stylesheet that will be used by this SubScene in place of the
           * the platform-default user-agent stylesheet. If the URL does not resolve to a valid location,
           * the platform-default user-agent stylesheet will be used.
           * <p>
           * For additional information about using CSS with the scene graph,
           * see the <a href="doc-files/cssref.html">CSS Reference Guide</a>.
           * </p>
           * @param url The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL
           * does not have a [scheme:] component, the URL is considered to be the [path] component only.
           * Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to
           * the root of the application's classpath.
           */
          public void setUserAgentStylesheet(String url)


            dgrieve David Grieve
            jcambon Jerome Cambon
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: