[Commits] (john) - Refactored Broadcast to BroadcastEverywhere and BroadcastInsideMyEventBoundary

commits at osafoundation.org commits at osafoundation.org
Thu Jul 1 16:42:02 PDT 2004


Commit by: john
Modified files:
chandler/parcels/osaf/framework/blocks/parcel.xml 1.83 1.84
chandler/parcels/osaf/framework/blocks/Views.py 1.28 1.29
chandler/parcels/osaf/framework/blocks/Events/parcel.xml 1.31 1.32

Log message:
- Refactored Broadcast to BroadcastEverywhere and BroadcastInsideMyEventBoundary

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/parcel.xml.diff?r1=text&tr1=1.83&r2=text&tr2=1.84
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/Views.py.diff?r1=text&tr1=1.28&r2=text&tr2=1.29
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/Events/parcel.xml.diff?r1=text&tr1=1.31&r2=text&tr2=1.32

Index: chandler/parcels/osaf/framework/blocks/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/parcel.xml:1.83 chandler/parcels/osaf/framework/blocks/parcel.xml:1.84
--- chandler/parcels/osaf/framework/blocks/parcel.xml:1.83	Wed Jun 30 19:32:22 2004
+++ chandler/parcels/osaf/framework/blocks/parcel.xml	Thu Jul  1 16:42:00 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.83 $ -->
-<!-- $Date: 2004/07/01 02:32:22 $ -->
+<!-- $Revision: 1.84 $ -->
+<!-- $Date: 2004/07/01 23:42:00 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -180,7 +180,8 @@
     <superKinds itemref="events:Event"/>
 
     <Enumeration itsName="dispatchEnumType">
-      <values>Broadcast</values>
+      <values>BroadcastInsideMyEventBoundary</values>
+      <values>BroadcastEverywhere</values>
       <values>FocusBubbleUp</values>
       <values>ActiveViewBubbleUp</values>
       <values>SendToBlock</values>

Index: chandler/parcels/osaf/framework/blocks/Views.py
diff -u chandler/parcels/osaf/framework/blocks/Views.py:1.28 chandler/parcels/osaf/framework/blocks/Views.py:1.29
--- chandler/parcels/osaf/framework/blocks/Views.py:1.28	Thu Jun 17 17:12:22 2004
+++ chandler/parcels/osaf/framework/blocks/Views.py	Thu Jul  1 16:42:00 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.28 $"
-__date__ = "$Date: 2004/06/18 00:12:22 $"
+__version__ = "$Revision: 1.29 $"
+__date__ = "$Date: 2004/07/01 23:42:00 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -39,16 +39,16 @@
                     break
                 block = block.parentBlock
         
-        def broadcast (block, methodName, notification):
+        def broadcast (block, methodName, notification, stopAtEventBounary = True):
             """
               Call method named methodName on every block and it's children
             who implements it, except for the block that posted the event,
             to avoid recursive calls.
             """
-            sender = notification.data['sender']
-            callMethod (block, methodName, notification)
+            if block != notification.data['sender']:
+                callMethod (block, methodName, notification)
             for child in block.childrenBlocks:
-                if child and not child.eventBoundary and child != sender:
+                if child and not (stopAtEventBounary and child.eventBoundary):
                     broadcast (child, methodName, notification)
 
         event = notification.event
@@ -70,20 +70,16 @@
         if event.dispatchEnum == 'SendToBlock':
             callMethod (event.dispatchToBlock, methodName, notification)
 
-        elif event.dispatchEnum == 'Broadcast':
-            """
-              Find the block to dispatch to. If the sender is a menu
-            we'll dispatch to the block with the focus, otherwise we'll
-            dispatch to whoever 
-            """
+        elif event.dispatchEnum == 'BroadcastInsideMyEventBoundary':
             block = notification.data['sender']
-            if isinstance (block, MenuEntry):
-                block = self.getFocusBlock()
-
             while (not block.eventBoundary and block.parentBlock):
                 block = block.parentBlock
                 
             broadcast (block, methodName, notification)
+
+        elif event.dispatchEnum == 'BroadcastEverywhere':
+            broadcast (Globals.mainView, methodName, notification, stopAtEventBounary = False)
+
         elif event.dispatchEnum == 'FocusBubbleUp':
             block = self.getFocusBlock()
             bubleUpCallMethod (block, methodName, notification)

Index: chandler/parcels/osaf/framework/blocks/Events/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/Events/parcel.xml:1.31 chandler/parcels/osaf/framework/blocks/Events/parcel.xml:1.32
--- chandler/parcels/osaf/framework/blocks/Events/parcel.xml:1.31	Thu Jul  1 00:02:04 2004
+++ chandler/parcels/osaf/framework/blocks/Events/parcel.xml	Thu Jul  1 16:42:00 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.31 $ -->
-<!-- $Date: 2004/07/01 07:02:04 $ -->
+<!-- $Revision: 1.32 $ -->
+<!-- $Date: 2004/07/01 23:42:00 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -75,19 +75,19 @@
   </BlockEvent>
 
   <BlockEvent itsName="ViewNavigationBar">
-    <dispatchEnum>Broadcast</dispatchEnum>
+    <dispatchEnum>BroadcastInsideMyEventBoundary</dispatchEnum>
   </BlockEvent>
 
   <BlockEvent itsName="SelectionChanged">
-    <dispatchEnum>Broadcast</dispatchEnum>
+    <dispatchEnum>BroadcastInsideMyEventBoundary</dispatchEnum>
   </BlockEvent>
 
   <BlockEvent itsName="EnterPressed">
-    <dispatchEnum>Broadcast</dispatchEnum>
+    <dispatchEnum>BroadcastInsideMyEventBoundary</dispatchEnum>
   </BlockEvent>
 
   <BlockEvent itsName="SelectedDateChanged">
-    <dispatchEnum>Broadcast</dispatchEnum>
+    <dispatchEnum>BroadcastEverywhere</dispatchEnum>
   </BlockEvent>
 
   <!-- Test Events -->



More information about the Commits mailing list