summaryrefslogtreecommitdiff
path: root/lib/dijit/_Container.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dijit/_Container.js')
-rw-r--r--lib/dijit/_Container.js146
1 files changed, 2 insertions, 144 deletions
diff --git a/lib/dijit/_Container.js b/lib/dijit/_Container.js
index 23962688f..bbe597fcb 100644
--- a/lib/dijit/_Container.js
+++ b/lib/dijit/_Container.js
@@ -1,144 +1,2 @@
-/*
- 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["dijit._Container"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dijit._Container"] = true;
-dojo.provide("dijit._Container");
-
-
-dojo.declare("dijit._Container",
- null,
- {
- // summary:
- // Mixin for widgets that contain a set of widget children.
- // description:
- // Use this mixin for widgets that needs to know about and
- // keep track of their widget children. Suitable for widgets like BorderContainer
- // and TabContainer which contain (only) a set of child widgets.
- //
- // It's not suitable for widgets like ContentPane
- // which contains mixed HTML (plain DOM nodes in addition to widgets),
- // and where contained widgets are not necessarily directly below
- // this.containerNode. In that case calls like addChild(node, position)
- // wouldn't make sense.
-
- // isContainer: [protected] Boolean
- // Indicates that this widget acts as a "parent" to the descendant widgets.
- // When the parent is started it will call startup() on the child widgets.
- // See also `isLayoutContainer`.
- isContainer: true,
-
- buildRendering: function(){
- this.inherited(arguments);
- if(!this.containerNode){
- // all widgets with descendants must set containerNode
- this.containerNode = this.domNode;
- }
- },
-
- addChild: function(/*dijit._Widget*/ widget, /*int?*/ insertIndex){
- // summary:
- // Makes the given widget a child of this widget.
- // description:
- // Inserts specified child widget's dom node as a child of this widget's
- // container node, and possibly does other processing (such as layout).
-
- var refNode = this.containerNode;
- if(insertIndex && typeof insertIndex == "number"){
- var children = this.getChildren();
- if(children && children.length >= insertIndex){
- refNode = children[insertIndex-1].domNode;
- insertIndex = "after";
- }
- }
- dojo.place(widget.domNode, refNode, insertIndex);
-
- // If I've been started but the child widget hasn't been started,
- // start it now. Make sure to do this after widget has been
- // inserted into the DOM tree, so it can see that it's being controlled by me,
- // so it doesn't try to size itself.
- if(this._started && !widget._started){
- widget.startup();
- }
- },
-
- removeChild: function(/*Widget or int*/ widget){
- // summary:
- // Removes the passed widget instance from this widget but does
- // not destroy it. You can also pass in an integer indicating
- // the index within the container to remove
-
- if(typeof widget == "number"){
- widget = this.getChildren()[widget];
- }
-
- if(widget){
- var node = widget.domNode;
- if(node && node.parentNode){
- node.parentNode.removeChild(node); // detach but don't destroy
- }
- }
- },
-
- hasChildren: function(){
- // summary:
- // Returns true if widget has children, i.e. if this.containerNode contains something.
- return this.getChildren().length > 0; // Boolean
- },
-
- destroyDescendants: function(/*Boolean*/ preserveDom){
- // summary:
- // Destroys all the widgets inside this.containerNode,
- // but not this widget itself
- dojo.forEach(this.getChildren(), function(child){ child.destroyRecursive(preserveDom); });
- },
-
- _getSiblingOfChild: function(/*dijit._Widget*/ child, /*int*/ dir){
- // summary:
- // Get the next or previous widget sibling of child
- // dir:
- // if 1, get the next sibling
- // if -1, get the previous sibling
- // tags:
- // private
- var node = child.domNode,
- which = (dir>0 ? "nextSibling" : "previousSibling");
- do{
- node = node[which];
- }while(node && (node.nodeType != 1 || !dijit.byNode(node)));
- return node && dijit.byNode(node); // dijit._Widget
- },
-
- getIndexOfChild: function(/*dijit._Widget*/ child){
- // summary:
- // Gets the index of the child in this container or -1 if not found
- return dojo.indexOf(this.getChildren(), child); // int
- },
-
- startup: function(){
- // summary:
- // Called after all the widgets have been instantiated and their
- // dom nodes have been inserted somewhere under dojo.doc.body.
- //
- // Widgets should override this method to do any initialization
- // dependent on other widgets existing, and then call
- // this superclass method to finish things off.
- //
- // startup() in subclasses shouldn't do anything
- // size related because the size of the widget hasn't been set yet.
-
- if(this._started){ return; }
-
- // Startup all children of this widget
- dojo.forEach(this.getChildren(), function(child){ child.startup(); });
-
- this.inherited(arguments);
- }
- }
-);
-
-}
+//>>built
+define("dijit/_Container",["dojo/_base/array","dojo/_base/declare","dojo/dom-construct","./registry"],function(_1,_2,_3,_4){return _2("dijit._Container",null,{buildRendering:function(){this.inherited(arguments);if(!this.containerNode){this.containerNode=this.domNode;}},addChild:function(_5,_6){var _7=this.containerNode;if(_6&&typeof _6=="number"){var _8=this.getChildren();if(_8&&_8.length>=_6){_7=_8[_6-1].domNode;_6="after";}}_3.place(_5.domNode,_7,_6);if(this._started&&!_5._started){_5.startup();}},removeChild:function(_9){if(typeof _9=="number"){_9=this.getChildren()[_9];}if(_9){var _a=_9.domNode;if(_a&&_a.parentNode){_a.parentNode.removeChild(_a);}}},hasChildren:function(){return this.getChildren().length>0;},_getSiblingOfChild:function(_b,_c){var _d=_b.domNode,_e=(_c>0?"nextSibling":"previousSibling");do{_d=_d[_e];}while(_d&&(_d.nodeType!=1||!_4.byNode(_d)));return _d&&_4.byNode(_d);},getIndexOfChild:function(_f){return _1.indexOf(this.getChildren(),_f);}});}); \ No newline at end of file