UML model uses standard java.beans.PropertyChangeEvent events for notifying listeners about changes.
The main properties of the PropertyChangeEvent are as follows:
- Property name. The changed property name.
- New value. The new (current) changed property value.
- Old value. The old property value, which was before the property change.
Properties names are described in UML model properties names page
Example of the element’s name change event
propertyChangeEvent.getPropertyName().equals(PropertyNames.NAME); propertyChangeEvent.getNewValue() // will be new name of element; propertyChangeEvent.getOldValue() // will be name of element before change.
Example of the new element creation event
propertyChangeEvent.getPropertyName().equals(UML2MetamodelConstants.INSTANCE_CREATED); propertyChangeEvent.getNewValue() // will be new created element; propertyChangeEvent.getOldValue() // will be null.
Related pages