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
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Binds every generated full binding managed by this proxy.getModel()Returns the current model object.getProperty(String property) Lazily creates and returns a half binding for the requested model property.voidrebind()Rebinds every generated full binding while preserving the current bound state.voidPushes reverse updates through every generated full binding.voidReplaces the proxied model and retargets all existing property bindings.voidsetProperty(String property, Object value) Prevents direct writes to the proxy.voidunbind()Unbinds every generated full binding managed by this proxy.voidupdate()Pushes updates through every generated full binding.Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
invokeMethod
-
Constructor Details
-
BindingProxy
Creates a proxy for the supplied model object.- Parameters:
model- the model object to expose
-
-
Method Details
-
getModel
Returns the current model object.- Returns:
- the current model
-
setModel
Replaces the proxied model and retargets all existing property bindings.- Parameters:
model- the new model object
-
getProperty
Lazily creates and returns a half binding for the requested model property.- Specified by:
getPropertyin interfaceGroovyObject- Parameters:
property- the property name to bind- Returns:
- a generated half binding rooted at the requested property
-
setProperty
Prevents direct writes to the proxy.- Specified by:
setPropertyin interfaceGroovyObject- Parameters:
property- the property name being writtenvalue- the attempted value
-
bind
public void bind()Binds every generated full binding managed by this proxy.- Specified by:
bindin interfaceBindingUpdatable
-
unbind
public void unbind()Unbinds every generated full binding managed by this proxy.- Specified by:
unbindin interfaceBindingUpdatable
-
rebind
public void rebind()Rebinds every generated full binding while preserving the current bound state.- Specified by:
rebindin interfaceBindingUpdatable
-
update
public void update()Pushes updates through every generated full binding.- Specified by:
updatein interfaceBindingUpdatable
-
reverseUpdate
public void reverseUpdate()Pushes reverse updates through every generated full binding.- Specified by:
reverseUpdatein interfaceBindingUpdatable
-