Package org.apache.groovy.swing.binding

# 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 Summary

  Constructors
  Constructor
  Description
  `ClosureTriggerBinding(Map<String,TriggerBinding> syntheticBindings)`
  Creates a closure trigger binding with the supplied synthetic trigger registry.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FullBinding`
  `createBinding(SourceBinding source, TargetBinding target)`
  Creates a property-path-aware binding by snooping the closure's property accesses.
  `Closure`
  `getClosure()`
  Returns the closure evaluated by this trigger binding.
  `Object`
  `getSourceValue()`
  Evaluates the configured closure to obtain the current source value.
  `void`
  `setClosure(Closure closure)`
  Replaces the closure evaluated by this trigger binding.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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