Class Props

java.lang.Object
megalodonte.base.components.Props
All Implemented Interfaces:
PropsInterface

public abstract class Props extends Object implements PropsInterface
Abstract base for reactive, theme-aware component properties. Handles: Subclasses implement applyTheme(Node, Props, ThemeInterface) to define how the theme maps to node styles.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    apply(javafx.scene.Node node)
    Binds this property set to the node and subscribes to theme changes.
    protected abstract void
    applyTheme(javafx.scene.Node node, Props props, megalodonte.base.theme.ThemeInterface theme)
     
    protected <T> void
    bind(javafx.scene.Node node, megalodonte.base.state.ReadableState<T> state, Consumer<T> handler)
    Subscribes a state to a handler.
    protected void
    bindStates(javafx.scene.Node node)
    Override to perform initial state bindings.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Props

      public Props()
  • Method Details

    • apply

      public final void apply(javafx.scene.Node node)
      Binds this property set to the node and subscribes to theme changes.
      Specified by:
      apply in interface PropsInterface
    • bindStates

      protected void bindStates(javafx.scene.Node node)
      Override to perform initial state bindings. Called once during apply(Node).
    • bind

      protected <T> void bind(javafx.scene.Node node, megalodonte.base.state.ReadableState<T> state, Consumer<T> handler)
      Subscribes a state to a handler. The handler is called immediately with the current value and again on every subsequent change.
      Parameters:
      node - the node to style
      state - the state to observe
      handler - called with each new value
    • applyTheme

      protected abstract void applyTheme(javafx.scene.Node node, Props props, megalodonte.base.theme.ThemeInterface theme)