Package groovy.swing.model
Class PropertyModel
java.lang.Object
groovy.swing.model.PropertyModel
- All Implemented Interfaces:
NestedValueModel,ValueModel
Exposes a named property of another
ValueModel as its own value model.-
Constructor Summary
ConstructorsConstructorDescriptionPropertyModel(ValueModel sourceModel, String property) Creates a writable property model withObjectas its declared type.PropertyModel(ValueModel sourceModel, String property, Class type) Creates a writable property model with an explicit declared type.PropertyModel(ValueModel sourceModel, String property, Class type, boolean editable) Creates a property model with explicit type and editability. -
Method Summary
Modifier and TypeMethodDescriptionReturns the property name represented by this model.Returns the model that supplies the owning object for the bound property.getType()Returns the declared property type.getValue()Reads the current property value from the source object.booleanIndicates whether writes should be forwarded to the source property.voidWrites a new value to the property on the current source object.
-
Constructor Details
-
PropertyModel
Creates a writable property model withObjectas its declared type.- Parameters:
sourceModel- the model that supplies the owning objectproperty- the property name to access
-
PropertyModel
Creates a writable property model with an explicit declared type.- Parameters:
sourceModel- the model that supplies the owning objectproperty- the property name to accesstype- the declared property type
-
PropertyModel
Creates a property model with explicit type and editability.- Parameters:
sourceModel- the model that supplies the owning objectproperty- the property name to accesstype- the declared property typeeditable- whether writes should be forwarded to the source property
-
-
Method Details
-
getProperty
Returns the property name represented by this model.- Returns:
- the property name
-
getSourceModel
Returns the model that supplies the owning object for the bound property.- Specified by:
getSourceModelin interfaceNestedValueModel- Returns:
- the nested source model
-
getValue
Reads the current property value from the source object.- Specified by:
getValuein interfaceValueModel- Returns:
- the current property value, or
nullwhen the source object isnull
-
setValue
Writes a new value to the property on the current source object.- Specified by:
setValuein interfaceValueModel- Parameters:
value- the new property value
-
getType
Returns the declared property type.- Specified by:
getTypein interfaceValueModel- Returns:
- the property type
-
isEditable
public boolean isEditable()Indicates whether writes should be forwarded to the source property.- Specified by:
isEditablein interfaceValueModel- Returns:
truewhen the property model is writable
-