Package org.apache.groovy.swing.binding

# Class BindingProxy

java.lang.Object
groovy.lang.GroovyObjectSupport
org.apache.groovy.swing.binding.BindingProxy

All Implemented Interfaces:
  `GroovyObject`, `BindingUpdatable`

public class BindingProxy extends GroovyObjectSupport implements BindingUpdatable
This class returns half bound `FullBinding`s on the source half to the model object for every property reference (and I do mean every, valid or not, queried before or not). These returned half bindings are stored strongly in a list when generated. Changing the model will keep all existing bindings but change the source on all of the bindings. Formerly Known as Model Binding.

Since:
  Groovy 1.5

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BindingProxy(Object model)`
  Creates a proxy for the supplied model object.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `bind()`
  Binds every generated full binding managed by this proxy.
  `Object`
  `getModel()`
  Returns the current model object.
  `Object`
  `getProperty(String property)`
  Lazily creates and returns a half binding for the requested model property.
  `void`
  `rebind()`
  Rebinds every generated full binding while preserving the current bound state.
  `void`
  `reverseUpdate()`
  Pushes reverse updates through every generated full binding.
  `void`
  `setModel(Object model)`
  Replaces the proxied model and retargets all existing property bindings.
  `void`
  `setProperty(String property, Object value)`
  Prevents direct writes to the proxy.
  `void`
  `unbind()`
  Unbinds every generated full binding managed by this proxy.
  `void`
  `update()`
  Pushes updates through every generated full binding.

  ### Methods inherited from class groovy.lang.GroovyObjectSupport

  `getMetaClass, setMetaClass`

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

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

  ### Methods inherited from interface groovy.lang.GroovyObject

  `invokeMethod`

- ## Constructor Details

  - ### BindingProxy

    public BindingProxy(Object model)
    Creates a proxy for the supplied model object.
    Parameters:
      `model` - the model object to expose

- ## Method Details

  - ### getModel

    public Object getModel()
    Returns the current model object.
    Returns:
      the current model

  - ### setModel

    public void setModel(Object model)
    Replaces the proxied model and retargets all existing property bindings.
    Parameters:
      `model` - the new model object

  - ### getProperty

    public Object getProperty(String property)
    Lazily creates and returns a half binding for the requested model property.
    Specified by:
      `getProperty` in interface `GroovyObject`
    Parameters:
      `property` - the property name to bind
    Returns:
      a generated half binding rooted at the requested property

  - ### setProperty

    public void setProperty(String property, Object value)
    Prevents direct writes to the proxy.
    Specified by:
      `setProperty` in interface `GroovyObject`
    Parameters:
      `property` - the property name being written
      `value` - the attempted value

  - ### bind

    public void bind()
    Binds every generated full binding managed by this proxy.
    Specified by:
      `bind` in interface `BindingUpdatable`

  - ### unbind

    public void unbind()
    Unbinds every generated full binding managed by this proxy.
    Specified by:
      `unbind` in interface `BindingUpdatable`

  - ### rebind

    public void rebind()
    Rebinds every generated full binding while preserving the current bound state.
    Specified by:
      `rebind` in interface `BindingUpdatable`

  - ### update

    public void update()
    Pushes updates through every generated full binding.
    Specified by:
      `update` in interface `BindingUpdatable`

  - ### reverseUpdate

    public void reverseUpdate()
    Pushes reverse updates through every generated full binding.
    Specified by:
      `reverseUpdate` in interface `BindingUpdatable`