[KSS-checkins] r50324 - in kukit/kukit.js/branch/ree-1.4-markup-and-syntax-changes: . kukit

reebalazs at codespeak.net reebalazs at codespeak.net
Fri Jan 4 17:57:42 CET 2008


Author: reebalazs
Date: Fri Jan  4 17:57:41 2008
New Revision: 50324

Modified:
   kukit/kukit.js/branch/ree-1.4-markup-and-syntax-changes/   (props changed)
   kukit/kukit.js/branch/ree-1.4-markup-and-syntax-changes/kukit/commandreg.js
Log:
Change the lookup of selectors when executing for commands
We now look up the selector from the provider, not the other
way around. This will make it possible for commands to
use selectors with more parameters. (todo later)

Modified: kukit/kukit.js/branch/ree-1.4-markup-and-syntax-changes/kukit/commandreg.js
==============================================================================
--- kukit/kukit.js/branch/ree-1.4-markup-and-syntax-changes/kukit/commandreg.js	(original)
+++ kukit/kukit.js/branch/ree-1.4-markup-and-syntax-changes/kukit/commandreg.js	Fri Jan  4 17:57:41 2008
@@ -114,10 +114,30 @@
 };
 
 var _executeCommandOnSelector = function(oper) {
-    var selfunc = kukit.selectorTypesGlobalRegistry.get(this.selectorType);
-    // When applying the selection, the original event target will be used
+    // if the selector type is null or undefined or '',
+    // we use the default type.
+    var selectorType = this.selectorType || 
+                       kukit.selectorTypesGlobalRegistry.defaultSelectorType;
+    // Use the provider registry to look up the selection provider.
+    var providerClass = kukit.pprovidersGlobalRegistry.get(selectorType);
+    // See if if is really a selection provider.
+    if (providerClass.prototype.returnType != 'selection') {
+        kukit.E = 'Undefined selector type [' + selectorType + '], ';
+        kukit.E = 'it exists as provider but it does not return a selection.';
+        throw new Error(kukit.E);
+    }
+    // Instantiate it
+    var provider = new providerClass();
+    var args = [this.selector];
+;;; // Check the provider first.
+;;; provider.check(args);
+    // When evaluating the provider, the original event target will be used
     // as a starting point for the selection.
-    var nodes = selfunc(this.selector, oper.orignode, {});
+    // args will contain a single item, since the server side currently
+    // cannot marshall selectors with more parameters
+    // defaultParameters will be empty when using from commands.
+    var nodes = provider.eval(args, oper.orignode, {});
+    //
 ;;;var printType;
 ;;;if (this.selectorType) {
 ;;;    printType = this.selectorType;


More information about the Kukit-checkins mailing list