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

StyleClass list and caspian style classes

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: fx2.0.2, fx2.1
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:

      Description

      At some point we observed that having a non empty styleclass list was creating some issues with the SceneBuilder context. For our EA, we decided to hide the caspian styleclasses from the list.
      A discussion started between Greg, David and Richard to find a solution. No bug was created at the time. This bug capture the issue and a possible solution proposed by Richard.
      JF

      Richard:"I think I have a solution to this problem which works quite nicely. Nicely, except for the fact that there is a bit more work on the CSS side (sorry David).

      Right now, we only support 2 of the 3 main selector types in CSS:
      (a) A, P, Div, and other such element names (we don't support this -- I don't think anyway. If we do, all the better)
      (b) . style classes
      (c) # ids

      Way back when, we did support (a) such that we used Button in our stylesheets instead of .button

      However we changed this to use .button instead because of two reasons. First MyButton extends Button didn't get styled, because it wasn't a Button, unless we did a full inheritance lookup, which was extremely costly. Second, we needed the ability to clear the style as opposed to having to manually override every style declared in caspian.css

      So here is the proposal
      -- leave styleClasses as is -- it is a list, and it is empty by default
      -- add styleType as a String -- make it impl in this release but public later. This would be "Button" for buttons, "RadioButton" for radio buttons, etc
      -- update the stylesheets to use Button instead of .button, etc, for Controls. For parts of a skin (such as slider-thumb), continue using style classes (since they are private to the skin, this works great)

      This ends up solving all the problems:
       - styleClasses is empty by default, so you can just set it whenever you want to whatever you want
       - the styleType is inherited
       - the styleType can be overridden in subclasses to be a more specific type (RadioButton instead of ToggleButton, for example)
       - the styleType can be cleared by the developer or set to something else (I could set the styleType of a Button instance to "RadioButton" if I wanted to)
       - we get the 3rd way to specify an element
       - FXML doesn't have to change
       - We can close DTL-3136 "

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jfdenise Jean-Francois Denise (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported: