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 All rights reserved. This program and the accompanying materials are made
11 available under the terms of the BSD license which accompanies
12 this distribution, and is available at
13 U{http://www.opensource.org/licenses/bsd-license.php}
14 '''
15
16 import Base
17
19 '''
20 Event that fires when a text or numeric property changes.
21
22 This class registers its name and whether it should be monitored by default in
23 an L{AEMonitor} using the L{Base.registerEventType} function
24 when this module is first imported. The L{AEMonitor} can use this
25 information to build its menus.
26
27 @ivar name: Name of the property that changed
28 @type name: string
29 @ivar value: The new value associated with the property
30 @type value: string or integer
31 '''
32 Base.registerEventType('PropertyChange', False)
33 - def __init__(self, por, name, value, **kwargs):
34 '''
35 Stores the L{POR}, property name, and its new value.
36
37 @param por: Point of regard to the accessible whose property changed
38 @type por: L{POR}
39 @param name: Name of the property that changed
40 @type name: string
41 @param value: The new value associated with the property
42 @type value: string or integer
43 '''
44 Base.AccessEngineEvent.__init__(self, **kwargs)
45 self.name = name
46 self.value = value
47 self.por = por
48
50 '''
51 Returns a human readable representation of this event including its name,
52 its L{POR}, its property name, and its new value.
53
54 @return: Information about this event
55 @rtype: string
56 '''
57 name = Base.AccessEngineEvent.__str__(self)
58 return '%s:\n\tPOR: %s\n\tproperty: %s\n\tvalue: %s' % \
59 (name, self.por, self.name, self.value)
60
61 - def execute(self, tier_manager, **kwargs):
62 '''
63 Contacts the L{TierManager} so it can manage the property change event.
64
65 @param tier_manager: TierManager that will handle the event
66 @type tier_manager: L{TierManager}
67 @param kwargs: Packed references to other managers not of interest here
68 @type kwargs: dictionary
69 @return: Always True to indicate the event executed properly
70 @rtype: boolean
71 '''
72 tier_manager.manageEvent(self)
73 return True
74
76 '''
77 Fetches data out of this L{PropertyChange} for use by a
78 L{Task.PropertyTask}.
79
80 @return: Dictionary of parameters to be passed to a
81 L{Task.PropertyTask} as follows:
82 - por: The L{POR} of the accessible whose property changed
83 - name: The text name of the property that changed
84 - value: The new text value of the property
85 @rtype: dictionary
86 '''
87 return {'por':self.getPOR(), 'name':self.name, 'value':self.value}
88