1 '''
2 Defines a L{Task} to execute when a child has been added/removed to an
3 accessible.
4
5 @author: Brett Clippingdale
6 @author: Peter Parente
7 @organization: IBM Corporation
8 @copyright: Copyright (c) 2005, 2007 IBM Corporation
9 @license: The BSD License
10
11 All rights reserved. This program and the accompanying materials are made
12 available under the terms of the BSD license which accompanies
13 this distribution, and is available at
14 U{http://www.opensource.org/licenses/bsd-license.php}
15 '''
16
17 import Base, EventTask
18 import AEEvent
19
21 '''
22 Executed on add/remove of an accessible's children.
23
24 This class registers its name and whether it should be monitored by default
25 in an L{AEMonitor} using the L{Base.registerTaskType} function when this
26 module is first imported. The L{AEMonitor} can use this information to build
27 its menus.
28 '''
29 Base.registerTaskType('ChildrenTask', True)
30
32 '''
33 @return: Type of L{AEEvent} this L{Task} wants to handle
34 @rtype: class
35 '''
36 return AEEvent.ChildrenChange
37
38 - def update(self, por, added, child_por, layer, **kwargs):
39 '''
40 Updates this L{Task} in response to a consumed children change event.
41 Called by L{Tier.Tier._executeTask}.
42
43 @param por: The L{POR} for the related accessible
44 @type por: L{POR}
45 @param added: True when a child is added, False when removed
46 @type added: boolean
47 @param child_por: The L{POR} of added/removed child
48 @type child_por: L{POR}
49 @param layer: Layer on which the event occurred
50 @type layer: integer
51 '''
52 pass
53
54 - def execute(self, por, added, child_por, layer,**kwargs):
55 '''
56 Executes this L{Task} in response to a children change event. Called by
57 L{Tier.Tier._executeTask}.
58
59 @param por: The L{POR} for the related accessible
60 @type por: L{POR}
61 @param added: True when a child is added, False when removed
62 @type added: boolean
63 @param child_por: The L{POR} of added/removed child
64 @type child_por: L{POR}
65 @param layer: Layer on which the event occurred
66 @type layer: integer
67 @return: True to allow other L{Task}s to process this event
68 @rtype: boolean
69 '''
70
71 if added == True:
72 return self.executeChildAdded(por=por, child_por=child_por, layer=layer)
73 else:
74 return self.executeChildRemoved(por=por, child_por=child_por, layer=layer)
75
77 '''
78 Executes this L{Task} in response to a ChildrenChange-added event. Called by
79 L{execute}.
80
81 @param por: The L{POR} for the related accessible
82 @type por: L{POR}
83 @param child_por: The L{POR} of added/removed child
84 @type child_por: L{POR}
85 @param layer: Layer on which the event occurred
86 @type layer: integer
87 '''
88 return True
89
91 '''
92 Executes this L{Task} in response to a ChildrenChange-removed event. Called
93 by L{execute}.
94
95 @param por: The L{POR} for the related accessible
96 @type por: L{POR}
97 @param child_por: The L{POR} of added/removed child
98 @type child_por: L{POR}
99 @param layer: Layer on which the event occurred
100 @type layer: integer
101 '''
102 return True
103