[KSS-checkins] r51934 - kukit/kukit.js/branch/separate-opers/kukit
gotcha at codespeak.net
gotcha at codespeak.net
Fri Feb 29 10:31:32 CET 2008
Author: gotcha
Date: Fri Feb 29 10:31:31 2008
New Revision: 51934
Modified:
kukit/kukit.js/branch/separate-opers/kukit/commandprocessor.js
kukit/kukit.js/branch/separate-opers/kukit/commandreg.js
kukit/kukit.js/branch/separate-opers/kukit/oper.js
kukit/kukit.js/branch/separate-opers/kukit/resourcedata.js
Log:
* BindOper class
* work in progress
Modified: kukit/kukit.js/branch/separate-opers/kukit/commandprocessor.js
==============================================================================
--- kukit/kukit.js/branch/separate-opers/kukit/commandprocessor.js (original)
+++ kukit/kukit.js/branch/separate-opers/kukit/commandprocessor.js Fri Feb 29 10:31:31 2008
@@ -111,11 +111,6 @@
};
this.executeCommands = function(oper) {
- // node, eventRule, binder are given on oper, in case
- // the command was called up from an event
- if (typeof(oper) == 'undefined' || oper == null) {
- oper = new kukit.op.Oper();
- }
var commands = this.commands;
for (var y=0;y < commands.length;y++) {
var command = commands[y];
Modified: kukit/kukit.js/branch/separate-opers/kukit/commandreg.js
==============================================================================
--- kukit/kukit.js/branch/separate-opers/kukit/commandreg.js (original)
+++ kukit/kukit.js/branch/separate-opers/kukit/commandreg.js Fri Feb 29 10:31:31 2008
@@ -1,4 +1,4 @@
-/*
+*
* Copyright (c) 2005-2007
* Authors: KSS Project Contributors (see doc/CREDITS.txt)
*
@@ -109,11 +109,10 @@
};
var _executeCommand = function(oper) {
- var newoper = oper.clone({
- 'parms': this.parms,
- 'orignode': oper.node,
- 'node': null
- });
+ var newoper = oper.clone();
+ newoper.setParms(this.parms);
+ newoper.setOrigNode(oper.node);
+ newoper.setNode(null);
this.executeOnScope(newoper);
};
Modified: kukit/kukit.js/branch/separate-opers/kukit/oper.js
==============================================================================
--- kukit/kukit.js/branch/separate-opers/kukit/oper.js (original)
+++ kukit/kukit.js/branch/separate-opers/kukit/oper.js Fri Feb 29 10:31:31 2008
@@ -62,16 +62,48 @@
this.clone = function(dict, restricted) {
var newoper = new kukit.op.Oper(this);
- newoper.unrestrictedUpdate(dict, restricted);
+ newoper._unrestrictedUpdate(dict, restricted);
return newoper;
};
this.update = function(dict) {
// restricted attrs must not be changed on existing oper.
- this.unrestrictedUpdate(dict, true);
+ this._unrestrictedUpdate(dict, true);
};
- this.unrestrictedUpdate = function(dict, restricted) {
+ this.setNode = function(node) {
+ this.node = node;
+ };
+
+ this.setParms = function(parms) {
+ this.parms = parms;
+ };
+
+ this.setKssParms = function(kssParms) {
+ this.kssParms = kssParms;
+ };
+
+ this.setEventRule = function(eventRule) {
+ this.eventRule = eventRule;
+ };
+
+ this.setBinder = function(binder) {
+ this.binder = binder;
+ };
+
+ this.setOrigNode = function(orignode) {
+ this.orignode = orignode;
+ };
+
+ this.setAction = function(action) {
+ this.action = action;
+ };
+
+ this.setBrowserEvent = function(browserevent) {
+ this.browserevent = browserevent;
+ };
+
+ this._unrestrictedUpdate = function(dict, restricted) {
if (typeof(dict) == 'undefined') {
return;
}
@@ -98,45 +130,7 @@
}
};
// update from the dict
- this.unrestrictedUpdate(dict);
-};
-
-this.clone = function(dict, restricted) {
- var newoper = new kukit.op.Oper(this);
- newoper.unrestrictedUpdate(dict, restricted);
- return newoper;
-};
-
-this.update = function(dict) {
- // restricted attrs must not be changed on existing oper.
- this.unrestrictedUpdate(dict, true);
-};
-
-this.unrestrictedUpdate = function(dict, restricted) {
- if (typeof(dict) == 'undefined') {
- return;
- }
- for (var key in dict) {
-;;; if (typeof(checkKey) == 'undefined') {
-;;; var checkKey = function(key) {
-;;; var isNode = key == 'node';
-;;; var isParameters = key == 'parms';
-;;; var isEventRule = key == 'eventRule';
-;;; var isBinder = key == 'binder';
-;;; var isOrig = key == 'orignode';
-;;; return isNode || isParameters || isEventRule || isBinder || isOrig;
-;;; };
-;;; }
-;;; if (restricted && checkKey(key)) {
-;;; kukit.E = 'Illegal update on oper object, protected attribute [';
-;;; kukit.E += key + '].';
-;;; throw new Error(kukit.E);
-;;; }
- var value = dict[key];
- if (typeof(value) != 'function') {
- this[key] = value;
- }
- }
+ this._unrestrictedUpdate(dict);
};
this.logDebug = function() {
@@ -422,4 +416,12 @@
this.initialize.apply(this, arguments);
};
+/*
+* class BindOper
+*
+*/
+op.BindOper = function(){
+};
+op.BindOper.prototype = new op.Oper();
+
}(); /// MODULE END
Modified: kukit/kukit.js/branch/separate-opers/kukit/resourcedata.js
==============================================================================
--- kukit/kukit.js/branch/separate-opers/kukit/resourcedata.js (original)
+++ kukit/kukit.js/branch/separate-opers/kukit/resourcedata.js Fri Feb 29 10:31:31 2008
@@ -362,7 +362,7 @@
this.bind = function(node) {
this.store(node);
// Creation of the binding oper
- var oper = new kukit.op.Oper();
+ var oper = new kukit.op.BindOper();
var binderInfo = this.getBinderInfo(node);
oper.node = node;
oper.eventRule = this;
@@ -512,13 +512,14 @@
// this is conditional: if there is no default method, it's skipped.
var name = oper.eventRule.kssSelector.name;
// Execution with no parms. (XXX ?)
- oper = oper.clone({'parms': {}});
+ oper = oper.clone();
+ oper.setParms({});
oper.executeDefaultAction(name, true);
}
};
this.getOrCreateAction = function(name, valuesByReturnType) {
- // kss parameters will ve set from valuesByReturnType
+ // kss parameters will be set from valuesByReturnType
//
// In case we alias, use the alias for name, this will become
// the action name used for execution. The alias name will
@@ -755,11 +756,10 @@
parms[key] = value;
}
}
- var anOper = oper.clone({
- 'parms': parms,
- 'kssParms': kssParms,
- 'action': this
- });
+ var anOper = oper.clone();
+ oper.setParms(parms);
+ oper.setKssParms(kssParms);
+ oper.setAction(this);
return anOper;
};
More information about the Kukit-checkins
mailing list