Package Task :: Module TableTask
[hide private]
[frames] | no frames]

Source Code for Module Task.TableTask

  1  ''' 
  2  Defines a L{Task} to execute when the accessible hierarchy changes. 
  3   
  4  @author: Brett Clippingdale 
  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, EventTask 
 17  import AEEvent 
 18   
19 -class TableTask(EventTask.EventTask):
20 ''' 21 Executed when a table change occurs (insert/delete/reorder of a row/column). 22 23 This class registers its name and whether it should be monitored by default 24 in an L{AEMonitor} using the L{Base.registerTaskType} function when this 25 module is first imported. The L{AEMonitor} can use this information to build 26 its menus. 27 ''' 28 Base.registerTaskType('TableTask', False) 29
30 - def getEventType(self):
31 ''' 32 @return: Type of L{AEEvent} this L{Task} wants to handle 33 @rtype: class 34 ''' 35 return AEEvent.TableChange
36
37 - def update(self, por, is_row, added, first_child_por, last_child_por, layer, 38 **kwargs):
39 ''' 40 Updates this L{Task} in response to a consumed table 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 is_row: True if a table row, False if a table column 46 @type is_row: boolean 47 @param added: True when a row/column is added, False when removed, None when 48 reordered 49 @type added: boolean 50 @param first_child_por: The L{POR} of first inserted/deleted row/column 51 @type first_child_por: L{POR} 52 @param last_child_por: The L{POR} of last inserted/deleted row/column 53 @type last_child_por: L{POR} 54 @param layer: Layer on which the event occurred 55 @type layer: integer 56 ''' 57 pass
58
59 - def execute(self, por, is_row, added, first_child_por, last_child_por, layer, 60 **kwargs):
61 ''' 62 Executes this L{Task} in response to a hierarchy change event. Called by 63 L{Tier.Tier._executeTask}. 64 65 @param por: The L{POR} for the related accessible 66 @type por: L{POR} 67 @param is_row: True if a table row, False if a table column 68 @type is_row: boolean 69 @param added: True when a row/column is added, False when removed, None when 70 reordered 71 @type added: boolean 72 @param first_child_por: The L{POR} of first inserted/deleted row/column 73 @type first_child_por: L{POR} 74 @param last_child_por: The L{POR} of last inserted/deleted row/column 75 @type last_child_por: L{POR} 76 @param layer: Layer on which the event occurred 77 @type layer: integer 78 @return: True to allow other L{Task}s to process this event 79 @rtype: boolean 80 ''' 81 82 if is_row == True: #row 83 if added == True: #row-inserted 84 return self.executeTableRowInserted(por=por, 85 first_child_por=first_child_por, 86 last_child_por=last_child_por, 87 layer=layer) 88 elif added == False: #row-deleted 89 return self.executeTableRowDeleted(por=por, 90 first_child_por=first_child_por, 91 last_child_por=last_child_por, 92 layer=layer) 93 else: #row-reordered 94 return self.executeTableRowReordered(por=por, layer=layer) 95 96 else: # column 97 if added == True: #column-inserted 98 return self.executeTableColumnInserted(por=por, 99 first_child_por=first_child_por, 100 last_child_por=last_child_por, 101 layer=layer) 102 elif added == False: #column-deleted 103 return self.executeTableColumnDeleted(por=por, 104 first_child_por=first_child_por, 105 last_child_por=last_child_por, 106 layer=layer) 107 else: #column-reordered 108 return self.executeTableColumnReordered(por=por, layer=layer)
109 110
111 - def executeTableRowInserted(self, por, first_child_por, last_child_por, \ 112 layer, **kwargs):
113 ''' 114 Executes this L{Task} in response to a row-inserted table change event. 115 Called by L{execute}. 116 117 @param por: The L{POR} for the related accessible 118 @type por: L{POR} 119 @param first_child_por: The L{POR} of first inserted row 120 @type first_child_por: L{POR} 121 @param last_child_por: The L{POR} of last inserted row 122 @type last_child_por: L{POR} 123 @param layer: Layer on which the event occurred 124 @type layer: integer 125 ''' 126 return True
127
128 - def executeTableRowDeleted(self, por, first_child_por, last_child_por, \ 129 layer, **kwargs):
130 ''' 131 Executes this L{Task} in response to a row-deleted table change event. 132 Called by L{execute}. 133 134 @param por: The L{POR} for the related accessible 135 @type por: L{POR} 136 @param first_child_por: The L{POR} of first deleted row 137 @type first_child_por: L{POR} 138 @param last_child_por: The L{POR} of last deleted row 139 @type last_child_por: L{POR} 140 @param layer: Layer on which the event occurred 141 @type layer: integer 142 ''' 143 return True
144
145 - def executeTableRowReordered(self, por, layer, **kwargs):
146 ''' 147 Executes this L{Task} in response to a row-reordered table change event. 148 Called by L{execute}. 149 150 @param por: The L{POR} for the related accessible 151 @type por: L{POR} 152 @param layer: Layer on which the event occurred 153 @type layer: integer 154 ''' 155 return True
156
157 - def executeTableColumnInserted(self, por, first_child_por, last_child_por, \ 158 layer, **kwargs):
159 ''' 160 Executes this L{Task} in response to a column-inserted table change event. 161 Called by L{execute}. 162 163 @param por: The L{POR} for the related accessible 164 @type por: L{POR} 165 @param first_child_por: The L{POR} of first inserted column 166 @type first_child_por: L{POR} 167 @param last_child_por: The L{POR} of last inserted column 168 @type last_child_por: L{POR} 169 @param layer: Layer on which the event occurred 170 @type layer: integer 171 ''' 172 return True
173
174 - def executeTableColumnDeleted(self, por, first_child_por, last_child_por, \ 175 layer, **kwargs):
176 ''' 177 Executes this L{Task} in response to a column-deleted table change event. 178 Called by L{execute}. 179 180 @param por: The L{POR} for the related accessible 181 @type por: L{POR} 182 @param first_child_por: The L{POR} of first deleted column 183 @type first_child_por: L{POR} 184 @param last_child_por: The L{POR} of last deleted column 185 @type last_child_por: L{POR} 186 @param layer: Layer on which the event occurred 187 @type layer: integer 188 ''' 189 return True
190
191 - def executeTableColumnReordered(self, por, layer, **kwargs):
192 ''' 193 Executes this L{Task} in response to a column-reordered table change event. 194 Called by L{execute}. 195 196 @param por: The L{POR} for the related accessible 197 @type por: L{POR} 198 @param layer: Layer on which the event occurred 199 @type layer: integer 200 ''' 201 return True
202