Package org.apache.groovy.swing.binding
Class PropertyBinding
java.lang.Object
org.apache.groovy.swing.binding.PropertyBinding
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionstatic enumDefines the thread on which target updates should run. -
Constructor Summary
ConstructorsConstructorDescriptionPropertyBinding(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 TypeMethodDescriptioncreateBinding(SourceBinding source, TargetBinding target) Creates a property-change-aware full binding rooted at this property.getBean()Returns the bean that owns the bound property.Returns the name of the bound property.Reads the current value of the bound property from the bean.Returns the threading strategy used when applying target updates.booleanReturns whether value-equality checks should suppress redundant updates.voidReplaces the bean that owns the bound property.voidsetNonChangeCheck(boolean nonChangeCheck) Enables or disables suppression of redundant equal-value updates.voidsetPropertyName(String propertyName) Replaces the name of the bound property.voidupdateTargetValue(Object newValue) Applies a new value to the bound property using the configured update strategy.
-
Constructor Details
-
PropertyBinding
Creates a property binding with the default update strategy for the bean type.- Parameters:
bean- the bean that owns the propertypropertyName- the property name
-
PropertyBinding
Creates a property binding using a named update strategy.- Parameters:
bean- the bean that owns the propertypropertyName- the property nameupdateStrategy- the named update strategy, ornull
-
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 propertypropertyName- the property nameupdateStrategy- the update strategy, ornullfor the default
-
-
Method Details
-
getUpdateStrategy
Returns the threading strategy used when applying target updates.- Returns:
- the update strategy
-
updateTargetValue
Applies a new value to the bound property using the configured update strategy.- Specified by:
updateTargetValuein interfaceTargetBinding- Parameters:
newValue- the new property value
-
isNonChangeCheck
public boolean isNonChangeCheck()Returns whether value-equality checks should suppress redundant updates.- Returns:
truewhen redundant updates should be suppressed
-
setNonChangeCheck
public void setNonChangeCheck(boolean nonChangeCheck) Enables or disables suppression of redundant equal-value updates.- Parameters:
nonChangeCheck-trueto suppress redundant equal-value updates
-
getSourceValue
Reads the current value of the bound property from the bean.- Specified by:
getSourceValuein interfaceSourceBinding- Returns:
- the current property value
-
createBinding
Creates a property-change-aware full binding rooted at this property.- Specified by:
createBindingin interfaceTriggerBinding- Parameters:
source- the source bindingtarget- the target binding- Returns:
- the created full binding
-
getBean
Returns the bean that owns the bound property.- Returns:
- the current bean
-
setBean
Replaces the bean that owns the bound property.- Parameters:
bean- the new bean
-
getPropertyName
Returns the name of the bound property.- Returns:
- the property name
-
setPropertyName
Replaces the name of the bound property.- Parameters:
propertyName- the new property name
-