Package AEEvent :: Module TableChange
[hide private]
[frames] | no frames]

Source Code for Module AEEvent.TableChange

  1  ''' 
  2  Defines an L{AEEvent} indicating that a table has had a row or column added or 
  3  deleted, or has been reordered. 
  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 
 18   
19 -class TableChange(Base.AccessEngineEvent):
20 ''' 21 Event that fires when the rows and columns in a table change. 22 23 This class registers its name and whether it should be monitored by default in 24 an L{AEMonitor} using the L{Base.registerEventType} function 25 when this module is first imported. The L{AEMonitor} can use this 26 information to build its menus. 27 28 @ivar por: Point of regard for the table 29 @type por: L{POR} 30 @ivar is_row: Is it a row (True) or column (False) that changed? 31 @type is_row: boolean 32 @ivar added: Was the row/col added (True), deleted (False), or moved (None)? 33 @type added: boolean 34 @ivar first_child_por: Point of regard of first added/removed/moved child 35 @type first_child_por: L{POR} 36 @ivar last_child_por: Point of regard of last added/removed/moved child 37 @type last_child_por: L{POR} 38 ''' 39 Base.registerEventType('TableChange', False)
40 - def __init__(self, por, is_row, added, first_child_por, last_child_por, 41 **kwargs):
42 ''' 43 Stores the L{POR}, information about the change, and first and last children 44 associated with the event. 45 46 @param por: Point of regard for the table 47 @type por: L{POR} 48 @param is_row: Is it a row (True) or column (False) that changed? 49 @type is_row: boolean 50 @param added: Was the row/col added (True), deleted (False), or moved (None)? 51 @type added: boolean 52 @param first_child_por: Point of regard of first added/removed/moved child 53 @type first_child_por: L{POR} 54 @param last_child_por: Point of regard of last added/removed/moved child 55 @type last_child_por: L{POR} 56 ''' 57 Base.AccessEngineEvent.__init__(self, **kwargs) 58 self.por = por 59 self.is_row = is_row 60 self.added = added 61 self.first_child_por = first_child_por 62 self.last_child_por = last_child_por
63
64 - def __str__(self):
65 ''' 66 Returns a human readable representation of this event including its name, 67 its L{POR}, whether it concerns a row or col, whether it describes an 68 add, remove, or move; the first affected child L{POR} and the last affected 69 child L{POR}. 70 71 @return: Information about this event 72 @rtype: string 73 ''' 74 name = Base.AccessEngineEvent.__str__(self) 75 return '%s:\n\tPOR: %s\n\tis_row: %s\n\tadded: %s \ 76 \n\tfirst_child_por: %s\n\t\last_child_por: %s\n\t\layer: %s' \ 77 % (name, self.por, self.is_row, self.added, self.first_child_por, 78 self.last_child_por, self.layer)
79
80 - def execute(self, tier_manager, **kwargs):
81 ''' 82 Contacts the L{TierManager} so it can manage the table change event. 83 84 @param tier_manager: TierManager that will handle the event 85 @type tier_manager: L{TierManager} 86 @param kwargs: Packed references to other managers not of interest here 87 @type kwargs: dictionary 88 @return: Always True to indicate the event executed properly 89 @rtype: boolean 90 ''' 91 tier_manager.manageEvent(self) 92 return True
93
94 - def getDataForTask(self):
95 ''' 96 Fetches data out of this L{TableChange} for use by a L{Task.TableTask}. 97 98 @return: Dictionary of parameters to be passed to a L{Task.TableTask} as 99 follows: 100 - por: The L{POR} of the accessible whose property changed 101 - is_row: Row (True) or column (False) changes 102 - added: Added (True), removed (False), or moved (None) 103 - first_child_por: The L{POR}of first added/removed/moved child 104 - last_child_por: The L{POR} of last added/removed/moved child 105 ''' 106 return {'por':self.getPOR(), 'is_row':self.is_row, 'added':self.added, 107 'first_child_por':self.first_child_por, 108 'last_child_por':self.last_child_por}
109