Changeset 13521
- Timestamp:
- 04/30/08 19:59:27 (7 months ago)
- Location:
- dijit/trunk
- Files:
-
- 5 modified
-
layout/ContentPane.js (modified) (5 diffs)
-
layout/StackContainer.js (modified) (2 diffs)
-
_Container.js (modified) (3 diffs)
-
_Templated.js (modified) (1 diff)
-
_Widget.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/layout/ContentPane.js
r13472 r13521 133 133 // TODO: if there are two child widgets (a data store and a TabContainer, for example), 134 134 // should still find the TabContainer 135 var childNodes = dojo.query(">", this.containerNode || this.domNode),135 var childNodes = dojo.query(">", this.containerNode), 136 136 childWidgets = childNodes.filter("[widgetId]"); 137 137 … … 193 193 if(this._singleChild && this._singleChild.resize){ 194 194 this._singleChild.startup(); 195 this._singleChild.resize(this._contentBox || dojo.contentBox(this.containerNode || this.domNode));195 this._singleChild.resize(this._contentBox || dojo.contentBox(this.containerNode)); 196 196 } 197 197 } … … 227 227 // But note that setting the margin box and then immediately querying dimensions may return 228 228 // inaccurate results, so try not to depend on it. 229 var node = this.containerNode || this.domNode,229 var node = this.containerNode, 230 230 mb = dojo.mixin(dojo.marginBox(node), size||{}); 231 231 … … 344 344 345 345 _setContent: function(cont){ 346 // first get rid of child widgets 346 347 this.destroyDescendants(); 347 348 348 349 try{ 349 var node = this.containerNode || this.domNode; 350 // ... and then get rid of child dom nodes 351 var node = this.containerNode; 350 352 while(node.firstChild){ 351 353 dojo._destroyElement(node.firstChild); … … 395 397 _createSubWidgets: function(){ 396 398 // summary: scan my contents and create subwidgets 397 var rootNode = this.containerNode || this.domNode;398 399 try{ 399 dojo.parser.parse( rootNode, true);400 dojo.parser.parse(this.containerNode, true); 400 401 }catch(e){ 401 402 this._onError('Content', e, "Couldn't create widgets in "+this.id -
dijit/trunk/layout/StackContainer.js
r13089 r13521 36 36 =====*/ 37 37 postCreate: function(){ 38 dijit.setWaiRole( (this.containerNode || this.domNode), "tabpanel");38 dijit.setWaiRole(this.containerNode, "tabpanel"); 39 39 this.connect(this.domNode, "onkeypress", this._onKeyPress); 40 40 }, … … 348 348 newButton.focusNode.setAttribute("tabIndex", "0"); 349 349 var container = dijit.byId(this.containerId); 350 dijit.setWaiState(container.containerNode || container.domNode, "labelledby", newButton.id);350 dijit.setWaiState(container.containerNode, "labelledby", newButton.id); 351 351 }, 352 352 -
dijit/trunk/_Container.js
r12406 r13521 57 57 { 58 58 // summary: 59 // Mixin for widgets that contain a list ofchildren.59 // Mixin for widgets that contain a set of widget children. 60 60 // description: 61 // Use this mixin when the widget needs to know about and 62 // keep track of it's widget children. Widgets like SplitContainer 63 // and TabContainer. 64 61 // Use this mixin for widgets that needs to know about and 62 // keep track of their widget children. Suitable for widgets like BorderContainer 63 // and TabContainer which contain (only) a set of child widgets. 64 // 65 // It's not suitable for widgets like ContentPane 66 // which contains mixed HTML (plain DOM nodes in addition to widgets), 67 // and where contained widgets are not necessarily directly below 68 // this.containerNode. In that case calls like addChild(node, position) 69 // wouldn't make sense. 70 71 // isContainer: Boolean 72 // Just a flag indicating that this widget descends from dijit._Container 65 73 isContainer: true, 66 74 75 buildRendering: function(){ 76 this.inherited(arguments); 77 if(!this.containerNode){ 78 // all widgets with descendants must set containerNode 79 this.containerNode = this.domNode; 80 } 81 }, 82 67 83 addChild: function(/*Widget*/ widget, /*int?*/ insertIndex){ 68 84 // summary: 69 // Process the given child widget, inserting it's dom node as 70 // a child of our dom node 85 // Makes the given widget a child of this widget. 86 // description: 87 // Inserts specified child widget's dom node as a child of this widget's 88 // container node, and possibly does otherprocessing (such as layout). 71 89 72 90 if(insertIndex === undefined){ 73 91 insertIndex = "last"; 74 92 } 75 var refNode = this.containerNode || this.domNode;93 var refNode = this.containerNode; 76 94 if(insertIndex && typeof insertIndex == "number"){ 77 95 var children = dojo.query("> [widgetid]", refNode); … … 94 112 // summary: 95 113 // Removes the passed widget instance from this widget but does 96 // not destroy it 114 // not destroy it. 97 115 var node = widget.domNode; 98 116 node.parentNode.removeChild(node); // detach but don't destroy … … 116 134 getChildren: function(){ 117 135 // summary: 118 // Returns array of children widgets 119 return dojo.query("> [widgetId]", this.containerNode || this.domNode).map(dijit.byNode); // Array 136 // Returns array of children widgets. 137 // description: 138 // Returns the widgets that are directly under this.containerNode. 139 return dojo.query("> [widgetId]", this.containerNode).map(dijit.byNode); // Widget[] 120 140 }, 121 141 122 142 hasChildren: function(){ 123 143 // summary: 124 // Returns true if widget has children 125 var cn = this.containerNode || this.domNode; 126 return !!this._firstElement(cn); // Boolean 144 // Returns true if widget has children, i.e. if this.containerNode contains something. 145 return !!this._firstElement(this.containerNode); // Boolean 127 146 }, 128 147 -
dijit/trunk/_Templated.js
r12872 r13521 30 30 // declared in markup inside it? false by default. 31 31 widgetsInTemplate: false, 32 33 // containerNode: DomNode34 // holds child elements. "containerNode" is generally set via a35 // dojoAttachPoint assignment and it designates where children of36 // the src dom node will be placed37 containerNode: null,38 32 39 33 // skipNodeCache: Boolean -
dijit/trunk/_Widget.js
r13274 r13521 47 47 48 48 // domNode: DomNode 49 // this is our visible representation of the widget! Other DOM49 // This is our visible representation of the widget! Other DOM 50 50 // Nodes may by assigned to other properties, usually through the 51 // template system's dojoAttachPo nit syntax, but the domNode51 // template system's dojoAttachPoint syntax, but the domNode 52 52 // property is the canonical "top level" node in widget UI. 53 53 domNode: null, 54 55 // containerNode: DomNode 56 // Designates where children of the source dom node will be placed. 57 // "Children" in this case refers to both dom nodes and widgets. 58 // For example, for myWidget: 59 // 60 // | <div dojoType=myWidget> 61 // | <b> here's a plain dom node 62 // | <span dojoType=subWidget>and a widget</span> 63 // | <i> and another plain dom node </i> 64 // | </div> 65 // 66 // containerNode would point to: 67 // 68 // | <b> here's a plain dom node 69 // | <span dojoType=subWidget>and a widget</span> 70 // | <i> and another plain dom node </i> 71 // 72 // In templated widgets, "containerNode" is set via a 73 // dojoAttachPoint assignment. 74 // 75 // containerNode must be defined for any widget that accepts innerHTML 76 // (like ContentPane or BorderContainer or even Button), and conversely 77 // is null for widgets that don't, like TextBox. 78 containerNode: null, 54 79 55 80 // attributeMap: Object … … 316 341 getDescendants: function(){ 317 342 // summary: 318 // Returns all the widgets that contained by this, i.e., all widgets underneath this.containerNode. 343 // Returns all the widgets that contained by this, i.e., all widgets underneath this.containerNode. 344 // description: 345 // This method is designed to *not* return widgets that are, for example, 346 // used as part of a template, but rather to just return widgets that are defined in the 347 // original markup as descendants of this widget, for example w/this markup: 348 // 349 // | <div dojoType=myWidget> 350 // | <b> hello world </b> 351 // | <div> 352 // | <span dojoType=subwidget> 353 // | <span dojoType=subwidget2>how's it going?</span> 354 // | </span> 355 // | </div> 356 // | </div> 357 // 358 // getDescendants() will return subwidget, but not anything that's part of the template 359 // of myWidget. 360 319 361 if(this.containerNode){ 320 362 var list= dojo.query('[widgetId]', this.containerNode);