@Retention(value=SOURCE) @Target(value=FIELD) public @interface InvalidationListener
Annotates a property.
This transformation provides a convenient way to register InvalidationListeners on an observable bean by leveraging Groovy's closures and the Groovy cast operator.
The following code exemplifies what must be written by hand in order to register an InvalidationListener.
import griffon.transform.FXObservable import javafx.beans.InvalidationListener class MyModel { @FXObservable String name @FXObservable String lastname private def snoopAll = { ... } MyModel() { nameProperty().addListener(snoopAll as InvalidationListener) lastnameProperty().addListener({ controller.someAction(it) } as InvalidationListener) } }
Applying @InvalidationListener to the previous snippet results in the following code
import griffon.transform.FXObservable import griffon.transform.InvalidationListener class MyModel { @FXObservable @InvalidationListener(snoopAll) String name @FXObservable @InvalidationListener({ controller.someAction(it)}) String lastname private def snoopAll = { ... } }
Any closures found as the annotation's value will be either transformed into inner classes that implement InvalidationListener (when the value is a closure defined in place) or be casted as a proxy of InvalidationListener (when the value is a property reference found in the same class).
List of closures are also supported.
public abstract String value