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