Module MaterialFX

Class OnInvalidated<T>

java.lang.Object
io.github.palexdev.materialfx.utils.others.observables.When<T>
io.github.palexdev.materialfx.utils.others.observables.OnInvalidated<T>

public class OnInvalidated<T> extends When<T>
Concrete implementation of When that uses InvalidationListeners to listen for changes for a given ObservableValue.

You can specify the action to perform when this happens using a Consumer, then(Consumer).

To activate the construct do not forget to call listen() at the end.

An example:
 
      BooleanProperty aSwitch = new SimpleBooleanProperty(false);
      When.onInvalidated(aSwitch) // You can also use... OnInvalidated.forObservable(...)
              .then(value -> System.out.println("Value switched to: " + value))
              .oneShot()
              .listen();