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

Pseudo classes - how should we use them

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 8
    • javafx

      For a couple of days I've been developing an general validation library:

      https://bitbucket.org/walczak_it/prodoko-base/src/HEAD/prodoko-fx/src/main/java/com/prodoko/fx/scene/validation?at=master

      It's role is not just to decorate fields that didn't pass validation. But also Tabs and other containers that might hold those fields - in my app one form will have fields scattered around many tabs.

      I thought it would be an great idea to use pseudo classes like :error, :warning, :ok on various scenegraph elements (Controls, Nodes Tabs in a TabPane) but after a couple of hours of coding I noticed that:
      * I cannot modify the pseudo classes by just having a Styleable argument in my method
      * only Node has the pseudoClassStateChanged method but for example Tab is not an node

      So I changed my implementation to use normal style class.

      First question is: was my intended approach to use pseudo classes for this case a good one ?

      If the answer is no - pseudo classes should only be changed by a class that actually implements/extends some kind of new Node or Control and not by any external class - then I would suggest to make pseudoClassStateChanged protected and mention this in the documentation.

      If the answer is yes - then I think we should add this method to the Styleable interface.

            Unassigned Unassigned
            awalczakijfx Adam Walczak (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Imported: