root / trunk / web / dojo / dojox / wire / CompositeWire.js
History | View | Annotate | Download (1.05 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.wire.CompositeWire"]){ | ||
| 9 | dojo._hasResource["dojox.wire.CompositeWire"]=true; | ||
| 10 | dojo.provide("dojox.wire.CompositeWire");
 | ||
| 11 | dojo.require("dojox.wire._base");
 | ||
| 12 | dojo.require("dojox.wire.Wire");
 | ||
| 13 | dojo.declare("dojox.wire.CompositeWire",dojox.wire.Wire,{_wireClass:"dojox.wire.CompositeWire",constructor:function(_1){ | ||
| 14 | this._initializeChildren(this.children); | ||
| 15 | },_getValue:function(_2){ | ||
| 16 | if(!_2||!this.children){ | ||
| 17 | return _2;
 | ||
| 18 | } | ||
| 19 | var _3=(dojo.isArray(this.children)?[]:{}); | ||
| 20 | for(var c in this.children){ | ||
| 21 | _3[c]=this.children[c].getValue(_2);
 | ||
| 22 | } | ||
| 23 | return _3;
 | ||
| 24 | },_setValue:function(_4,_5){ | ||
| 25 | if(!_4||!this.children){ | ||
| 26 | return _4;
 | ||
| 27 | } | ||
| 28 | for(var c in this.children){ | ||
| 29 | this.children[c].setValue(_5[c],_4);
 | ||
| 30 | } | ||
| 31 | return _4;
 | ||
| 32 | },_initializeChildren:function(_6){ | ||
| 33 | if(!_6){
 | ||
| 34 | return;
 | ||
| 35 | } | ||
| 36 | for(var c in _6){ | ||
| 37 | var _7=_6[c];
 | ||
| 38 | _7.parent=this;
 | ||
| 39 | if(!dojox.wire.isWire(_7)){
 | ||
| 40 | _6[c]=dojox.wire.create(_7); | ||
| 41 | } | ||
| 42 | } | ||
| 43 | }}); | ||
| 44 | } |