Author: reebalazs
Date: Thu May 17 10:21:08 2007
New Revision: 43447

Modified:
   kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js
Log:
Fix the defaultparms passing in __continue__event__, and introduce a new bind 
iterator 'allnodes' that gives all binding data at once, mapped in two levels 
by node and then by eventname.

Modified: kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js
==============================================================================
--- kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js       
(original)
+++ kukit/kukit.js/branch/ree-stripout-comments/kukit/eventreg.js       Thu May 
17 10:21:08 2007
@@ -276,7 +276,7 @@
 * so we create a new oper below
 */
 
-kukit.er.EventBinder__continue_event__ = function(name, node, parms) {
+kukit.er.EventBinder__continue_event__ = function(name, node, defaultparms) {
     // Trigger a continuation event bound to a given state instance, given node
     // (or on document, if node = null)
     //
@@ -307,10 +307,10 @@
         }
     }
     // If parameters are specified in the call, use them.
-    if (typeof(parms) != 'undefined') {
-        oper.parms = parms;
+    if (typeof(defaultparms) != 'undefined') {
+        oper.defaultparms = defaultparms;
     } else {
-        oper.parms = {};
+        oper.defaultparms = {};
     }
     // (if eventrule is null here, we can yet have the default method, so go 
on.)
     this._EventBinder_triggerevent(name, oper);
@@ -755,3 +755,33 @@
     }
 };
 
+// This calls the bind method once per instance, by a list of
+// items, where item.node is the node and item.opers_by_eventname nodehash:item
+// in item there is item.node and item.opers_by_eventname
+kukit.er.OperRegistry.prototype.iter_allnodes = function (eventset, 
binderinstance) {
+    var items = [];
+    var has_result = false;
+    for (var nodehash in this.infopernode) {
+        var rules_per_node = this.infopernode[nodehash];
+        // filter only the events we are interested in
+        var filtered_rules = {};
+        var foundoper = false;
+        for (var i=0; i<eventset.names.length; i++) {
+            var name = eventset.names[i];
+            var oper = rules_per_node[name];
+            if (typeof(oper) != 'undefined') {
+                filtered_rules[name] = oper;
+                foundoper = oper;
+            }
+        }
+        if (foundoper) {
+            items.push({node: foundoper.node, opers_by_eventname: 
filtered_rules});
+            has_result = true;
+        }
+    }
+    // call the binder method
+    if (has_result) {
+        this.call_bind_method(eventset, binderinstance, items);
+    }
+};
+
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to