Package org.apache.groovy.swing.binding
Class MutualPropertyBinding
java.lang.Object
org.apache.groovy.swing.binding.MutualPropertyBinding
- All Implemented Interfaces:
BindingUpdatable,FullBinding
Maintains two synchronized
PropertyBinding instances that update each other.- Since:
- Groovy 1.6
-
Method Summary
Modifier and TypeMethodDescriptionvoidbind()Binds both forward and reverse bindings when the pair is fully configured.Returns the converter applied from source to target.Returns the converter applied from target to source.Returns the forward source-side property binding.Returns the forward target-side property binding.Returns the validator applied to forward updates.voidrebind()Rebinds both forward and reverse bindings when currently active.protected voidRebuilds the internal forward and reverse bindings to match the current configuration.voidPushes an update from the target side back to the source side.voidsetConverter(Closure converter) Replaces the converter applied from source to target.voidsetReverseConverter(Closure reverseConverter) Replaces the converter applied from target to source.voidsetSourceBinding(SourceBinding sourceBinding) Replaces the source-side property binding and rebuilds the paired bindings.voidsetTargetBinding(TargetBinding targetBinding) Replaces the target-side property binding and rebuilds the paired bindings.voidsetValidator(Closure validator) Replaces the validator applied to forward updates.voidunbind()Unbinds both forward and reverse bindings.voidupdate()Pushes an update from the source side to the target side.
-
Method Details
-
getSourceBinding
Returns the forward source-side property binding.- Specified by:
getSourceBindingin interfaceFullBinding- Returns:
- the source binding
-
getTargetBinding
Returns the forward target-side property binding.- Specified by:
getTargetBindingin interfaceFullBinding- Returns:
- the target binding
-
setSourceBinding
Replaces the source-side property binding and rebuilds the paired bindings.- Specified by:
setSourceBindingin interfaceFullBinding- Parameters:
sourceBinding- the new source binding
-
setTargetBinding
Replaces the target-side property binding and rebuilds the paired bindings.- Specified by:
setTargetBindingin interfaceFullBinding- Parameters:
targetBinding- the new target binding
-
setValidator
Replaces the validator applied to forward updates.- Specified by:
setValidatorin interfaceFullBinding- Parameters:
validator- the validator closure, ornull
-
getValidator
Returns the validator applied to forward updates.- Specified by:
getValidatorin interfaceFullBinding- Returns:
- the validator closure, or
null
-
setConverter
Replaces the converter applied from source to target.- Specified by:
setConverterin interfaceFullBinding- Parameters:
converter- the forward converter, ornull
-
getConverter
Returns the converter applied from source to target.- Specified by:
getConverterin interfaceFullBinding- Returns:
- the forward converter, or
null
-
setReverseConverter
Replaces the converter applied from target to source.- Specified by:
setReverseConverterin interfaceFullBinding- Parameters:
reverseConverter- the reverse converter, ornull
-
getReverseConverter
Returns the converter applied from target to source.- Specified by:
getReverseConverterin interfaceFullBinding- Returns:
- the reverse converter, or
null
-
rebuildBindings
protected void rebuildBindings()Rebuilds the internal forward and reverse bindings to match the current configuration. -
bind
public void bind()Binds both forward and reverse bindings when the pair is fully configured.- Specified by:
bindin interfaceBindingUpdatable
-
unbind
public void unbind()Unbinds both forward and reverse bindings.- Specified by:
unbindin interfaceBindingUpdatable
-
rebind
public void rebind()Rebinds both forward and reverse bindings when currently active.- Specified by:
rebindin interfaceBindingUpdatable
-
update
public void update()Pushes an update from the source side to the target side.- Specified by:
updatein interfaceBindingUpdatable
-
reverseUpdate
public void reverseUpdate()Pushes an update from the target side back to the source side.- Specified by:
reverseUpdatein interfaceBindingUpdatable
-