root / trunk / web / dojo / dojox / lang / oo / mixin.js @ 13
History | View | Annotate | Download (1.67 KB)
| 1 | 9 | andrej.cim | /*
 | 
      
|---|---|---|---|
| 2 |         Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
 | 
      ||
| 3 |         Available via Academic Free License >= 2.1 OR the modified BSD license.
 | 
      ||
| 4 |         see: http://dojotoolkit.org/license for details
 | 
      ||
| 5 | */
 | 
      ||
| 6 | |||
| 7 | |||
| 8 | if(!dojo._hasResource["dojox.lang.oo.mixin"]){  | 
      ||
| 9 | dojo._hasResource["dojox.lang.oo.mixin"]=true;  | 
      ||
| 10 | dojo.provide("dojox.lang.oo.mixin");
 | 
      ||
| 11 | dojo.experimental("dojox.lang.oo.mixin");
 | 
      ||
| 12 | dojo.require("dojox.lang.oo.Filter");
 | 
      ||
| 13 | dojo.require("dojox.lang.oo.Decorator");
 | 
      ||
| 14 | (function(){
 | 
      ||
| 15 | var oo=dojox.lang.oo,_1=oo.Filter,_2=oo.Decorator,_3={},_4=function(_5){  | 
      ||
| 16 | return _5;
 | 
      ||
| 17 | },_6=function(_7,_8,_9){  | 
      ||
| 18 | return _8;
 | 
      ||
| 19 | },_a=function(_b,_c,_d,_e){  | 
      ||
| 20 | _b[_c]=_d;  | 
      ||
| 21 | },_f={},_10=dojo._extraNames,_11=_10.length,_12=oo.applyDecorator=function(_13,_14,_15,_16){
 | 
      ||
| 22 | if(_15 instanceof _2){  | 
      ||
| 23 | var d=_15.decorator;
 | 
      ||
| 24 | _15=_12(_13,_14,_15.value,_16);  | 
      ||
| 25 | return d(_14,_15,_16);
 | 
      ||
| 26 | }  | 
      ||
| 27 | return _13(_14,_15,_16);
 | 
      ||
| 28 | };  | 
      ||
| 29 | oo.__mixin=function(_17,_18,_19,_1a,_1b){  | 
      ||
| 30 | var _1c,_1d,_1e,_1f,_20,i;
 | 
      ||
| 31 | for(_1c in _18){  | 
      ||
| 32 | _1e=_18[_1c];  | 
      ||
| 33 | if(!(_1c in _3)||_3[_1c]!==_1e){  | 
      ||
| 34 | _1d=_1a(_1c,_17,_18,_1e);  | 
      ||
| 35 | if(_1d&&(!(_1d in _17)||!(_1d in _3)||_3[_1d]!==_1e)){  | 
      ||
| 36 | _20=_17[_1d];  | 
      ||
| 37 | _1f=_12(_19,_1d,_1e,_20);  | 
      ||
| 38 | if(_20!==_1f){
 | 
      ||
| 39 | _1b(_17,_1d,_1f,_20);  | 
      ||
| 40 | }  | 
      ||
| 41 | }  | 
      ||
| 42 | }  | 
      ||
| 43 | }  | 
      ||
| 44 | if(_11){
 | 
      ||
| 45 | for(i=0;i<_11;++i){  | 
      ||
| 46 | _1c=_10[i];  | 
      ||
| 47 | _1e=_18[_1c];  | 
      ||
| 48 | if(!(_1c in _3)||_3[_1c]!==_1e){  | 
      ||
| 49 | _1d=_1a(_1c,_17,_18,_1e);  | 
      ||
| 50 | if(_1d&&(!(_1d in _17)||!(_1d in _3)||_3[_1d]!==_1e)){  | 
      ||
| 51 | _20=_17[_1d];  | 
      ||
| 52 | _1f=_12(_19,_1d,_1e,_20);  | 
      ||
| 53 | if(_20!==_1f){
 | 
      ||
| 54 | _1b(_17,_1d,_1f,_20);  | 
      ||
| 55 | }  | 
      ||
| 56 | }  | 
      ||
| 57 | }  | 
      ||
| 58 | }  | 
      ||
| 59 | }  | 
      ||
| 60 | return _17;
 | 
      ||
| 61 | };  | 
      ||
| 62 | oo.mixin=function(_21,_22){  | 
      ||
| 63 | var _23,_24,i=1,l=arguments.length;  | 
      ||
| 64 | for(;i<l;++i){
 | 
      ||
| 65 | _22=arguments[i];
 | 
      ||
| 66 | if(_22 instanceof _1){  | 
      ||
| 67 | _24=_22.filter;  | 
      ||
| 68 | _22=_22.bag;  | 
      ||
| 69 | }else{
 | 
      ||
| 70 | _24=_4;  | 
      ||
| 71 | }  | 
      ||
| 72 | if(_22 instanceof _2){  | 
      ||
| 73 | _23=_22.decorator;  | 
      ||
| 74 | _22=_22.value;  | 
      ||
| 75 | }else{
 | 
      ||
| 76 | _23=_6;  | 
      ||
| 77 | }  | 
      ||
| 78 | oo.__mixin(_21,_22,_23,_24,_a);  | 
      ||
| 79 | }  | 
      ||
| 80 | return _21;
 | 
      ||
| 81 | };  | 
      ||
| 82 | })();  | 
      ||
| 83 | }  |