Package org.apache.groovy.swing.binding
Class ClosureTriggerBinding
java.lang.Object
org.apache.groovy.swing.binding.ClosureTriggerBinding
- All Implemented Interfaces:
SourceBinding,TriggerBinding
Creates bindings that track the property path referenced by a closure expression.
-
Constructor Summary
ConstructorsConstructorDescriptionClosureTriggerBinding(Map<String, TriggerBinding> syntheticBindings) Creates a closure trigger binding with the supplied synthetic trigger registry. -
Method Summary
Modifier and TypeMethodDescriptioncreateBinding(SourceBinding source, TargetBinding target) Creates a property-path-aware binding by snooping the closure's property accesses.Returns the closure evaluated by this trigger binding.Evaluates the configured closure to obtain the current source value.voidsetClosure(Closure closure) Replaces the closure evaluated by this trigger binding.
-
Constructor Details
-
ClosureTriggerBinding
Creates a closure trigger binding with the supplied synthetic trigger registry.- Parameters:
syntheticBindings- synthetic trigger bindings keyed by class and property
-
-
Method Details
-
getClosure
Returns the closure evaluated by this trigger binding.- Returns:
- the source closure
-
setClosure
Replaces the closure evaluated by this trigger binding.- Parameters:
closure- the new source closure
-
createBinding
Creates a property-path-aware binding by snooping the closure's property accesses.- Specified by:
createBindingin interfaceTriggerBinding- Parameters:
source- the source binding, which must be this trigger bindingtarget- the target binding- Returns:
- a property-path-aware full binding
-
getSourceValue
Evaluates the configured closure to obtain the current source value.- Specified by:
getSourceValuein interfaceSourceBinding- Returns:
- the current source value
-