1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Defines an extension to the C{IComponent} interface which adds to it the
17 capacity to contain other components."""
18
19 from muntjac.ui.component import IComponent, Event
20
21
23 """Extension to the L{IComponent} interface which adds to it the
24 capacity to contain other components. All UI elements that can have child
25 elements implement this interface.
26
27 @author: Vaadin Ltd.
28 @author: Richard Lincoln
29 @version: 1.1.2
30 """
31
33 """Adds the component into this container.
34
35 @param c: the component to be added.
36 """
37 raise NotImplementedError
38
39
41 """Removes the component from this container.
42
43 @param c: the component to be removed.
44 """
45 raise NotImplementedError
46
47
49 """Removes all components from this container."""
50 raise NotImplementedError
51
52
54 """Replaces the component in the container with another one without
55 changing position.
56
57 This method replaces component with another one is such way that the
58 new component overtakes the position of the old component. If the old
59 component is not in the container, the new component is added to the
60 container. If the both component are already in the container, their
61 positions are swapped. IComponent attach and detach events should be
62 taken care as with add and remove.
63
64 @param oldComponent:
65 the old component that will be replaced.
66 @param newComponent:
67 the new component to be replaced.
68 """
69 raise NotImplementedError
70
71
73 """Gets an iterator to the collection of contained components. Using
74 this iterator it is possible to step through all components contained
75 in this container.
76
77 @return: the component iterator.
78 """
79 raise NotImplementedError
80
81
83 """Causes a repaint of this component, and all components below it.
84
85 This should only be used in special cases, e.g when the state of a
86 descendant depends on the state of a ancestor.
87 """
88 raise NotImplementedError
89
90
92 """Moves all components from an another container into this container.
93 The components are removed from C{source}.
94
95 @param source:
96 the container which contains the components that are to be
97 moved to this container.
98 """
99 raise NotImplementedError
100
101
103 """Listens the component attach/detach events.
104
105 @param listener:
106 the listener to add.
107 """
108 raise NotImplementedError
109
110
111 - def addCallback(self, callback, eventType=None, *args):
112 raise NotImplementedError
113
114
116 """Stops the listening component attach/detach events.
117
118 @param listener:
119 the listener to removed.
120 """
121 raise NotImplementedError
122
123
125 raise NotImplementedError
126
127
129 """IComponent attach listener interface."""
130
132 """A new component is attached to container.
133
134 @param event:
135 the component attach event.
136 """
137 raise NotImplementedError
138
139
141 """IComponent detach listener interface."""
142
144 """A component has been detached from container.
145
146 @param event:
147 the component detach event.
148 """
149 raise NotImplementedError
150
151
153 """IComponent attach event sent when a component is attached to container.
154 """
155
156 - def __init__(self, container, attachedComponent):
157 """Creates a new attach event.
158
159 @param container:
160 the component container the component has been
161 detached to.
162 @param attachedComponent:
163 the component that has been attached.
164 """
165 super(ComponentAttachEvent, self).__init__(container)
166 self._component = attachedComponent
167
168
170 """Gets the component container.
171
172 @return: the component container.
173 """
174 return self.getSource()
175
176
178 """Gets the attached component.
179
180 @return: the attach component.
181 """
182 return self._component
183
184
186 """IComponent detach event sent when a component is detached from
187 container."""
188
189 - def __init__(self, container, detachedComponent):
190 """Creates a new detach event.
191
192 @param container:
193 the component container the component has been
194 detached from.
195 @param detachedComponent:
196 the component that has been detached.
197 """
198 super(ComponentDetachEvent, self).__init__(container)
199 self._component = detachedComponent
200
201
203 """Gets the component container.
204
205 @return: the component container.
206 """
207 return self.getSource()
208
209
211 """Gets the detached component.
212
213 @return: the detached component.
214 """
215 return self._component
216