root / trunk / web / dojo / dijit / _Container.js @ 12
History | View | Annotate | Download (1.46 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["dijit._Container"]){ |
||
| 9 | dojo._hasResource["dijit._Container"]=true; |
||
| 10 | dojo.provide("dijit._Container");
|
||
| 11 | dojo.declare("dijit._Container",null,{isContainer:true,buildRendering:function(){ |
||
| 12 | this.inherited(arguments); |
||
| 13 | if(!this.containerNode){ |
||
| 14 | this.containerNode=this.domNode; |
||
| 15 | } |
||
| 16 | },addChild:function(_1,_2){ |
||
| 17 | var _3=this.containerNode; |
||
| 18 | if(_2&&typeof _2=="number"){ |
||
| 19 | var _4=this.getChildren(); |
||
| 20 | if(_4&&_4.length>=_2){
|
||
| 21 | _3=_4[_2-1].domNode;
|
||
| 22 | _2="after";
|
||
| 23 | } |
||
| 24 | } |
||
| 25 | dojo.place(_1.domNode,_3,_2); |
||
| 26 | if(this._started&&!_1._started){ |
||
| 27 | _1.startup(); |
||
| 28 | } |
||
| 29 | },removeChild:function(_5){ |
||
| 30 | if(typeof _5=="number"&&_5>0){ |
||
| 31 | _5=this.getChildren()[_5];
|
||
| 32 | } |
||
| 33 | if(_5){
|
||
| 34 | var _6=_5.domNode;
|
||
| 35 | if(_6&&_6.parentNode){
|
||
| 36 | _6.parentNode.removeChild(_6); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | },hasChildren:function(){ |
||
| 40 | return this.getChildren().length>0; |
||
| 41 | },destroyDescendants:function(_7){ |
||
| 42 | dojo.forEach(this.getChildren(),function(_8){ |
||
| 43 | _8.destroyRecursive(_7); |
||
| 44 | }); |
||
| 45 | },_getSiblingOfChild:function(_9,_a){ |
||
| 46 | var _b=_9.domNode,_c=(_a>0?"nextSibling":"previousSibling"); |
||
| 47 | do{
|
||
| 48 | _b=_b[_c]; |
||
| 49 | }while(_b&&(_b.nodeType!=1||!dijit.byNode(_b))); |
||
| 50 | return _b&&dijit.byNode(_b);
|
||
| 51 | },getIndexOfChild:function(_d){ |
||
| 52 | return dojo.indexOf(this.getChildren(),_d); |
||
| 53 | },startup:function(){ |
||
| 54 | if(this._started){ |
||
| 55 | return;
|
||
| 56 | } |
||
| 57 | dojo.forEach(this.getChildren(),function(_e){ |
||
| 58 | _e.startup(); |
||
| 59 | }); |
||
| 60 | this.inherited(arguments); |
||
| 61 | }}); |
||
| 62 | } |