diff options
Diffstat (limited to 'js/dojo-1.6/dojox/lang/oo')
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/Decorator.js | 47 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/Decorator.xd.js | 51 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/Filter.js | 55 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/Filter.xd.js | 59 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/aop.js | 85 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/aop.xd.js | 91 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/general.js | 71 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/general.xd.js | 76 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/mixin.js | 145 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/mixin.xd.js | 151 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/rearrange.js | 75 | ||||
| -rw-r--r-- | js/dojo-1.6/dojox/lang/oo/rearrange.xd.js | 79 |
12 files changed, 985 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/lang/oo/Decorator.js b/js/dojo-1.6/dojox/lang/oo/Decorator.js new file mode 100644 index 0000000..b67ec70 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/Decorator.js @@ -0,0 +1,47 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.lang.oo.Decorator"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.Decorator"] = true;
+dojo.provide("dojox.lang.oo.Decorator");
+
+(function(){
+ var oo = dojox.lang.oo,
+
+ D = oo.Decorator = function(value, decorator){
+ // summary:
+ // The base class for all decorators.
+ // description:
+ // This object holds an original function or another decorator
+ // object, and implements a special mixin algorithm to be used
+ // by dojox.lang.oo.mixin.
+ // value: Object:
+ // a payload to be processed by the decorator.
+ // decorator: Function|Object:
+ // a function to handle the custom assignment, or an object with exec()
+ // method. The signature is:
+ // decorator(/*String*/ name, /*Function*/ newValue, /*Function*/ oldValue).
+ this.value = value;
+ this.decorator = typeof decorator == "object" ?
+ function(){ return decorator.exec.apply(decorator, arguments); } : decorator;
+ };
+
+ oo.makeDecorator = function(decorator){
+ // summary:
+ // creates new custom decorator creator
+ // decorator: Function|Object:
+ // a function to handle the custom assignment,
+ // or an object with exec() method
+ // returns: Function:
+ // new decorator constructor
+ return function(value){
+ return new D(value, decorator);
+ };
+ };
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/lang/oo/Decorator.xd.js b/js/dojo-1.6/dojox/lang/oo/Decorator.xd.js new file mode 100644 index 0000000..4200198 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/Decorator.xd.js @@ -0,0 +1,51 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.oo.Decorator"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.oo.Decorator"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.Decorator"] = true;
+dojo.provide("dojox.lang.oo.Decorator");
+
+(function(){
+ var oo = dojox.lang.oo,
+
+ D = oo.Decorator = function(value, decorator){
+ // summary:
+ // The base class for all decorators.
+ // description:
+ // This object holds an original function or another decorator
+ // object, and implements a special mixin algorithm to be used
+ // by dojox.lang.oo.mixin.
+ // value: Object:
+ // a payload to be processed by the decorator.
+ // decorator: Function|Object:
+ // a function to handle the custom assignment, or an object with exec()
+ // method. The signature is:
+ // decorator(/*String*/ name, /*Function*/ newValue, /*Function*/ oldValue).
+ this.value = value;
+ this.decorator = typeof decorator == "object" ?
+ function(){ return decorator.exec.apply(decorator, arguments); } : decorator;
+ };
+
+ oo.makeDecorator = function(decorator){
+ // summary:
+ // creates new custom decorator creator
+ // decorator: Function|Object:
+ // a function to handle the custom assignment,
+ // or an object with exec() method
+ // returns: Function:
+ // new decorator constructor
+ return function(value){
+ return new D(value, decorator);
+ };
+ };
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/lang/oo/Filter.js b/js/dojo-1.6/dojox/lang/oo/Filter.js new file mode 100644 index 0000000..a38ff6a --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/Filter.js @@ -0,0 +1,55 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.lang.oo.Filter"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.Filter"] = true;
+dojo.provide("dojox.lang.oo.Filter");
+
+(function(){
+ var oo = dojox.lang.oo,
+
+ F = oo.Filter = function(bag, filter){
+ // summary:
+ // Filter to control mixing in objects by skipping
+ // properties and renaming them.
+ // description:
+ // This object is used as a holder of an original object
+ // (whose properites are to be copied), and a filter
+ // function used while copying by dojox.lang.oo.mixin.
+ // bag: Object:
+ // object to be filtered
+ // filter: Function|Object:
+ // a function to handle the name filtering,
+ // or an object with exec() method
+ this.bag = bag;
+ this.filter = typeof filter == "object" ?
+ function(){ return filter.exec.apply(filter, arguments); } : filter;
+ },
+
+ // the default map-based filter object
+ MapFilter = function(map){
+ this.map = map;
+ };
+
+ MapFilter.prototype.exec = function(name){
+ return this.map.hasOwnProperty(name) ? this.map[name] : name;
+ };
+
+ oo.filter = function(bag, map){
+ // summary:
+ // creates a simple filter object
+ // bag: Object:
+ // object to be filtered
+ // map: Object:
+ // the dictionary for renaming/removing while copying
+ // returns:
+ // new dojox.lang.oo.Filter object
+ return new F(bag, new MapFilter(map));
+ };
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/lang/oo/Filter.xd.js b/js/dojo-1.6/dojox/lang/oo/Filter.xd.js new file mode 100644 index 0000000..5298b6b --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/Filter.xd.js @@ -0,0 +1,59 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.oo.Filter"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.oo.Filter"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.Filter"] = true;
+dojo.provide("dojox.lang.oo.Filter");
+
+(function(){
+ var oo = dojox.lang.oo,
+
+ F = oo.Filter = function(bag, filter){
+ // summary:
+ // Filter to control mixing in objects by skipping
+ // properties and renaming them.
+ // description:
+ // This object is used as a holder of an original object
+ // (whose properites are to be copied), and a filter
+ // function used while copying by dojox.lang.oo.mixin.
+ // bag: Object:
+ // object to be filtered
+ // filter: Function|Object:
+ // a function to handle the name filtering,
+ // or an object with exec() method
+ this.bag = bag;
+ this.filter = typeof filter == "object" ?
+ function(){ return filter.exec.apply(filter, arguments); } : filter;
+ },
+
+ // the default map-based filter object
+ MapFilter = function(map){
+ this.map = map;
+ };
+
+ MapFilter.prototype.exec = function(name){
+ return this.map.hasOwnProperty(name) ? this.map[name] : name;
+ };
+
+ oo.filter = function(bag, map){
+ // summary:
+ // creates a simple filter object
+ // bag: Object:
+ // object to be filtered
+ // map: Object:
+ // the dictionary for renaming/removing while copying
+ // returns:
+ // new dojox.lang.oo.Filter object
+ return new F(bag, new MapFilter(map));
+ };
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/lang/oo/aop.js b/js/dojo-1.6/dojox/lang/oo/aop.js new file mode 100644 index 0000000..f992928 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/aop.js @@ -0,0 +1,85 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.lang.oo.aop"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.aop"] = true;
+dojo.provide("dojox.lang.oo.aop");
+
+dojo.require("dojox.lang.oo.Decorator");
+dojo.require("dojox.lang.oo.general");
+
+(function(){
+ var oo = dojox.lang.oo, md = oo.makeDecorator, oog = oo.general, ooa = oo.aop,
+ isF = dojo.isFunction;
+
+ // five decorators implementing light-weight AOP weaving
+
+ /*=====
+ ooa.before = md(function(name, newValue, oldValue){
+ // summary: creates a "before" advise, by calling new function
+ // before the old one
+
+ // dummy body
+ });
+
+ ooa.around = md(function(name, newValue, oldValue){
+ // summary: creates an "around" advise,
+ // the previous value is passed as a first argument and can be null,
+ // arguments are passed as a second argument
+
+ // dummy body
+ });
+ =====*/
+
+ // reuse existing decorators
+ ooa.before = oog.before;
+ ooa.around = oog.wrap;
+
+ ooa.afterReturning = md(function(name, newValue, oldValue){
+ // summary: creates an "afterReturning" advise,
+ // the returned value is passed as the only argument
+ return isF(oldValue) ?
+ function(){
+ var ret = oldValue.apply(this, arguments);
+ newValue.call(this, ret);
+ return ret;
+ } : function(){ newValue.call(this); };
+ });
+
+ ooa.afterThrowing = md(function(name, newValue, oldValue){
+ // summary: creates an "afterThrowing" advise,
+ // the exception is passed as the only argument
+ return isF(oldValue) ?
+ function(){
+ var ret;
+ try{
+ ret = oldValue.apply(this, arguments);
+ }catch(e){
+ newValue.call(this, e);
+ throw e;
+ }
+ return ret;
+ } : oldValue;
+ });
+
+ ooa.after = md(function(name, newValue, oldValue){
+ // summary: creates an "after" advise,
+ // it takes no arguments
+ return isF(oldValue) ?
+ function(){
+ var ret;
+ try{
+ ret = oldValue.apply(this, arguments);
+ }finally{
+ newValue.call(this);
+ }
+ return ret;
+ } : function(){ newValue.call(this); }
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/lang/oo/aop.xd.js b/js/dojo-1.6/dojox/lang/oo/aop.xd.js new file mode 100644 index 0000000..6558330 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/aop.xd.js @@ -0,0 +1,91 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.oo.aop"],
+["require", "dojox.lang.oo.Decorator"],
+["require", "dojox.lang.oo.general"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.oo.aop"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.aop"] = true;
+dojo.provide("dojox.lang.oo.aop");
+
+dojo.require("dojox.lang.oo.Decorator");
+dojo.require("dojox.lang.oo.general");
+
+(function(){
+ var oo = dojox.lang.oo, md = oo.makeDecorator, oog = oo.general, ooa = oo.aop,
+ isF = dojo.isFunction;
+
+ // five decorators implementing light-weight AOP weaving
+
+ /*=====
+ ooa.before = md(function(name, newValue, oldValue){
+ // summary: creates a "before" advise, by calling new function
+ // before the old one
+
+ // dummy body
+ });
+
+ ooa.around = md(function(name, newValue, oldValue){
+ // summary: creates an "around" advise,
+ // the previous value is passed as a first argument and can be null,
+ // arguments are passed as a second argument
+
+ // dummy body
+ });
+ =====*/
+
+ // reuse existing decorators
+ ooa.before = oog.before;
+ ooa.around = oog.wrap;
+
+ ooa.afterReturning = md(function(name, newValue, oldValue){
+ // summary: creates an "afterReturning" advise,
+ // the returned value is passed as the only argument
+ return isF(oldValue) ?
+ function(){
+ var ret = oldValue.apply(this, arguments);
+ newValue.call(this, ret);
+ return ret;
+ } : function(){ newValue.call(this); };
+ });
+
+ ooa.afterThrowing = md(function(name, newValue, oldValue){
+ // summary: creates an "afterThrowing" advise,
+ // the exception is passed as the only argument
+ return isF(oldValue) ?
+ function(){
+ var ret;
+ try{
+ ret = oldValue.apply(this, arguments);
+ }catch(e){
+ newValue.call(this, e);
+ throw e;
+ }
+ return ret;
+ } : oldValue;
+ });
+
+ ooa.after = md(function(name, newValue, oldValue){
+ // summary: creates an "after" advise,
+ // it takes no arguments
+ return isF(oldValue) ?
+ function(){
+ var ret;
+ try{
+ ret = oldValue.apply(this, arguments);
+ }finally{
+ newValue.call(this);
+ }
+ return ret;
+ } : function(){ newValue.call(this); }
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/lang/oo/general.js b/js/dojo-1.6/dojox/lang/oo/general.js new file mode 100644 index 0000000..1f4f21a --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/general.js @@ -0,0 +1,71 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.lang.oo.general"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.general"] = true;
+dojo.provide("dojox.lang.oo.general");
+
+dojo.require("dojox.lang.oo.Decorator");
+
+(function(){
+ var oo = dojox.lang.oo, md = oo.makeDecorator, oog = oo.general,
+ isF = dojo.isFunction;
+
+ // generally useful decorators
+
+ oog.augment = md(function(name, newValue, oldValue){
+ // summary: add property, if it was not defined before
+ return typeof oldValue == "undefined" ? newValue : oldValue;
+ });
+
+ oog.override = md(function(name, newValue, oldValue){
+ // summary: override property only if it was already present
+ return typeof oldValue != "undefined" ? newValue : oldValue;
+ });
+
+ oog.shuffle = md(function(name, newValue, oldValue){
+ // summary: replaces arguments for an old method
+ return isF(oldValue) ?
+ function(){
+ return oldValue.apply(this, newValue.apply(this, arguments));
+ } : oldValue;
+ });
+
+ oog.wrap = md(function(name, newValue, oldValue){
+ // summary: wraps the old values with a supplied function
+ return function(){ return newValue.call(this, oldValue, arguments); };
+ });
+
+ oog.tap = md(function(name, newValue, oldValue){
+ // summary: always returns "this" ignoring the actual return
+ return function(){ newValue.apply(this, arguments); return this; };
+ });
+
+ oog.before = md(function(name, newValue, oldValue){
+ // summary:
+ // creates a chain of calls where the new method is called
+ // before the old method
+ return isF(oldValue) ?
+ function(){
+ newValue.apply(this, arguments);
+ return oldValue.apply(this, arguments);
+ } : newValue;
+ });
+
+ oog.after = md(function(name, newValue, oldValue){
+ // summary:
+ // creates a chain of calls where the new method is called
+ // after the old method
+ return isF(oldValue) ?
+ function(){
+ oldValue.apply(this, arguments);
+ return newValue.apply(this, arguments);
+ } : newValue;
+ });
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/lang/oo/general.xd.js b/js/dojo-1.6/dojox/lang/oo/general.xd.js new file mode 100644 index 0000000..4648e4f --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/general.xd.js @@ -0,0 +1,76 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.oo.general"],
+["require", "dojox.lang.oo.Decorator"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.oo.general"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.general"] = true;
+dojo.provide("dojox.lang.oo.general");
+
+dojo.require("dojox.lang.oo.Decorator");
+
+(function(){
+ var oo = dojox.lang.oo, md = oo.makeDecorator, oog = oo.general,
+ isF = dojo.isFunction;
+
+ // generally useful decorators
+
+ oog.augment = md(function(name, newValue, oldValue){
+ // summary: add property, if it was not defined before
+ return typeof oldValue == "undefined" ? newValue : oldValue;
+ });
+
+ oog.override = md(function(name, newValue, oldValue){
+ // summary: override property only if it was already present
+ return typeof oldValue != "undefined" ? newValue : oldValue;
+ });
+
+ oog.shuffle = md(function(name, newValue, oldValue){
+ // summary: replaces arguments for an old method
+ return isF(oldValue) ?
+ function(){
+ return oldValue.apply(this, newValue.apply(this, arguments));
+ } : oldValue;
+ });
+
+ oog.wrap = md(function(name, newValue, oldValue){
+ // summary: wraps the old values with a supplied function
+ return function(){ return newValue.call(this, oldValue, arguments); };
+ });
+
+ oog.tap = md(function(name, newValue, oldValue){
+ // summary: always returns "this" ignoring the actual return
+ return function(){ newValue.apply(this, arguments); return this; };
+ });
+
+ oog.before = md(function(name, newValue, oldValue){
+ // summary:
+ // creates a chain of calls where the new method is called
+ // before the old method
+ return isF(oldValue) ?
+ function(){
+ newValue.apply(this, arguments);
+ return oldValue.apply(this, arguments);
+ } : newValue;
+ });
+
+ oog.after = md(function(name, newValue, oldValue){
+ // summary:
+ // creates a chain of calls where the new method is called
+ // after the old method
+ return isF(oldValue) ?
+ function(){
+ oldValue.apply(this, arguments);
+ return newValue.apply(this, arguments);
+ } : newValue;
+ });
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/lang/oo/mixin.js b/js/dojo-1.6/dojox/lang/oo/mixin.js new file mode 100644 index 0000000..43dda72 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/mixin.js @@ -0,0 +1,145 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.lang.oo.mixin"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.mixin"] = true;
+dojo.provide("dojox.lang.oo.mixin");
+
+dojo.experimental("dojox.lang.oo.mixin");
+
+dojo.require("dojox.lang.oo.Filter");
+dojo.require("dojox.lang.oo.Decorator");
+
+(function(){
+ var oo = dojox.lang.oo, Filter = oo.Filter, Decorator = oo.Decorator, empty = {},
+ defaultFilter = function(name){ return name; },
+ defaultDecorator = function(name, newValue, oldValue){ return newValue; },
+ defaultMixer = function(target, name, newValue, oldValue){ target[name] = newValue; },
+ defaults = {}, // for the internal use in the mixin()
+ extraNames = dojo._extraNames, extraLen = extraNames.length,
+
+ applyDecorator = oo.applyDecorator = function(decorator, name, newValue, oldValue){
+ // summary:
+ // applies a decorator unraveling all embedded decorators
+ // decorator: Function:
+ // top-level decorator to apply
+ // name: String:
+ // name of the property
+ // newValue: Object:
+ // new value of the property
+ // oldValue: Object:
+ // old value of the property
+ // returns: Object:
+ // returns the final value of the property
+ if(newValue instanceof Decorator){
+ var d = newValue.decorator;
+ newValue = applyDecorator(decorator, name, newValue.value, oldValue);
+ return d(name, newValue, oldValue);
+ }
+ return decorator(name, newValue, oldValue);
+ };
+
+ /*=====
+ dojox.lang.oo.__MixinDefaults = function(){
+ // summary:
+ // a dict of default parameters for dojox.lang.oo._mixin
+ // decorator: Function:
+ // a decorator function to be used in absence of other decorators
+ // filter: Function:
+ // a filter function to be used in absence of other filters
+ // mixer: Function:
+ // a mixer function to be used to mix in new properties
+ this.decorator = decorator;
+ this.filter = filter;
+ this.mixer = mixer;
+ };
+ =====*/
+
+ oo.__mixin = function(target, source, decorator, filter, mixer){
+ // summary:
+ // mixes in two objects processing decorators and filters
+ // target: Object:
+ // target to receive new/updated properties
+ // source: Object:
+ // source of properties
+ // defaults: dojox.lang.oo.__MixinDefaults?:
+ // default functions for various aspects of mixing
+ // returns: Object:
+ // target
+
+ var name, targetName, prop, newValue, oldValue, i;
+
+ // start mixing in properties
+ for(name in source){
+ prop = source[name];
+ if(!(name in empty) || empty[name] !== prop){
+ targetName = filter(name, target, source, prop);
+ if(targetName && (!(targetName in target) || !(targetName in empty) || empty[targetName] !== prop)){
+ // name is accepted
+ oldValue = target[targetName];
+ newValue = applyDecorator(decorator, targetName, prop, oldValue);
+ if(oldValue !== newValue){
+ mixer(target, targetName, newValue, oldValue);
+ }
+ }
+ }
+ }
+ if(extraLen){
+ for(i = 0; i < extraLen; ++i){
+ name = extraNames[i];
+ // repeating the body above
+ prop = source[name];
+ if(!(name in empty) || empty[name] !== prop){
+ targetName = filter(name, target, source, prop);
+ if(targetName && (!(targetName in target) || !(targetName in empty) || empty[targetName] !== prop)){
+ // name is accepted
+ oldValue = target[targetName];
+ newValue = applyDecorator(decorator, targetName, prop, oldValue);
+ if(oldValue !== newValue){
+ mixer(target, targetName, newValue, oldValue);
+ }
+ }
+ }
+ }
+ }
+
+ return target; // Object
+ };
+
+ oo.mixin = function(target, source){
+ // summary:
+ // mixes in two or more objects processing decorators and filters
+ // using defaults as a fallback
+ // target: Object:
+ // target to receive new/updated properties
+ // source: Object...:
+ // source of properties, more than one source is allowed
+ // returns: Object:
+ // target
+
+ var decorator, filter, i = 1, l = arguments.length;
+ for(; i < l; ++i){
+ source = arguments[i];
+ if(source instanceof Filter){
+ filter = source.filter;
+ source = source.bag;
+ }else{
+ filter = defaultFilter;
+ }
+ if(source instanceof Decorator){
+ decorator = source.decorator;
+ source = source.value;
+ }else{
+ decorator = defaultDecorator;
+ }
+ oo.__mixin(target, source, decorator, filter, defaultMixer);
+ }
+ return target; // Object
+ };
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/lang/oo/mixin.xd.js b/js/dojo-1.6/dojox/lang/oo/mixin.xd.js new file mode 100644 index 0000000..6a00ed7 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/mixin.xd.js @@ -0,0 +1,151 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.oo.mixin"],
+["require", "dojox.lang.oo.Filter"],
+["require", "dojox.lang.oo.Decorator"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.oo.mixin"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.mixin"] = true;
+dojo.provide("dojox.lang.oo.mixin");
+
+dojo.experimental("dojox.lang.oo.mixin");
+
+dojo.require("dojox.lang.oo.Filter");
+dojo.require("dojox.lang.oo.Decorator");
+
+(function(){
+ var oo = dojox.lang.oo, Filter = oo.Filter, Decorator = oo.Decorator, empty = {},
+ defaultFilter = function(name){ return name; },
+ defaultDecorator = function(name, newValue, oldValue){ return newValue; },
+ defaultMixer = function(target, name, newValue, oldValue){ target[name] = newValue; },
+ defaults = {}, // for the internal use in the mixin()
+ extraNames = dojo._extraNames, extraLen = extraNames.length,
+
+ applyDecorator = oo.applyDecorator = function(decorator, name, newValue, oldValue){
+ // summary:
+ // applies a decorator unraveling all embedded decorators
+ // decorator: Function:
+ // top-level decorator to apply
+ // name: String:
+ // name of the property
+ // newValue: Object:
+ // new value of the property
+ // oldValue: Object:
+ // old value of the property
+ // returns: Object:
+ // returns the final value of the property
+ if(newValue instanceof Decorator){
+ var d = newValue.decorator;
+ newValue = applyDecorator(decorator, name, newValue.value, oldValue);
+ return d(name, newValue, oldValue);
+ }
+ return decorator(name, newValue, oldValue);
+ };
+
+ /*=====
+ dojox.lang.oo.__MixinDefaults = function(){
+ // summary:
+ // a dict of default parameters for dojox.lang.oo._mixin
+ // decorator: Function:
+ // a decorator function to be used in absence of other decorators
+ // filter: Function:
+ // a filter function to be used in absence of other filters
+ // mixer: Function:
+ // a mixer function to be used to mix in new properties
+ this.decorator = decorator;
+ this.filter = filter;
+ this.mixer = mixer;
+ };
+ =====*/
+
+ oo.__mixin = function(target, source, decorator, filter, mixer){
+ // summary:
+ // mixes in two objects processing decorators and filters
+ // target: Object:
+ // target to receive new/updated properties
+ // source: Object:
+ // source of properties
+ // defaults: dojox.lang.oo.__MixinDefaults?:
+ // default functions for various aspects of mixing
+ // returns: Object:
+ // target
+
+ var name, targetName, prop, newValue, oldValue, i;
+
+ // start mixing in properties
+ for(name in source){
+ prop = source[name];
+ if(!(name in empty) || empty[name] !== prop){
+ targetName = filter(name, target, source, prop);
+ if(targetName && (!(targetName in target) || !(targetName in empty) || empty[targetName] !== prop)){
+ // name is accepted
+ oldValue = target[targetName];
+ newValue = applyDecorator(decorator, targetName, prop, oldValue);
+ if(oldValue !== newValue){
+ mixer(target, targetName, newValue, oldValue);
+ }
+ }
+ }
+ }
+ if(extraLen){
+ for(i = 0; i < extraLen; ++i){
+ name = extraNames[i];
+ // repeating the body above
+ prop = source[name];
+ if(!(name in empty) || empty[name] !== prop){
+ targetName = filter(name, target, source, prop);
+ if(targetName && (!(targetName in target) || !(targetName in empty) || empty[targetName] !== prop)){
+ // name is accepted
+ oldValue = target[targetName];
+ newValue = applyDecorator(decorator, targetName, prop, oldValue);
+ if(oldValue !== newValue){
+ mixer(target, targetName, newValue, oldValue);
+ }
+ }
+ }
+ }
+ }
+
+ return target; // Object
+ };
+
+ oo.mixin = function(target, source){
+ // summary:
+ // mixes in two or more objects processing decorators and filters
+ // using defaults as a fallback
+ // target: Object:
+ // target to receive new/updated properties
+ // source: Object...:
+ // source of properties, more than one source is allowed
+ // returns: Object:
+ // target
+
+ var decorator, filter, i = 1, l = arguments.length;
+ for(; i < l; ++i){
+ source = arguments[i];
+ if(source instanceof Filter){
+ filter = source.filter;
+ source = source.bag;
+ }else{
+ filter = defaultFilter;
+ }
+ if(source instanceof Decorator){
+ decorator = source.decorator;
+ source = source.value;
+ }else{
+ decorator = defaultDecorator;
+ }
+ oo.__mixin(target, source, decorator, filter, defaultMixer);
+ }
+ return target; // Object
+ };
+})();
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/lang/oo/rearrange.js b/js/dojo-1.6/dojox/lang/oo/rearrange.js new file mode 100644 index 0000000..855e92f --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/rearrange.js @@ -0,0 +1,75 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.lang.oo.rearrange"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.rearrange"] = true;
+dojo.provide("dojox.lang.oo.rearrange");
+
+(function(){
+ var extraNames = dojo._extraNames, extraLen = extraNames.length,
+ opts = Object.prototype.toString, empty = {};
+
+ dojox.lang.oo.rearrange = function(bag, map){
+ // summary:
+ // Process properties in place by removing and renaming them.
+ // description:
+ // Properties of an object are to be renamed or removed specified
+ // by "map" argument. Only own properties of "map" are processed.
+ // example:
+ // | oo.rearrange(bag, {
+ // | abc: "def", // rename "abc" attribute to "def"
+ // | ghi: null // remove/hide "ghi" attribute
+ // | });
+ // bag: Object:
+ // the object to be processed
+ // map: Object:
+ // the dictionary for renaming (false value indicates removal of the named property)
+ // returns: Object:
+ // the original object
+
+ var name, newName, prop, i, t;
+
+ for(name in map){
+ newName = map[name];
+ if(!newName || opts.call(newName) == "[object String]"){
+ prop = bag[name];
+ if(!(name in empty) || empty[name] !== prop){
+ if(!(delete bag[name])){
+ // can't delete => hide it
+ bag[name] = undefined;
+ }
+ if(newName){
+ bag[newName] = prop;
+ }
+ }
+ }
+ }
+ if(extraLen){
+ for(i = 0; i < extraLen; ++i){
+ name = extraNames[i];
+ // repeating the body above
+ newName = map[name];
+ if(!newName || opts.call(newName) == "[object String]"){
+ prop = bag[name];
+ if(!(name in empty) || empty[name] !== prop){
+ if(!(delete bag[name])){
+ // can't delete => hide it
+ bag[name] = undefined;
+ }
+ if(newName){
+ bag[newName] = prop;
+ }
+ }
+ }
+ }
+ }
+
+ return bag; // Object
+ };
+})();
+
+}
diff --git a/js/dojo-1.6/dojox/lang/oo/rearrange.xd.js b/js/dojo-1.6/dojox/lang/oo/rearrange.xd.js new file mode 100644 index 0000000..de56677 --- /dev/null +++ b/js/dojo-1.6/dojox/lang/oo/rearrange.xd.js @@ -0,0 +1,79 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.lang.oo.rearrange"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.lang.oo.rearrange"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.lang.oo.rearrange"] = true;
+dojo.provide("dojox.lang.oo.rearrange");
+
+(function(){
+ var extraNames = dojo._extraNames, extraLen = extraNames.length,
+ opts = Object.prototype.toString, empty = {};
+
+ dojox.lang.oo.rearrange = function(bag, map){
+ // summary:
+ // Process properties in place by removing and renaming them.
+ // description:
+ // Properties of an object are to be renamed or removed specified
+ // by "map" argument. Only own properties of "map" are processed.
+ // example:
+ // | oo.rearrange(bag, {
+ // | abc: "def", // rename "abc" attribute to "def"
+ // | ghi: null // remove/hide "ghi" attribute
+ // | });
+ // bag: Object:
+ // the object to be processed
+ // map: Object:
+ // the dictionary for renaming (false value indicates removal of the named property)
+ // returns: Object:
+ // the original object
+
+ var name, newName, prop, i, t;
+
+ for(name in map){
+ newName = map[name];
+ if(!newName || opts.call(newName) == "[object String]"){
+ prop = bag[name];
+ if(!(name in empty) || empty[name] !== prop){
+ if(!(delete bag[name])){
+ // can't delete => hide it
+ bag[name] = undefined;
+ }
+ if(newName){
+ bag[newName] = prop;
+ }
+ }
+ }
+ }
+ if(extraLen){
+ for(i = 0; i < extraLen; ++i){
+ name = extraNames[i];
+ // repeating the body above
+ newName = map[name];
+ if(!newName || opts.call(newName) == "[object String]"){
+ prop = bag[name];
+ if(!(name in empty) || empty[name] !== prop){
+ if(!(delete bag[name])){
+ // can't delete => hide it
+ bag[name] = undefined;
+ }
+ if(newName){
+ bag[newName] = prop;
+ }
+ }
+ }
+ }
+ }
+
+ return bag; // Object
+ };
+})();
+
+}
+
+}};});
|
