Package muntjac :: Package event :: Module method_event_source
[hide private]
[frames] | no frames]

Source Code for Module muntjac.event.method_event_source

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  """Interface for classes supporting registration of methods as event 
17  receivers.""" 
18   
19   
20 -class IMethodEventSource(object):
21 """Interface for classes supporting registration of methods as event 22 receivers. 23 24 For more information on the inheritable event mechanism see the 25 L{muntjac.event package documentation<muntjac.event>}. 26 27 @author: Vaadin Ltd. 28 @author: Richard Lincoln 29 @version: 1.1.2 30 """ 31
32 - def addListener(self, eventType, obj, method):
33 """Registers a new event listener with the specified activation method 34 to listen events generated by this component. If the activation method 35 does not have any arguments the event object will not be passed to it 36 when it's called. 37 38 For more information on the inheritable event mechanism see the 39 L{muntjac.event package documentation<muntjac.event>}. 40 41 @param eventType: 42 the type of the listened event. Events of this type or its 43 subclasses activate the listener. 44 @param obj: 45 the object instance who owns the activation method. 46 @param method: 47 the activation method or the name of the activation method. 48 @raise ValueError: 49 unless C{method} has a match in C{object} 50 """ 51 raise NotImplementedError
52 53
54 - def removeListener(self, eventType, obj, method):
55 """Removes all registered listeners matching the given parameters. 56 Since this method receives the event type and the listener object as 57 parameters, it will unregister all C{object}'s methods that are 58 registered to listen to events of type C{eventType} generated by this 59 component. 60 61 For more information on the inheritable event mechanism see the 62 L{muntjac.event package documentation<muntjac.event>}. 63 64 @param eventType: 65 the exact event type the C{object} listens to. 66 @param obj: 67 the target object that has registered to listen to events 68 of type eventType with one or more methods. 69 @param method: 70 the method owned by the target that's registered to listen 71 to events of type eventType. Or the name of the method owned 72 by C{target} that's registered to listen to events of type 73 C{eventType}. 74 """ 75 raise NotImplementedError
76