1 '''
2 Defines an L{AEEvent} indicating that a simple property (text, numeric) of an
3 accessible changed.
4
5 @author: Peter Parente
6 @organization: IBM Corporation
7 @copyright: Copyright (c) 2005, 2007 IBM Corporation
8 @license: The BSD License
9
10 @author: Frank Zenker
11 @author: Ramona Bunk
12 @organization: IT Science Center Ruegen gGmbH, Germany
13 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen
14 @license: The BSD License
15
16 All rights reserved. This program and the accompanying materials are made
17 available under the terms of the BSD license which accompanies
18 this distribution, and is available at
19 U{http://www.opensource.org/licenses/bsd-license.php}
20 '''
21
22 import AccessEngine
23 import Base
24
26 '''
27 Event that fires when a text or numeric property changes.
28
29 This class registers its name and whether it should be monitored by default in
30 an L{AEMonitor} using the L{Base.registerEventType} function
31 when this module is first imported. The L{AEMonitor} can use this
32 information to build its menus.
33
34 @ivar name: Name of the property that changed
35 @type name: string
36 @ivar value: The new value associated with the property
37 @type value: string or integer
38 '''
39 Base.registerEventType('PropertyChange', False)
40 - def __init__(self, por, name, value, **kwargs):
41 '''
42 Stores the L{AEPor <AEPor.AEPor>}, property name, and its new value.
43
44 @param por: Point of regard to the accessible whose property changed
45 @type por: L{AEPor <AEPor.AEPor>}
46 @param name: Name of the property that changed
47 @type name: string
48 @param value: The new value associated with the property
49 @type value: string or integer
50 '''
51 Base.AEEvent.__init__(self, **kwargs)
52 self.name = name
53 self.value = value
54 self.por = por
55
57 '''
58 Returns a human readable representation of this event including its name,
59 its L{AEPor <AEPor.AEPor>}, its property name, and its new value.
60
61 @return: Information about this event
62 @rtype: string
63 '''
64 name = Base.AEEvent.__str__(self)
65 return '%s:\n\tPOR: %s\n\tproperty: %s\n\tvalue: %s' % \
66 (name, self.por, self.name, self.value)
67
69 '''
70 Contacts the L{AETierManager} so it can manage the property change event.
71
72 @return: Always True to indicate the event executed properly
73 @rtype: boolean
74 '''
75 AccessEngine.AETierManager.manageEvent(self)
76 return True
77
79 '''
80 Fetches data out of this L{PropertyChange} for use by a
81 L{AEScript.EventScript.onPropertyChange}-Task.
82
83 @return: Dictionary of parameters to be passed to a
84 L{AEScript.EventScript.onPropertyChange}-Task as follows:
85 - por: The L{AEPor <AEPor.AEPor>} of the accessible whose property changed
86 - name: The text name of the property that changed
87 - value: The new text value of the property
88 @rtype: dictionary
89 '''
90 return {'por':self.getPOR(), 'name':self.name, 'value':self.value}
91