Package org.apache.groovy.swing.binding

# Class PropertyBinding

java.lang.Object
org.apache.groovy.swing.binding.PropertyBinding

All Implemented Interfaces:
  `SourceBinding`, `TargetBinding`, `TriggerBinding`

public class PropertyBinding extends Object implements SourceBinding, TargetBinding, TriggerBinding
Binds directly to a bean property and can act as a source, target, or trigger binding.

Since:
  Groovy 1.1

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `PropertyBinding.UpdateStrategy`
  Defines the thread on which target updates should run.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PropertyBinding(Object bean, String propertyName)`
  Creates a property binding with the default update strategy for the bean type.
  `PropertyBinding(Object bean, String propertyName, String updateStrategy)`
  Creates a property binding using a named update strategy.
  `PropertyBinding(Object bean, String propertyName, PropertyBinding.UpdateStrategy updateStrategy)`
  Creates a property binding using an explicit update strategy.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FullBinding`
  `createBinding(SourceBinding source, TargetBinding target)`
  Creates a property-change-aware full binding rooted at this property.
  `Object`
  `getBean()`
  Returns the bean that owns the bound property.
  `String`
  `getPropertyName()`
  Returns the name of the bound property.
  `Object`
  `getSourceValue()`
  Reads the current value of the bound property from the bean.
  `PropertyBinding.UpdateStrategy`
  `getUpdateStrategy()`
  Returns the threading strategy used when applying target updates.
  `boolean`
  `isNonChangeCheck()`
  Returns whether value-equality checks should suppress redundant updates.
  `void`
  `setBean(Object bean)`
  Replaces the bean that owns the bound property.
  `void`
  `setNonChangeCheck(boolean nonChangeCheck)`
  Enables or disables suppression of redundant equal-value updates.
  `void`
  `setPropertyName(String propertyName)`
  Replaces the name of the bound property.
  `void`
  `updateTargetValue(Object newValue)`
  Applies a new value to the bound property using the configured update strategy.

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

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

- ## Constructor Details

  - ### PropertyBinding

    public PropertyBinding(Object bean, String propertyName)
    Creates a property binding with the default update strategy for the bean type.
    Parameters:
      `bean` - the bean that owns the property
      `propertyName` - the property name

  - ### PropertyBinding

    public PropertyBinding(Object bean, String propertyName, String updateStrategy)
    Creates a property binding using a named update strategy.
    Parameters:
      `bean` - the bean that owns the property
      `propertyName` - the property name
      `updateStrategy` - the named update strategy, or `null`

  - ### PropertyBinding

    public PropertyBinding(Object bean, String propertyName, PropertyBinding.UpdateStrategy updateStrategy)
    Creates a property binding using an explicit update strategy.
    Parameters:
      `bean` - the bean that owns the property
      `propertyName` - the property name
      `updateStrategy` - the update strategy, or `null` for the default

- ## Method Details

  - ### getUpdateStrategy

    public PropertyBinding.UpdateStrategy getUpdateStrategy()
    Returns the threading strategy used when applying target updates.
    Returns:
      the update strategy

  - ### updateTargetValue

    public void updateTargetValue(Object newValue)
    Applies a new value to the bound property using the configured update strategy.
    Specified by:
      `updateTargetValue` in interface `TargetBinding`
    Parameters:
      `newValue` - the new property value

  - ### isNonChangeCheck

    public boolean isNonChangeCheck()
    Returns whether value-equality checks should suppress redundant updates.
    Returns:
      `true` when redundant updates should be suppressed

  - ### setNonChangeCheck

    public void setNonChangeCheck(boolean nonChangeCheck)
    Enables or disables suppression of redundant equal-value updates.
    Parameters:
      `nonChangeCheck` - `true` to suppress redundant equal-value updates

  - ### getSourceValue

    public Object getSourceValue()
    Reads the current value of the bound property from the bean.
    Specified by:
      `getSourceValue` in interface `SourceBinding`
    Returns:
      the current property value

  - ### createBinding

    public FullBinding createBinding(SourceBinding source, TargetBinding target)
    Creates a property-change-aware full binding rooted at this property.
    Specified by:
      `createBinding` in interface `TriggerBinding`
    Parameters:
      `source` - the source binding
      `target` - the target binding
    Returns:
      the created full binding

  - ### getBean

    public Object getBean()
    Returns the bean that owns the bound property.
    Returns:
      the current bean

  - ### setBean

    public void setBean(Object bean)
    Replaces the bean that owns the bound property.
    Parameters:
      `bean` - the new bean

  - ### getPropertyName

    public String getPropertyName()
    Returns the name of the bound property.
    Returns:
      the property name

  - ### setPropertyName

    public void setPropertyName(String propertyName)
    Replaces the name of the bound property.
    Parameters:
      `propertyName` - the new property name