Module MaterialFX

Class MFXCSSBridge

java.lang.Object
io.github.palexdev.materialfx.css.MFXCSSBridge

public class MFXCSSBridge extends Object
Helper class which is responsible for parsing the stylesheets for a given Parent.

The list is automatically rebuilt if the parent's stylesheets change.

This approach is very simple yet effective (ffs even a baby could make it), but it has a limitation at the moment. The stylesheets parsing is limited to the specified parent, it won't scan the entire scenegraph, I could also implement something like that, it's simple, it's just needed to mimic the behavior of the JavaFX' StyleManager, but at the moment I don't think it's really useful, so... we'll see in future if needed.

  • Constructor Details

    • MFXCSSBridge

      public MFXCSSBridge(Parent parent)
  • Method Details

    • initializeStylesheets

      public void initializeStylesheets()
      Called by the constructor the first time.

      Responsible for parsing and building the stylesheets list.

    • addListeners

      public void addListeners()
      Adds the listener responsible for updating the stylesheets list to the parent's stylesheets observable list.
    • dispose

      public void dispose()
      Disposes the MFXCSSBridge by removing the stylesheetsChanged listener.
    • getParent

      public Parent getParent()
    • setParent

      public void setParent(Parent parent)
    • getStylesheets

      public ObservableList<String> getStylesheets()
      Returns:
      the parsed stylesheets list