root/gaphor/tags/gaphor-0.12.0/gaphor/UML/event.py

Revision 1992, 3.7 kB (checked in by arj..@yirdis.nl, 1 year ago)

Added specific events and interfaces for derived union and redefine properties.

Line 
1 """
2 Define events.
3 """
4
5 from interfaces import *
6 from zope import interface
7
8
9 class AttributeChangeEvent(object):
10     interface.implements(IAttributeChangeEvent)
11
12     def __init__(self, element, attribute, old_value, new_value):
13         self.element = element
14         self.property = attribute
15         self.old_value = old_value
16         self.new_value = new_value
17
18
19 class AssociationChangeEvent(object):
20     interface.implements(IAssociationChangeEvent)
21
22     def __init__(self, element, association):
23         self.element = element
24         self.property = association
25
26
27 class AssociationSetEvent(AssociationChangeEvent):
28
29     interface.implements(IAssociationSetEvent)
30
31     def __init__(self, element, association, old_value, new_value):
32         AssociationChangeEvent.__init__(self, element, association)
33         self.old_value = old_value
34         self.new_value = new_value
35
36
37 class AssociationAddEvent(AssociationChangeEvent):
38
39     interface.implements(IAssociationAddEvent)
40
41     def __init__(self, element, association, new_value):
42         AssociationChangeEvent.__init__(self, element, association)
43         self.new_value = new_value
44
45
46 class AssociationDeleteEvent(AssociationChangeEvent):
47
48     interface.implements(IAssociationDeleteEvent)
49
50     def __init__(self, element, association, old_value):
51         AssociationChangeEvent.__init__(self, element, association)
52         self.old_value = old_value
53
54
55 class DerivedUnionSetEvent(AssociationChangeEvent):
56
57     interface.implements(IAssociationSetEvent)
58
59     def __init__(self, element, association, old_value, new_value):
60         AssociationChangeEvent.__init__(self, element, association)
61         self.old_value = old_value
62         self.new_value = new_value
63
64
65 class DerivedUnionAddEvent(AssociationChangeEvent):
66
67     interface.implements(IAssociationAddEvent)
68
69     def __init__(self, element, association, new_value):
70         AssociationChangeEvent.__init__(self, element, association)
71         self.new_value = new_value
72
73
74 class DerivedUnionDeleteEvent(AssociationChangeEvent):
75
76     interface.implements(IAssociationDeleteEvent)
77
78     def __init__(self, element, association, old_value):
79         AssociationChangeEvent.__init__(self, element, association)
80         self.old_value = old_value
81
82
83 class RedefineSetEvent(AssociationChangeEvent):
84
85     interface.implements(IAssociationSetEvent)
86
87     def __init__(self, element, association, old_value, new_value):
88         AssociationChangeEvent.__init__(self, element, association)
89         self.old_value = old_value
90         self.new_value = new_value
91
92
93 class RedefineAddEvent(AssociationChangeEvent):
94
95     interface.implements(IAssociationAddEvent)
96
97     def __init__(self, element, association, new_value):
98         AssociationChangeEvent.__init__(self, element, association)
99         self.new_value = new_value
100
101
102 class RedefineDeleteEvent(AssociationChangeEvent):
103
104     interface.implements(IAssociationDeleteEvent)
105
106     def __init__(self, element, association, old_value):
107         AssociationChangeEvent.__init__(self, element, association)
108         self.old_value = old_value
109
110
111 class ElementCreateEvent(object):
112     interface.implements(IElementCreateEvent, IElementFactoryEvent)
113
114     def __init__(self, service, element):
115         self.service = service
116         self.element = element
117
118
119 class ElementDeleteEvent(object):
120     interface.implements(IElementDeleteEvent, IElementFactoryEvent)
121
122     def __init__(self, service, element):
123         self.service = service
124         self.element = element
125
126
127 class ModelFactoryEvent(object):
128     interface.implements(IModelFactoryEvent)
129
130     def __init__(self, service):
131         self.service = service
132
133
134 class FlushFactoryEvent(object):
135     interface.implements(IFlushFactoryEvent)
136
137     def __init__(self, service):
138         self.service = service
139
Note: See TracBrowser for help on using the browser.