Class ClosureTriggerBinding

java.lang.Object
org.apache.groovy.swing.binding.ClosureTriggerBinding
All Implemented Interfaces:
SourceBinding, TriggerBinding

public class ClosureTriggerBinding extends Object implements TriggerBinding, SourceBinding
Creates bindings that track the property path referenced by a closure expression.
  • Constructor Details

    • ClosureTriggerBinding

      public ClosureTriggerBinding(Map<String,TriggerBinding> syntheticBindings)
      Creates a closure trigger binding with the supplied synthetic trigger registry.
      Parameters:
      syntheticBindings - synthetic trigger bindings keyed by class and property
  • Method Details

    • getClosure

      public Closure getClosure()
      Returns the closure evaluated by this trigger binding.
      Returns:
      the source closure
    • setClosure

      public void setClosure(Closure closure)
      Replaces the closure evaluated by this trigger binding.
      Parameters:
      closure - the new source closure
    • createBinding

      public FullBinding createBinding(SourceBinding source, TargetBinding target)
      Creates a property-path-aware binding by snooping the closure's property accesses.
      Specified by:
      createBinding in interface TriggerBinding
      Parameters:
      source - the source binding, which must be this trigger binding
      target - the target binding
      Returns:
      a property-path-aware full binding
    • getSourceValue

      public Object getSourceValue()
      Evaluates the configured closure to obtain the current source value.
      Specified by:
      getSourceValue in interface SourceBinding
      Returns:
      the current source value