Class Props
java.lang.Object
megalodonte.base.components.Props
- All Implemented Interfaces:
PropsInterface
Abstract base for reactive, theme-aware component properties. Handles:
- State binding via
bind(Node, ReadableState, Consumer) - Automatic theme re-application when
ThemeManagerchanges
applyTheme(Node, Props, ThemeInterface) to define how the theme maps to
node styles.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidapply(javafx.scene.Node node) Binds this property set to the node and subscribes to theme changes.protected abstract voidapplyTheme(javafx.scene.Node node, Props props, megalodonte.base.theme.ThemeInterface theme) protected <T> voidSubscribes a state to a handler.protected voidbindStates(javafx.scene.Node node) Override to perform initial state bindings.
-
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:
applyin interfacePropsInterface
-
bindStates
protected void bindStates(javafx.scene.Node node) Override to perform initial state bindings. Called once duringapply(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 stylestate- the state to observehandler- called with each new value
-
applyTheme
protected abstract void applyTheme(javafx.scene.Node node, Props props, megalodonte.base.theme.ThemeInterface theme)
-