WatchProperty
interface WatchProperty
Package: dev.joid.lib.ui.node.property · Module: core · Source: WatchProperty.java
Action that Node.watch(...) runs on its node each time the watched signal changes.
Description
Section titled “Description”Pass one or more to Node.watch: watch(items, WatchProperty.CLEAR_CHILDREN, WatchProperty.BODY) removes the children, then runs the body again, so the node rebuilds its subtree from the current value.
A lambda (node, signal) -> ... gives an action of your own.
When an action throws, JOID prints a warning and the other actions of the watch still run.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | apply(Node node, Signal<?> signal) abstract | Runs the action on node after signal changed, on the render thread, while JOID follows the reads like in a body. |
Constants and fields
Section titled “Constants and fields”| Type | Name | Value | Summary |
|---|---|---|---|
WatchProperty | BODY | Runs the body that the node received with body(...) again; it does nothing on a node without body. | |
WatchProperty | CLEAR_CHILDREN | (node, signal) -> node.clearChildren() | Removes every child of the node. |
Method details
Section titled “Method details”void apply(Node node, Signal<?> signal) abstract
Runs the action on node after signal changed, on the render thread, while JOID follows the reads like in a body.
Constant and field details
Section titled “Constant and field details”WatchProperty BODY
Runs the body that the node received with body(...) again; it does nothing on a node without body.
It does not remove the children that the previous body added: put CLEAR_CHILDREN before it.
CLEAR_CHILDREN
Section titled “CLEAR_CHILDREN”WatchProperty CLEAR_CHILDREN
Removes every child of the node.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
