root / trunk / web / dojo / dijit / layout / _TabContainerBase.js @ 12
History | View | Annotate | Download (2.69 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.layout._TabContainerBase"]){ |
||
9 | dojo._hasResource["dijit.layout._TabContainerBase"]=true; |
||
10 | dojo.provide("dijit.layout._TabContainerBase");
|
||
11 | dojo.require("dijit.layout.StackContainer");
|
||
12 | dojo.require("dijit._Templated");
|
||
13 | dojo.declare("dijit.layout._TabContainerBase",[dijit.layout.StackContainer,dijit._Templated],{tabPosition:"top",baseClass:"dijitTabContainer",tabStrip:false,nested:false,templateString:dojo.cache("dijit.layout","templates/TabContainer.html","<div class=\"dijitTabContainer\">\n\t<div class=\"dijitTabListWrapper\" dojoAttachPoint=\"tablistNode\"></div>\n\t<div dojoAttachPoint=\"tablistSpacer\" class=\"dijitTabSpacer ${baseClass}-spacer\"></div>\n\t<div class=\"dijitTabPaneWrapper ${baseClass}-container\" dojoAttachPoint=\"containerNode\"></div>\n</div>\n"),postMixInProperties:function(){ |
||
14 | this.baseClass+=this.tabPosition.charAt(0).toUpperCase()+this.tabPosition.substr(1).replace(/-.*/,""); |
||
15 | this.srcNodeRef&&dojo.style(this.srcNodeRef,"visibility","hidden"); |
||
16 | this.inherited(arguments); |
||
17 | },postCreate:function(){ |
||
18 | this.inherited(arguments); |
||
19 | this.tablist=this._makeController(this.tablistNode); |
||
20 | if(!this.doLayout){ |
||
21 | dojo.addClass(this.domNode,"dijitTabContainerNoLayout"); |
||
22 | } |
||
23 | if(this.nested){ |
||
24 | dojo.addClass(this.domNode,"dijitTabContainerNested"); |
||
25 | dojo.addClass(this.tablist.containerNode,"dijitTabContainerTabListNested"); |
||
26 | dojo.addClass(this.tablistSpacer,"dijitTabContainerSpacerNested"); |
||
27 | dojo.addClass(this.containerNode,"dijitTabPaneWrapperNested"); |
||
28 | }else{
|
||
29 | dojo.addClass(this.domNode,"tabStrip-"+(this.tabStrip?"enabled":"disabled")); |
||
30 | } |
||
31 | },_setupChild:function(_1){ |
||
32 | dojo.addClass(_1.domNode,"dijitTabPane");
|
||
33 | this.inherited(arguments); |
||
34 | },startup:function(){ |
||
35 | if(this._started){ |
||
36 | return;
|
||
37 | } |
||
38 | this.tablist.startup();
|
||
39 | this.inherited(arguments); |
||
40 | },layout:function(){ |
||
41 | if(!this._contentBox||typeof (this._contentBox.l)=="undefined"){ |
||
42 | return;
|
||
43 | } |
||
44 | var sc=this.selectedChildWidget; |
||
45 | if(this.doLayout){ |
||
46 | var _2=this.tabPosition.replace(/-h/,""); |
||
47 | this.tablist.layoutAlign=_2;
|
||
48 | var _3=[this.tablist,{domNode:this.tablistSpacer,layoutAlign:_2},{domNode:this.containerNode,layoutAlign:"client"}]; |
||
49 | dijit.layout.layoutChildren(this.domNode,this._contentBox,_3); |
||
50 | this._containerContentBox=dijit.layout.marginBox2contentBox(this.containerNode,_3[2]); |
||
51 | if(sc&&sc.resize){
|
||
52 | sc.resize(this._containerContentBox);
|
||
53 | } |
||
54 | }else{
|
||
55 | if(this.tablist.resize){ |
||
56 | this.tablist.resize({w:dojo.contentBox(this.domNode).w}); |
||
57 | } |
||
58 | if(sc&&sc.resize){
|
||
59 | sc.resize(); |
||
60 | } |
||
61 | } |
||
62 | },destroy:function(){ |
||
63 | if(this.tablist){ |
||
64 | this.tablist.destroy();
|
||
65 | } |
||
66 | this.inherited(arguments); |
||
67 | }}); |
||
68 | } |