| 1 |
""" |
|---|
| 2 |
UML events emited on a change in the data model. |
|---|
| 3 |
""" |
|---|
| 4 |
|
|---|
| 5 |
from zope import interface |
|---|
| 6 |
from gaphor.interfaces import IService, IServiceEvent |
|---|
| 7 |
|
|---|
| 8 |
class IElementEvent(interface.Interface): |
|---|
| 9 |
"""Generic event fired when element state changes. |
|---|
| 10 |
""" |
|---|
| 11 |
element = interface.Attribute("The changed element") |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
class IElementCreateEvent(IElementEvent): |
|---|
| 15 |
"""A new element has been created. |
|---|
| 16 |
""" |
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class IElementDeleteEvent(IElementEvent): |
|---|
| 20 |
"""An element is deleted from the model. |
|---|
| 21 |
""" |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
class IElementChangeEvent(IElementEvent): |
|---|
| 25 |
"""Generic event fired when element state changes. |
|---|
| 26 |
""" |
|---|
| 27 |
property = interface.Attribute("The property that changed") |
|---|
| 28 |
old_value = interface.Attribute("The property value before the change") |
|---|
| 29 |
new_value = interface.Attribute("The property value after the change") |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
class IAttributeChangeEvent(IElementChangeEvent): |
|---|
| 33 |
""" |
|---|
| 34 |
An attribute has changed. |
|---|
| 35 |
""" |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
class IAssociationChangeEvent(IElementChangeEvent): |
|---|
| 39 |
""" |
|---|
| 40 |
An association hs changed. |
|---|
| 41 |
This event may be fired for both ends of the association. |
|---|
| 42 |
""" |
|---|
| 43 |
|
|---|
| 44 |
class IAssociationSetEvent(IAssociationChangeEvent): |
|---|
| 45 |
""" |
|---|
| 46 |
An association with [0..1] multiplicity has been changed. |
|---|
| 47 |
""" |
|---|
| 48 |
|
|---|
| 49 |
class IAssociationAddEvent(IAssociationChangeEvent): |
|---|
| 50 |
""" |
|---|
| 51 |
An association with [0..*] multiplicity has been changed: a new entry is |
|---|
| 52 |
added. ``new_value`` contains the property being added. |
|---|
| 53 |
""" |
|---|
| 54 |
|
|---|
| 55 |
class IAssociationDeleteEvent(IAssociationChangeEvent): |
|---|
| 56 |
""" |
|---|
| 57 |
An association with [0..*] multiplicity has been changed: an entry has |
|---|
| 58 |
been removed. ``old_value`` contains the property that has been removed. |
|---|
| 59 |
""" |
|---|
| 60 |
|
|---|
| 61 |
class IElementFactoryEvent(IServiceEvent): |
|---|
| 62 |
""" |
|---|
| 63 |
Events related to individual model elements. |
|---|
| 64 |
""" |
|---|
| 65 |
|
|---|
| 66 |
class IModelFactoryEvent(IElementFactoryEvent): |
|---|
| 67 |
""" |
|---|
| 68 |
A new model is loaded into the ElementFactory. |
|---|
| 69 |
""" |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
class IFlushFactoryEvent(IElementFactoryEvent): |
|---|
| 73 |
""" |
|---|
| 74 |
All elements are removed from the ElementFactory. |
|---|
| 75 |
This event is emitted before the factory is emptied. |
|---|
| 76 |
""" |
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|