]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/layout/StackContainer.js
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
8 if(!dojo
._hasResource
["dijit.layout.StackContainer"]){
9 dojo
._hasResource
["dijit.layout.StackContainer"]=true;
10 dojo
.provide("dijit.layout.StackContainer");
11 dojo
.require("dijit._Templated");
12 dojo
.require("dijit.layout._LayoutWidget");
13 dojo
.requireLocalization("dijit","common",null,"ROOT,ar,ca,cs,da,de,el,es,fi,fr,he,hu,it,ja,ko,nb,nl,pl,pt,pt-pt,ro,ru,sk,sl,sv,th,tr,zh,zh-tw");
14 dojo
.require("dojo.cookie");
15 dojo
.declare("dijit.layout.StackContainer",dijit
.layout
._LayoutWidget
,{doLayout
:true,persist
:false,baseClass
:"dijitStackContainer",postCreate:function(){
16 this.inherited(arguments
);
17 dojo
.addClass(this.domNode
,"dijitLayoutContainer");
18 dijit
.setWaiRole(this.containerNode
,"tabpanel");
19 this.connect(this.domNode
,"onkeypress",this._onKeyPress
);
24 var _1
=this.getChildren();
25 dojo
.forEach(_1
,this._setupChild
,this);
27 this.selectedChildWidget
=dijit
.byId(dojo
.cookie(this.id
+"_selectedChild"));
29 dojo
.some(_1
,function(_2
){
31 this.selectedChildWidget
=_2
;
36 var _3
=this.selectedChildWidget
;
38 _3
=this.selectedChildWidget
=_1
[0];
41 dojo
.publish(this.id
+"-startup",[{children
:_1
,selected
:_3
}]);
42 this.inherited(arguments
);
44 var _4
=this.selectedChildWidget
;
45 if(_4
&&!this._hasBeenShown
){
46 this._hasBeenShown
=true;
49 this.inherited(arguments
);
50 },_setupChild:function(_5
){
51 this.inherited(arguments
);
52 dojo
.removeClass(_5
.domNode
,"dijitVisible");
53 dojo
.addClass(_5
.domNode
,"dijitHidden");
55 },addChild:function(_6
,_7
){
56 this.inherited(arguments
);
58 dojo
.publish(this.id
+"-addChild",[_6
,_7
]);
60 if(!this.selectedChildWidget
){
64 },removeChild:function(_8
){
65 this.inherited(arguments
);
67 dojo
.publish(this.id
+"-removeChild",[_8
]);
69 if(this._beingDestroyed
){
72 if(this.selectedChildWidget
===_8
){
73 this.selectedChildWidget
=undefined;
75 var _9
=this.getChildren();
77 this.selectChild(_9
[0]);
84 },selectChild:function(_a
,_b
){
86 if(this.selectedChildWidget
!=_a
){
87 this._transition(_a
,this.selectedChildWidget
,_b
);
88 this.selectedChildWidget
=_a
;
89 dojo
.publish(this.id
+"-selectChild",[_a
]);
91 dojo
.cookie(this.id
+"_selectedChild",this.selectedChildWidget
.id
);
94 },_transition:function(_c
,_d
){
101 _c
.resize(this._containerContentBox
||this._contentBox
);
106 },_adjacent:function(_e
){
107 var _f
=this.getChildren();
108 var _10
=dojo
.indexOf(_f
,this.selectedChildWidget
);
109 _10
+=_e
?1:_f
.length
-1;
110 return _f
[_10
%_f
.length
];
111 },forward:function(){
112 this.selectChild(this._adjacent(true),true);
114 this.selectChild(this._adjacent(false),true);
115 },_onKeyPress:function(e
){
116 dojo
.publish(this.id
+"-containerKeyPress",[{e
:e
,page
:this}]);
118 if(this.doLayout
&&this.selectedChildWidget
&&this.selectedChildWidget
.resize
){
119 this.selectedChildWidget
.resize(this._containerContentBox
||this._contentBox
);
121 },_showChild:function(_11
){
122 var _12
=this.getChildren();
123 _11
.isFirstChild
=(_11
==_12
[0]);
124 _11
.isLastChild
=(_11
==_12
[_12
.length
-1]);
126 dojo
.removeClass(_11
.domNode
,"dijitHidden");
127 dojo
.addClass(_11
.domNode
,"dijitVisible");
129 },_hideChild:function(_13
){
131 dojo
.removeClass(_13
.domNode
,"dijitVisible");
132 dojo
.addClass(_13
.domNode
,"dijitHidden");
134 },closeChild:function(_14
){
135 var _15
=_14
.onClose(this,_14
);
137 this.removeChild(_14
);
138 _14
.destroyRecursive();
140 },destroyDescendants:function(_16
){
141 dojo
.forEach(this.getChildren(),function(_17
){
142 this.removeChild(_17
);
143 _17
.destroyRecursive(_16
);
146 dojo
.require("dijit.layout.StackController");
147 dojo
.extend(dijit
._Widget
,{selected
:false,closable
:false,iconClass
:"",showTitle
:true});