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

Source Code for Module AccessEngine.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  @author: Frank Zenker 
 12  @author: Ramona Bunk 
 13  @organization: IT Science Center Ruegen gGmbH, Germany 
 14  @copyright: Copyright (c) 2007, 2008 ITSC Ruegen 
 15  @license: The BSD License 
 16   
 17  All rights reserved. This program and the accompanying materials are made  
 18  available under the terms of the BSD license which accompanies 
 19  this distribution, and is available at 
 20  U{http://www.opensource.org/licenses/bsd-license.php} 
 21  ''' 
 22   
 23  import AccessEngine 
 24  import Base 
 25   
26 -class TableChange(Base.AEEvent):
27 ''' 28 Event that fires when the rows and columns in a table change. 29 30 This class registers its name and whether it should be monitored by default in 31 an L{AEMonitor} using the L{Base.registerEventType} function 32 when this module is first imported. The L{AEMonitor} can use this 33 information to build its menus. 34 35 @ivar por: Point of regard for the table 36 @type por: L{AEPor <AEPor.AEPor>} 37 @ivar is_row: Is it a row (C{True}) or column (C{False}) that changed? 38 @type is_row: boolean 39 @ivar added: Was the row/col added (C{True}), deleted (C{False}), or moved 40 (C{None})? 41 @type added: boolean 42 @ivar first_child_por: Point of regard of first added/removed/moved child 43 @type first_child_por: L{AEPor <AEPor.AEPor>} 44 @ivar last_child_por: Point of regard of last added/removed/moved child 45 @type last_child_por: L{AEPor <AEPor.AEPor>} 46 ''' 47 Base.registerEventType('TableChange', False)
48 - def __init__(self, por, is_row, added, first_child_por, last_child_por, 49 **kwargs):
50 ''' 51 Stores the L{AEPor <AEPor.AEPor>}, information about the change, and first 52 and last children associated with the event. 53 54 @param por: Point of regard for the table 55 @type por: L{AEPor <AEPor.AEPor>} 56 @param is_row: Is it a row (C{True}) or column (C{False}) that changed? 57 @type is_row: boolean 58 @param added: Was the row/col added (C{True}), deleted (C{False}), or moved 59 (C{None})? 60 @type added: boolean 61 @param first_child_por: Point of regard of first added/removed/moved child 62 @type first_child_por: L{AEPor <AEPor.AEPor>} 63 @param last_child_por: Point of regard of last added/removed/moved child 64 @type last_child_por: L{AEPor <AEPor.AEPor>} 65 ''' 66 Base.AEEvent.__init__(self, **kwargs) 67 self.por = por 68 self.is_row = is_row 69 self.added = added 70 self.first_child_por = first_child_por 71 self.last_child_por = last_child_por
72
73 - def __str__(self):
74 ''' 75 Returns a human readable representation of this event including its name, 76 its L{AEPor <AEPor.AEPor>}, whether it concerns a row or col, whether it 77 describes an add, remove, or move; the first affected child 78 L{AEPor <AEPor.AEPor>} and the last affected child L{AEPor <AEPor.AEPor>}. 79 80 @return: Information about this event 81 @rtype: string 82 ''' 83 name = Base.AEEvent.__str__(self) 84 return '%s:\n\tPOR: %s\n\tis_row: %s\n\tadded: %s \ 85 \n\tfirst_child_por: %s\n\t\last_child_por: %s\n\t\layer: %s' \ 86 % (name, self.por, self.is_row, self.added, self.first_child_por, 87 self.last_child_por, self.layer)
88
89 - def execute(self):
90 ''' 91 Contacts the L{AETierManager} so it can manage the table change event. 92 93 @return: Always C{True} to indicate the event executed properly 94 @rtype: boolean 95 ''' 96 AccessEngine.AETierManager.manageEvent(self) 97 return True
98
99 - def getDataForTask(self):
100 ''' 101 Fetches data out of this L{TableChange} for use by a 102 L{AEScript.EventScript.onTableChange}-Task. 103 104 @return: Dictionary of parameters to be passed to a 105 L{AEScript.EventScript.onTableChange}-Task as follows: 106 - por: The L{AEPor <AEPor.AEPor>} of the accessible whose property changed 107 - is_row: Row (C{True}) or column (C{False}) changes 108 - added: Added (C{True}), removed (C{False}), or moved (C{None}) 109 - first_child_por: The L{AEPor <AREPor.AEPor>} of first 110 added/removed/moved child 111 - last_child_por: The L{AEPor <AEPor.AEPor>} of last 112 added/removed/moved child 113 ''' 114 return {'por':self.getPOR(), 'is_row':self.is_row, 'added':self.added, 115 'first_child_por':self.first_child_por, 116 'last_child_por':self.last_child_por}
117