mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 12:25:56 +00:00
add dijit/dojo stuff; initial ui mockup
This commit is contained in:
220
lib/dijit/layout/AccordionContainer.js
Normal file
220
lib/dijit/layout/AccordionContainer.js
Normal file
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.AccordionContainer"]){
|
||||
dojo._hasResource["dijit.layout.AccordionContainer"]=true;
|
||||
dojo.provide("dijit.layout.AccordionContainer");
|
||||
dojo.require("dojo.fx");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.require("dijit._CssStateMixin");
|
||||
dojo.require("dijit.layout.StackContainer");
|
||||
dojo.require("dijit.layout.ContentPane");
|
||||
dojo.require("dijit.layout.AccordionPane");
|
||||
dojo.declare("dijit.layout.AccordionContainer",dijit.layout.StackContainer,{duration:dijit.defaultDuration,buttonWidget:"dijit.layout._AccordionButton",_verticalSpace:0,baseClass:"dijitAccordionContainer",postCreate:function(){
|
||||
this.domNode.style.overflow="hidden";
|
||||
this.inherited(arguments);
|
||||
dijit.setWaiRole(this.domNode,"tablist");
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
if(this.selectedChildWidget){
|
||||
var _1=this.selectedChildWidget.containerNode.style;
|
||||
_1.display="";
|
||||
_1.overflow="auto";
|
||||
this.selectedChildWidget._wrapperWidget.set("selected",true);
|
||||
}
|
||||
},_getTargetHeight:function(_2){
|
||||
var cs=dojo.getComputedStyle(_2);
|
||||
return Math.max(this._verticalSpace-dojo._getPadBorderExtents(_2,cs).h-dojo._getMarginExtents(_2,cs).h,0);
|
||||
},layout:function(){
|
||||
var _3=this.selectedChildWidget;
|
||||
if(!_3){
|
||||
return;
|
||||
}
|
||||
var _4=_3._wrapperWidget.domNode,_5=dojo._getMarginExtents(_4),_6=dojo._getPadBorderExtents(_4),_7=this._contentBox;
|
||||
var _8=0;
|
||||
dojo.forEach(this.getChildren(),function(_9){
|
||||
if(_9!=_3){
|
||||
_8+=dojo.marginBox(_9._wrapperWidget.domNode).h;
|
||||
}
|
||||
});
|
||||
this._verticalSpace=_7.h-_8-_5.h-_6.h-_3._buttonWidget.getTitleHeight();
|
||||
this._containerContentBox={h:this._verticalSpace,w:this._contentBox.w-_5.w-_6.w};
|
||||
if(_3){
|
||||
_3.resize(this._containerContentBox);
|
||||
}
|
||||
},_setupChild:function(_a){
|
||||
_a._wrapperWidget=new dijit.layout._AccordionInnerContainer({contentWidget:_a,buttonWidget:this.buttonWidget,id:_a.id+"_wrapper",dir:_a.dir,lang:_a.lang,parent:this});
|
||||
this.inherited(arguments);
|
||||
},addChild:function(_b,_c){
|
||||
if(this._started){
|
||||
dojo.place(_b.domNode,this.containerNode,_c);
|
||||
if(!_b._started){
|
||||
_b.startup();
|
||||
}
|
||||
this._setupChild(_b);
|
||||
dojo.publish(this.id+"-addChild",[_b,_c]);
|
||||
this.layout();
|
||||
if(!this.selectedChildWidget){
|
||||
this.selectChild(_b);
|
||||
}
|
||||
}else{
|
||||
this.inherited(arguments);
|
||||
}
|
||||
},removeChild:function(_d){
|
||||
_d._wrapperWidget.destroy();
|
||||
delete _d._wrapperWidget;
|
||||
dojo.removeClass(_d.domNode,"dijitHidden");
|
||||
this.inherited(arguments);
|
||||
},getChildren:function(){
|
||||
return dojo.map(this.inherited(arguments),function(_e){
|
||||
return _e.declaredClass=="dijit.layout._AccordionInnerContainer"?_e.contentWidget:_e;
|
||||
},this);
|
||||
},destroy:function(){
|
||||
dojo.forEach(this.getChildren(),function(_f){
|
||||
_f._wrapperWidget.destroy();
|
||||
});
|
||||
this.inherited(arguments);
|
||||
},_transition:function(_10,_11,_12){
|
||||
if(this._inTransition){
|
||||
return;
|
||||
}
|
||||
var _13=[];
|
||||
var _14=this._verticalSpace;
|
||||
if(_10){
|
||||
_10._wrapperWidget.set("selected",true);
|
||||
this._showChild(_10);
|
||||
if(this.doLayout&&_10.resize){
|
||||
_10.resize(this._containerContentBox);
|
||||
}
|
||||
var _15=_10.domNode;
|
||||
dojo.addClass(_15,"dijitVisible");
|
||||
dojo.removeClass(_15,"dijitHidden");
|
||||
if(_12){
|
||||
var _16=_15.style.overflow;
|
||||
_15.style.overflow="hidden";
|
||||
_13.push(dojo.animateProperty({node:_15,duration:this.duration,properties:{height:{start:1,end:this._getTargetHeight(_15)}},onEnd:function(){
|
||||
_15.style.overflow=_16;
|
||||
if(dojo.isIE){
|
||||
setTimeout(function(){
|
||||
dojo.removeClass(_15.parentNode,"dijitAccordionInnerContainerFocused");
|
||||
setTimeout(function(){
|
||||
dojo.addClass(_15.parentNode,"dijitAccordionInnerContainerFocused");
|
||||
},0);
|
||||
},0);
|
||||
}
|
||||
}}));
|
||||
}
|
||||
}
|
||||
if(_11){
|
||||
_11._wrapperWidget.set("selected",false);
|
||||
var _17=_11.domNode;
|
||||
if(_12){
|
||||
var _18=_17.style.overflow;
|
||||
_17.style.overflow="hidden";
|
||||
_13.push(dojo.animateProperty({node:_17,duration:this.duration,properties:{height:{start:this._getTargetHeight(_17),end:1}},onEnd:function(){
|
||||
dojo.addClass(_17,"dijitHidden");
|
||||
dojo.removeClass(_17,"dijitVisible");
|
||||
_17.style.overflow=_18;
|
||||
if(_11.onHide){
|
||||
_11.onHide();
|
||||
}
|
||||
}}));
|
||||
}else{
|
||||
dojo.addClass(_17,"dijitHidden");
|
||||
dojo.removeClass(_17,"dijitVisible");
|
||||
if(_11.onHide){
|
||||
_11.onHide();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_12){
|
||||
this._inTransition=true;
|
||||
var _19=dojo.fx.combine(_13);
|
||||
_19.onEnd=dojo.hitch(this,function(){
|
||||
delete this._inTransition;
|
||||
});
|
||||
_19.play();
|
||||
}
|
||||
},_onKeyPress:function(e,_1a){
|
||||
if(this._inTransition||this.disabled||e.altKey||!(_1a||e.ctrlKey)){
|
||||
if(this._inTransition){
|
||||
dojo.stopEvent(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var k=dojo.keys,c=e.charOrCode;
|
||||
if((_1a&&(c==k.LEFT_ARROW||c==k.UP_ARROW))||(e.ctrlKey&&c==k.PAGE_UP)){
|
||||
this._adjacent(false)._buttonWidget._onTitleClick();
|
||||
dojo.stopEvent(e);
|
||||
}else{
|
||||
if((_1a&&(c==k.RIGHT_ARROW||c==k.DOWN_ARROW))||(e.ctrlKey&&(c==k.PAGE_DOWN||c==k.TAB))){
|
||||
this._adjacent(true)._buttonWidget._onTitleClick();
|
||||
dojo.stopEvent(e);
|
||||
}
|
||||
}
|
||||
}});
|
||||
dojo.declare("dijit.layout._AccordionInnerContainer",[dijit._Widget,dijit._CssStateMixin],{baseClass:"dijitAccordionInnerContainer",isContainer:true,isLayoutContainer:true,buildRendering:function(){
|
||||
this.domNode=dojo.place("<div class='"+this.baseClass+"'>",this.contentWidget.domNode,"after");
|
||||
var _1b=this.contentWidget,cls=dojo.getObject(this.buttonWidget);
|
||||
this.button=_1b._buttonWidget=(new cls({contentWidget:_1b,label:_1b.title,title:_1b.tooltip,dir:_1b.dir,lang:_1b.lang,iconClass:_1b.iconClass,id:_1b.id+"_button",parent:this.parent})).placeAt(this.domNode);
|
||||
dojo.place(this.contentWidget.domNode,this.domNode);
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.connect(this.contentWidget,"set",function(_1c,_1d){
|
||||
var _1e={title:"label",tooltip:"title",iconClass:"iconClass"}[_1c];
|
||||
if(_1e){
|
||||
this.button.set(_1e,_1d);
|
||||
}
|
||||
},this);
|
||||
},_setSelectedAttr:function(_1f){
|
||||
this.selected=_1f;
|
||||
this.button.set("selected",_1f);
|
||||
if(_1f){
|
||||
var cw=this.contentWidget;
|
||||
if(cw.onSelected){
|
||||
cw.onSelected();
|
||||
}
|
||||
}
|
||||
},startup:function(){
|
||||
this.contentWidget.startup();
|
||||
},destroy:function(){
|
||||
this.button.destroyRecursive();
|
||||
delete this.contentWidget._buttonWidget;
|
||||
delete this.contentWidget._wrapperWidget;
|
||||
this.inherited(arguments);
|
||||
},destroyDescendants:function(){
|
||||
this.contentWidget.destroyRecursive();
|
||||
}});
|
||||
dojo.declare("dijit.layout._AccordionButton",[dijit._Widget,dijit._Templated,dijit._CssStateMixin],{templateString:dojo.cache("dijit.layout","templates/AccordionButton.html","<div dojoAttachEvent='onclick:_onTitleClick' class='dijitAccordionTitle'>\n\t<div dojoAttachPoint='titleNode,focusNode' dojoAttachEvent='onkeypress:_onTitleKeyPress'\n\t\t\tclass='dijitAccordionTitleFocus' wairole=\"tab\" waiState=\"expanded-false\"\n\t\t><span class='dijitInline dijitAccordionArrow' waiRole=\"presentation\"></span\n\t\t><span class='arrowTextUp' waiRole=\"presentation\">+</span\n\t\t><span class='arrowTextDown' waiRole=\"presentation\">-</span\n\t\t><img src=\"${_blankGif}\" alt=\"\" class=\"dijitIcon\" dojoAttachPoint='iconNode' style=\"vertical-align: middle\" waiRole=\"presentation\"/>\n\t\t<span waiRole=\"presentation\" dojoAttachPoint='titleTextNode' class='dijitAccordionText'></span>\n\t</div>\n</div>\n"),attributeMap:dojo.mixin(dojo.clone(dijit.layout.ContentPane.prototype.attributeMap),{label:{node:"titleTextNode",type:"innerHTML"},title:{node:"titleTextNode",type:"attribute",attribute:"title"},iconClass:{node:"iconNode",type:"class"}}),baseClass:"dijitAccordionTitle",getParent:function(){
|
||||
return this.parent;
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
dojo.setSelectable(this.domNode,false);
|
||||
var _20=dojo.attr(this.domNode,"id").replace(" ","_");
|
||||
dojo.attr(this.titleTextNode,"id",_20+"_title");
|
||||
dijit.setWaiState(this.focusNode,"labelledby",dojo.attr(this.titleTextNode,"id"));
|
||||
},getTitleHeight:function(){
|
||||
return dojo.marginBox(this.domNode).h;
|
||||
},_onTitleClick:function(){
|
||||
var _21=this.getParent();
|
||||
if(!_21._inTransition){
|
||||
_21.selectChild(this.contentWidget,true);
|
||||
dijit.focus(this.focusNode);
|
||||
}
|
||||
},_onTitleKeyPress:function(evt){
|
||||
return this.getParent()._onKeyPress(evt,this.contentWidget);
|
||||
},_setSelectedAttr:function(_22){
|
||||
this.selected=_22;
|
||||
dijit.setWaiState(this.focusNode,"expanded",_22);
|
||||
dijit.setWaiState(this.focusNode,"selected",_22);
|
||||
this.focusNode.setAttribute("tabIndex",_22?"0":"-1");
|
||||
}});
|
||||
}
|
||||
16
lib/dijit/layout/AccordionPane.js
Normal file
16
lib/dijit/layout/AccordionPane.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.AccordionPane"]){
|
||||
dojo._hasResource["dijit.layout.AccordionPane"]=true;
|
||||
dojo.provide("dijit.layout.AccordionPane");
|
||||
dojo.require("dijit.layout.ContentPane");
|
||||
dojo.declare("dijit.layout.AccordionPane",dijit.layout.ContentPane,{constructor:function(){
|
||||
dojo.deprecated("dijit.layout.AccordionPane deprecated, use ContentPane instead","","2.0");
|
||||
},onSelected:function(){
|
||||
}});
|
||||
}
|
||||
327
lib/dijit/layout/BorderContainer.js
Normal file
327
lib/dijit/layout/BorderContainer.js
Normal file
@@ -0,0 +1,327 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.BorderContainer"]){
|
||||
dojo._hasResource["dijit.layout.BorderContainer"]=true;
|
||||
dojo.provide("dijit.layout.BorderContainer");
|
||||
dojo.require("dijit.layout._LayoutWidget");
|
||||
dojo.require("dojo.cookie");
|
||||
dojo.declare("dijit.layout.BorderContainer",dijit.layout._LayoutWidget,{design:"headline",gutters:true,liveSplitters:true,persist:false,baseClass:"dijitBorderContainer",_splitterClass:"dijit.layout._Splitter",postMixInProperties:function(){
|
||||
if(!this.gutters){
|
||||
this.baseClass+="NoGutter";
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this._splitters={};
|
||||
this._splitterThickness={};
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
dojo.forEach(this.getChildren(),this._setupChild,this);
|
||||
this.inherited(arguments);
|
||||
},_setupChild:function(_1){
|
||||
var _2=_1.region;
|
||||
if(_2){
|
||||
this.inherited(arguments);
|
||||
dojo.addClass(_1.domNode,this.baseClass+"Pane");
|
||||
var _3=this.isLeftToRight();
|
||||
if(_2=="leading"){
|
||||
_2=_3?"left":"right";
|
||||
}
|
||||
if(_2=="trailing"){
|
||||
_2=_3?"right":"left";
|
||||
}
|
||||
this["_"+_2]=_1.domNode;
|
||||
this["_"+_2+"Widget"]=_1;
|
||||
if((_1.splitter||this.gutters)&&!this._splitters[_2]){
|
||||
var _4=dojo.getObject(_1.splitter?this._splitterClass:"dijit.layout._Gutter");
|
||||
var _5=new _4({id:_1.id+"_splitter",container:this,child:_1,region:_2,live:this.liveSplitters});
|
||||
_5.isSplitter=true;
|
||||
this._splitters[_2]=_5.domNode;
|
||||
dojo.place(this._splitters[_2],_1.domNode,"after");
|
||||
_5.startup();
|
||||
}
|
||||
_1.region=_2;
|
||||
}
|
||||
},_computeSplitterThickness:function(_6){
|
||||
this._splitterThickness[_6]=this._splitterThickness[_6]||dojo.marginBox(this._splitters[_6])[(/top|bottom/.test(_6)?"h":"w")];
|
||||
},layout:function(){
|
||||
for(var _7 in this._splitters){
|
||||
this._computeSplitterThickness(_7);
|
||||
}
|
||||
this._layoutChildren();
|
||||
},addChild:function(_8,_9){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
this.layout();
|
||||
}
|
||||
},removeChild:function(_a){
|
||||
var _b=_a.region;
|
||||
var _c=this._splitters[_b];
|
||||
if(_c){
|
||||
dijit.byNode(_c).destroy();
|
||||
delete this._splitters[_b];
|
||||
delete this._splitterThickness[_b];
|
||||
}
|
||||
this.inherited(arguments);
|
||||
delete this["_"+_b];
|
||||
delete this["_"+_b+"Widget"];
|
||||
if(this._started){
|
||||
this._layoutChildren();
|
||||
}
|
||||
dojo.removeClass(_a.domNode,this.baseClass+"Pane");
|
||||
},getChildren:function(){
|
||||
return dojo.filter(this.inherited(arguments),function(_d){
|
||||
return !_d.isSplitter;
|
||||
});
|
||||
},getSplitter:function(_e){
|
||||
var _f=this._splitters[_e];
|
||||
return _f?dijit.byNode(_f):null;
|
||||
},resize:function(_10,_11){
|
||||
if(!this.cs||!this.pe){
|
||||
var _12=this.domNode;
|
||||
this.cs=dojo.getComputedStyle(_12);
|
||||
this.pe=dojo._getPadExtents(_12,this.cs);
|
||||
this.pe.r=dojo._toPixelValue(_12,this.cs.paddingRight);
|
||||
this.pe.b=dojo._toPixelValue(_12,this.cs.paddingBottom);
|
||||
dojo.style(_12,"padding","0px");
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_layoutChildren:function(_13,_14){
|
||||
if(!this._borderBox||!this._borderBox.h){
|
||||
return;
|
||||
}
|
||||
var _15=(this.design=="sidebar");
|
||||
var _16=0,_17=0,_18=0,_19=0;
|
||||
var _1a={},_1b={},_1c={},_1d={},_1e=(this._center&&this._center.style)||{};
|
||||
var _1f=/left|right/.test(_13);
|
||||
var _20=!_13||(!_1f&&!_15);
|
||||
var _21=!_13||(_1f&&_15);
|
||||
if(this._top){
|
||||
_1a=(_13=="top"||_21)&&this._top.style;
|
||||
_16=_13=="top"?_14:dojo.marginBox(this._top).h;
|
||||
}
|
||||
if(this._left){
|
||||
_1b=(_13=="left"||_20)&&this._left.style;
|
||||
_18=_13=="left"?_14:dojo.marginBox(this._left).w;
|
||||
}
|
||||
if(this._right){
|
||||
_1c=(_13=="right"||_20)&&this._right.style;
|
||||
_19=_13=="right"?_14:dojo.marginBox(this._right).w;
|
||||
}
|
||||
if(this._bottom){
|
||||
_1d=(_13=="bottom"||_21)&&this._bottom.style;
|
||||
_17=_13=="bottom"?_14:dojo.marginBox(this._bottom).h;
|
||||
}
|
||||
var _22=this._splitters;
|
||||
var _23=_22.top,_24=_22.bottom,_25=_22.left,_26=_22.right;
|
||||
var _27=this._splitterThickness;
|
||||
var _28=_27.top||0,_29=_27.left||0,_2a=_27.right||0,_2b=_27.bottom||0;
|
||||
if(_29>50||_2a>50){
|
||||
setTimeout(dojo.hitch(this,function(){
|
||||
this._splitterThickness={};
|
||||
for(var _2c in this._splitters){
|
||||
this._computeSplitterThickness(_2c);
|
||||
}
|
||||
this._layoutChildren();
|
||||
}),50);
|
||||
return false;
|
||||
}
|
||||
var pe=this.pe;
|
||||
var _2d={left:(_15?_18+_29:0)+pe.l+"px",right:(_15?_19+_2a:0)+pe.r+"px"};
|
||||
if(_23){
|
||||
dojo.mixin(_23.style,_2d);
|
||||
_23.style.top=_16+pe.t+"px";
|
||||
}
|
||||
if(_24){
|
||||
dojo.mixin(_24.style,_2d);
|
||||
_24.style.bottom=_17+pe.b+"px";
|
||||
}
|
||||
_2d={top:(_15?0:_16+_28)+pe.t+"px",bottom:(_15?0:_17+_2b)+pe.b+"px"};
|
||||
if(_25){
|
||||
dojo.mixin(_25.style,_2d);
|
||||
_25.style.left=_18+pe.l+"px";
|
||||
}
|
||||
if(_26){
|
||||
dojo.mixin(_26.style,_2d);
|
||||
_26.style.right=_19+pe.r+"px";
|
||||
}
|
||||
dojo.mixin(_1e,{top:pe.t+_16+_28+"px",left:pe.l+_18+_29+"px",right:pe.r+_19+_2a+"px",bottom:pe.b+_17+_2b+"px"});
|
||||
var _2e={top:_15?pe.t+"px":_1e.top,bottom:_15?pe.b+"px":_1e.bottom};
|
||||
dojo.mixin(_1b,_2e);
|
||||
dojo.mixin(_1c,_2e);
|
||||
_1b.left=pe.l+"px";
|
||||
_1c.right=pe.r+"px";
|
||||
_1a.top=pe.t+"px";
|
||||
_1d.bottom=pe.b+"px";
|
||||
if(_15){
|
||||
_1a.left=_1d.left=_18+_29+pe.l+"px";
|
||||
_1a.right=_1d.right=_19+_2a+pe.r+"px";
|
||||
}else{
|
||||
_1a.left=_1d.left=pe.l+"px";
|
||||
_1a.right=_1d.right=pe.r+"px";
|
||||
}
|
||||
var _2f=this._borderBox.h-pe.t-pe.b,_30=_2f-(_16+_28+_17+_2b),_31=_15?_2f:_30;
|
||||
var _32=this._borderBox.w-pe.l-pe.r,_33=_32-(_18+_29+_19+_2a),_34=_15?_33:_32;
|
||||
var dim={top:{w:_34,h:_16},bottom:{w:_34,h:_17},left:{w:_18,h:_31},right:{w:_19,h:_31},center:{h:_30,w:_33}};
|
||||
if(_13){
|
||||
var _35=this["_"+_13+"Widget"],mb={};
|
||||
mb[/top|bottom/.test(_13)?"h":"w"]=_14;
|
||||
_35.resize?_35.resize(mb,dim[_35.region]):dojo.marginBox(_35.domNode,mb);
|
||||
}
|
||||
var _36=dojo.isIE<8||(dojo.isIE&&dojo.isQuirks)||dojo.some(this.getChildren(),function(_37){
|
||||
return _37.domNode.tagName=="TEXTAREA"||_37.domNode.tagName=="INPUT";
|
||||
});
|
||||
if(_36){
|
||||
var _38=function(_39,_3a,_3b){
|
||||
if(_39){
|
||||
(_39.resize?_39.resize(_3a,_3b):dojo.marginBox(_39.domNode,_3a));
|
||||
}
|
||||
};
|
||||
if(_25){
|
||||
_25.style.height=_31;
|
||||
}
|
||||
if(_26){
|
||||
_26.style.height=_31;
|
||||
}
|
||||
_38(this._leftWidget,{h:_31},dim.left);
|
||||
_38(this._rightWidget,{h:_31},dim.right);
|
||||
if(_23){
|
||||
_23.style.width=_34;
|
||||
}
|
||||
if(_24){
|
||||
_24.style.width=_34;
|
||||
}
|
||||
_38(this._topWidget,{w:_34},dim.top);
|
||||
_38(this._bottomWidget,{w:_34},dim.bottom);
|
||||
_38(this._centerWidget,dim.center);
|
||||
}else{
|
||||
var _3c=!_13||(/top|bottom/.test(_13)&&this.design!="sidebar"),_3d=!_13||(/left|right/.test(_13)&&this.design=="sidebar"),_3e={center:true,left:_3c,right:_3c,top:_3d,bottom:_3d};
|
||||
dojo.forEach(this.getChildren(),function(_3f){
|
||||
if(_3f.resize&&_3e[_3f.region]){
|
||||
_3f.resize(null,dim[_3f.region]);
|
||||
}
|
||||
},this);
|
||||
}
|
||||
},destroy:function(){
|
||||
for(var _40 in this._splitters){
|
||||
var _41=this._splitters[_40];
|
||||
dijit.byNode(_41).destroy();
|
||||
dojo.destroy(_41);
|
||||
}
|
||||
delete this._splitters;
|
||||
delete this._splitterThickness;
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
dojo.extend(dijit._Widget,{region:"",splitter:false,minSize:0,maxSize:Infinity});
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.declare("dijit.layout._Splitter",[dijit._Widget,dijit._Templated],{live:true,templateString:"<div class=\"dijitSplitter\" dojoAttachEvent=\"onkeypress:_onKeyPress,onmousedown:_startDrag,onmouseenter:_onMouse,onmouseleave:_onMouse\" tabIndex=\"0\" waiRole=\"separator\"><div class=\"dijitSplitterThumb\"></div></div>",postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.horizontal=/top|bottom/.test(this.region);
|
||||
dojo.addClass(this.domNode,"dijitSplitter"+(this.horizontal?"H":"V"));
|
||||
this._factor=/top|left/.test(this.region)?1:-1;
|
||||
this._cookieName=this.container.id+"_"+this.region;
|
||||
if(this.container.persist){
|
||||
var _42=dojo.cookie(this._cookieName);
|
||||
if(_42){
|
||||
this.child.domNode.style[this.horizontal?"height":"width"]=_42;
|
||||
}
|
||||
}
|
||||
},_computeMaxSize:function(){
|
||||
var dim=this.horizontal?"h":"w",_43=this.container._splitterThickness[this.region];
|
||||
var _44={left:"right",right:"left",top:"bottom",bottom:"top",leading:"trailing",trailing:"leading"},_45=this.container["_"+_44[this.region]];
|
||||
var _46=dojo.contentBox(this.container.domNode)[dim]-(_45?dojo.marginBox(_45)[dim]:0)-20-_43*2;
|
||||
return Math.min(this.child.maxSize,_46);
|
||||
},_startDrag:function(e){
|
||||
if(!this.cover){
|
||||
this.cover=dojo.doc.createElement("div");
|
||||
dojo.addClass(this.cover,"dijitSplitterCover");
|
||||
dojo.place(this.cover,this.child.domNode,"after");
|
||||
}
|
||||
dojo.addClass(this.cover,"dijitSplitterCoverActive");
|
||||
if(this.fake){
|
||||
dojo.destroy(this.fake);
|
||||
}
|
||||
if(!(this._resize=this.live)){
|
||||
(this.fake=this.domNode.cloneNode(true)).removeAttribute("id");
|
||||
dojo.addClass(this.domNode,"dijitSplitterShadow");
|
||||
dojo.place(this.fake,this.domNode,"after");
|
||||
}
|
||||
dojo.addClass(this.domNode,"dijitSplitterActive");
|
||||
dojo.addClass(this.domNode,"dijitSplitter"+(this.horizontal?"H":"V")+"Active");
|
||||
if(this.fake){
|
||||
dojo.removeClass(this.fake,"dijitSplitterHover");
|
||||
dojo.removeClass(this.fake,"dijitSplitter"+(this.horizontal?"H":"V")+"Hover");
|
||||
}
|
||||
var _47=this._factor,max=this._computeMaxSize(),min=this.child.minSize||20,_48=this.horizontal,_49=_48?"pageY":"pageX",_4a=e[_49],_4b=this.domNode.style,dim=_48?"h":"w",_4c=dojo.marginBox(this.child.domNode)[dim],_4d=this.region,_4e=parseInt(this.domNode.style[_4d],10),_4f=this._resize,_50=this.child.domNode,_51=dojo.hitch(this.container,this.container._layoutChildren),de=dojo.doc;
|
||||
this._handlers=(this._handlers||[]).concat([dojo.connect(de,"onmousemove",this._drag=function(e,_52){
|
||||
var _53=e[_49]-_4a,_54=_47*_53+_4c,_55=Math.max(Math.min(_54,max),min);
|
||||
if(_4f||_52){
|
||||
_51(_4d,_55);
|
||||
}
|
||||
_4b[_4d]=_47*_53+_4e+(_55-_54)+"px";
|
||||
}),dojo.connect(de,"ondragstart",dojo.stopEvent),dojo.connect(dojo.body(),"onselectstart",dojo.stopEvent),dojo.connect(de,"onmouseup",this,"_stopDrag")]);
|
||||
dojo.stopEvent(e);
|
||||
},_onMouse:function(e){
|
||||
var o=(e.type=="mouseover"||e.type=="mouseenter");
|
||||
dojo.toggleClass(this.domNode,"dijitSplitterHover",o);
|
||||
dojo.toggleClass(this.domNode,"dijitSplitter"+(this.horizontal?"H":"V")+"Hover",o);
|
||||
},_stopDrag:function(e){
|
||||
try{
|
||||
if(this.cover){
|
||||
dojo.removeClass(this.cover,"dijitSplitterCoverActive");
|
||||
}
|
||||
if(this.fake){
|
||||
dojo.destroy(this.fake);
|
||||
}
|
||||
dojo.removeClass(this.domNode,"dijitSplitterActive");
|
||||
dojo.removeClass(this.domNode,"dijitSplitter"+(this.horizontal?"H":"V")+"Active");
|
||||
dojo.removeClass(this.domNode,"dijitSplitterShadow");
|
||||
this._drag(e);
|
||||
this._drag(e,true);
|
||||
}
|
||||
finally{
|
||||
this._cleanupHandlers();
|
||||
delete this._drag;
|
||||
}
|
||||
if(this.container.persist){
|
||||
dojo.cookie(this._cookieName,this.child.domNode.style[this.horizontal?"height":"width"],{expires:365});
|
||||
}
|
||||
},_cleanupHandlers:function(){
|
||||
dojo.forEach(this._handlers,dojo.disconnect);
|
||||
delete this._handlers;
|
||||
},_onKeyPress:function(e){
|
||||
this._resize=true;
|
||||
var _56=this.horizontal;
|
||||
var _57=1;
|
||||
var dk=dojo.keys;
|
||||
switch(e.charOrCode){
|
||||
case _56?dk.UP_ARROW:dk.LEFT_ARROW:
|
||||
_57*=-1;
|
||||
case _56?dk.DOWN_ARROW:dk.RIGHT_ARROW:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
var _58=dojo.marginBox(this.child.domNode)[_56?"h":"w"]+this._factor*_57;
|
||||
this.container._layoutChildren(this.region,Math.max(Math.min(_58,this._computeMaxSize()),this.child.minSize));
|
||||
dojo.stopEvent(e);
|
||||
},destroy:function(){
|
||||
this._cleanupHandlers();
|
||||
delete this.child;
|
||||
delete this.container;
|
||||
delete this.cover;
|
||||
delete this.fake;
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
dojo.declare("dijit.layout._Gutter",[dijit._Widget,dijit._Templated],{templateString:"<div class=\"dijitGutter\" waiRole=\"presentation\"></div>",postCreate:function(){
|
||||
this.horizontal=/top|bottom/.test(this.region);
|
||||
dojo.addClass(this.domNode,"dijitGutter"+(this.horizontal?"H":"V"));
|
||||
}});
|
||||
}
|
||||
291
lib/dijit/layout/ContentPane.js
Normal file
291
lib/dijit/layout/ContentPane.js
Normal file
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.ContentPane"]){
|
||||
dojo._hasResource["dijit.layout.ContentPane"]=true;
|
||||
dojo.provide("dijit.layout.ContentPane");
|
||||
dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._Contained");
|
||||
dojo.require("dijit.layout._LayoutWidget");
|
||||
dojo.require("dojo.parser");
|
||||
dojo.require("dojo.string");
|
||||
dojo.require("dojo.html");
|
||||
dojo.requireLocalization("dijit","loading",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");
|
||||
dojo.declare("dijit.layout.ContentPane",dijit._Widget,{href:"",extractContent:false,parseOnLoad:true,preventCache:false,preload:false,refreshOnShow:false,loadingMessage:"<span class='dijitContentPaneLoading'>${loadingState}</span>",errorMessage:"<span class='dijitContentPaneError'>${errorState}</span>",isLoaded:false,baseClass:"dijitContentPane",doLayout:true,ioArgs:{},isContainer:true,isLayoutContainer:true,onLoadDeferred:null,attributeMap:dojo.delegate(dijit._Widget.prototype.attributeMap,{title:[]}),postMixInProperties:function(){
|
||||
this.inherited(arguments);
|
||||
var _1=dojo.i18n.getLocalization("dijit","loading",this.lang);
|
||||
this.loadingMessage=dojo.string.substitute(this.loadingMessage,_1);
|
||||
this.errorMessage=dojo.string.substitute(this.errorMessage,_1);
|
||||
if(!this.href&&this.srcNodeRef&&this.srcNodeRef.innerHTML){
|
||||
this.isLoaded=true;
|
||||
}
|
||||
},buildRendering:function(){
|
||||
this.inherited(arguments);
|
||||
if(!this.containerNode){
|
||||
this.containerNode=this.domNode;
|
||||
}
|
||||
},postCreate:function(){
|
||||
this.domNode.title="";
|
||||
if(!dojo.attr(this.domNode,"role")){
|
||||
dijit.setWaiRole(this.domNode,"group");
|
||||
}
|
||||
dojo.addClass(this.domNode,this.baseClass);
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
var _2=dijit._Contained.prototype.getParent.call(this);
|
||||
this._childOfLayoutWidget=_2&&_2.isLayoutContainer;
|
||||
this._needLayout=!this._childOfLayoutWidget;
|
||||
if(this.isLoaded){
|
||||
dojo.forEach(this.getChildren(),function(_3){
|
||||
_3.startup();
|
||||
});
|
||||
}
|
||||
if(this._isShown()||this.preload){
|
||||
this._onShow();
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_checkIfSingleChild:function(){
|
||||
var _4=dojo.query("> *",this.containerNode).filter(function(_5){
|
||||
return _5.tagName!=="SCRIPT";
|
||||
}),_6=_4.filter(function(_7){
|
||||
return dojo.hasAttr(_7,"dojoType")||dojo.hasAttr(_7,"widgetId");
|
||||
}),_8=dojo.filter(_6.map(dijit.byNode),function(_9){
|
||||
return _9&&_9.domNode&&_9.resize;
|
||||
});
|
||||
if(_4.length==_6.length&&_8.length==1){
|
||||
this._singleChild=_8[0];
|
||||
}else{
|
||||
delete this._singleChild;
|
||||
}
|
||||
dojo.toggleClass(this.containerNode,this.baseClass+"SingleChild",!!this._singleChild);
|
||||
},setHref:function(_a){
|
||||
dojo.deprecated("dijit.layout.ContentPane.setHref() is deprecated. Use set('href', ...) instead.","","2.0");
|
||||
return this.set("href",_a);
|
||||
},_setHrefAttr:function(_b){
|
||||
this.cancel();
|
||||
this.onLoadDeferred=new dojo.Deferred(dojo.hitch(this,"cancel"));
|
||||
this.href=_b;
|
||||
if(this._created&&(this.preload||this._isShown())){
|
||||
this._load();
|
||||
}else{
|
||||
this._hrefChanged=true;
|
||||
}
|
||||
return this.onLoadDeferred;
|
||||
},setContent:function(_c){
|
||||
dojo.deprecated("dijit.layout.ContentPane.setContent() is deprecated. Use set('content', ...) instead.","","2.0");
|
||||
this.set("content",_c);
|
||||
},_setContentAttr:function(_d){
|
||||
this.href="";
|
||||
this.cancel();
|
||||
this.onLoadDeferred=new dojo.Deferred(dojo.hitch(this,"cancel"));
|
||||
this._setContent(_d||"");
|
||||
this._isDownloaded=false;
|
||||
return this.onLoadDeferred;
|
||||
},_getContentAttr:function(){
|
||||
return this.containerNode.innerHTML;
|
||||
},cancel:function(){
|
||||
if(this._xhrDfd&&(this._xhrDfd.fired==-1)){
|
||||
this._xhrDfd.cancel();
|
||||
}
|
||||
delete this._xhrDfd;
|
||||
this.onLoadDeferred=null;
|
||||
},uninitialize:function(){
|
||||
if(this._beingDestroyed){
|
||||
this.cancel();
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},destroyRecursive:function(_e){
|
||||
if(this._beingDestroyed){
|
||||
return;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},resize:function(_f,_10){
|
||||
if(!this._wasShown){
|
||||
this._onShow();
|
||||
}
|
||||
this._resizeCalled=true;
|
||||
if(_f){
|
||||
dojo.marginBox(this.domNode,_f);
|
||||
}
|
||||
var cn=this.containerNode;
|
||||
if(cn===this.domNode){
|
||||
var mb=_10||{};
|
||||
dojo.mixin(mb,_f||{});
|
||||
if(!("h" in mb)||!("w" in mb)){
|
||||
mb=dojo.mixin(dojo.marginBox(cn),mb);
|
||||
}
|
||||
this._contentBox=dijit.layout.marginBox2contentBox(cn,mb);
|
||||
}else{
|
||||
this._contentBox=dojo.contentBox(cn);
|
||||
}
|
||||
this._layoutChildren();
|
||||
},_isShown:function(){
|
||||
if(this._childOfLayoutWidget){
|
||||
if(this._resizeCalled&&"open" in this){
|
||||
return this.open;
|
||||
}
|
||||
return this._resizeCalled;
|
||||
}else{
|
||||
if("open" in this){
|
||||
return this.open;
|
||||
}else{
|
||||
var _11=this.domNode;
|
||||
return (_11.style.display!="none")&&(_11.style.visibility!="hidden")&&!dojo.hasClass(_11,"dijitHidden");
|
||||
}
|
||||
}
|
||||
},_onShow:function(){
|
||||
if(this.href){
|
||||
if(!this._xhrDfd&&(!this.isLoaded||this._hrefChanged||this.refreshOnShow)){
|
||||
this.refresh();
|
||||
}
|
||||
}else{
|
||||
if(!this._childOfLayoutWidget&&this._needLayout){
|
||||
this._layoutChildren();
|
||||
}
|
||||
}
|
||||
this.inherited(arguments);
|
||||
this._wasShown=true;
|
||||
},refresh:function(){
|
||||
this.cancel();
|
||||
this.onLoadDeferred=new dojo.Deferred(dojo.hitch(this,"cancel"));
|
||||
this._load();
|
||||
return this.onLoadDeferred;
|
||||
},_load:function(){
|
||||
this._setContent(this.onDownloadStart(),true);
|
||||
var _12=this;
|
||||
var _13={preventCache:(this.preventCache||this.refreshOnShow),url:this.href,handleAs:"text"};
|
||||
if(dojo.isObject(this.ioArgs)){
|
||||
dojo.mixin(_13,this.ioArgs);
|
||||
}
|
||||
var _14=(this._xhrDfd=(this.ioMethod||dojo.xhrGet)(_13));
|
||||
_14.addCallback(function(_15){
|
||||
try{
|
||||
_12._isDownloaded=true;
|
||||
_12._setContent(_15,false);
|
||||
_12.onDownloadEnd();
|
||||
}
|
||||
catch(err){
|
||||
_12._onError("Content",err);
|
||||
}
|
||||
delete _12._xhrDfd;
|
||||
return _15;
|
||||
});
|
||||
_14.addErrback(function(err){
|
||||
if(!_14.canceled){
|
||||
_12._onError("Download",err);
|
||||
}
|
||||
delete _12._xhrDfd;
|
||||
return err;
|
||||
});
|
||||
delete this._hrefChanged;
|
||||
},_onLoadHandler:function(_16){
|
||||
this.isLoaded=true;
|
||||
try{
|
||||
this.onLoadDeferred.callback(_16);
|
||||
this.onLoad(_16);
|
||||
}
|
||||
catch(e){
|
||||
console.error("Error "+this.widgetId+" running custom onLoad code: "+e.message);
|
||||
}
|
||||
},_onUnloadHandler:function(){
|
||||
this.isLoaded=false;
|
||||
try{
|
||||
this.onUnload();
|
||||
}
|
||||
catch(e){
|
||||
console.error("Error "+this.widgetId+" running custom onUnload code: "+e.message);
|
||||
}
|
||||
},destroyDescendants:function(){
|
||||
if(this.isLoaded){
|
||||
this._onUnloadHandler();
|
||||
}
|
||||
var _17=this._contentSetter;
|
||||
dojo.forEach(this.getChildren(),function(_18){
|
||||
if(_18.destroyRecursive){
|
||||
_18.destroyRecursive();
|
||||
}
|
||||
});
|
||||
if(_17){
|
||||
dojo.forEach(_17.parseResults,function(_19){
|
||||
if(_19.destroyRecursive&&_19.domNode&&_19.domNode.parentNode==dojo.body()){
|
||||
_19.destroyRecursive();
|
||||
}
|
||||
});
|
||||
delete _17.parseResults;
|
||||
}
|
||||
dojo.html._emptyNode(this.containerNode);
|
||||
delete this._singleChild;
|
||||
},_setContent:function(_1a,_1b){
|
||||
this.destroyDescendants();
|
||||
var _1c=this._contentSetter;
|
||||
if(!(_1c&&_1c instanceof dojo.html._ContentSetter)){
|
||||
_1c=this._contentSetter=new dojo.html._ContentSetter({node:this.containerNode,_onError:dojo.hitch(this,this._onError),onContentError:dojo.hitch(this,function(e){
|
||||
var _1d=this.onContentError(e);
|
||||
try{
|
||||
this.containerNode.innerHTML=_1d;
|
||||
}
|
||||
catch(e){
|
||||
console.error("Fatal "+this.id+" could not change content due to "+e.message,e);
|
||||
}
|
||||
})});
|
||||
}
|
||||
var _1e=dojo.mixin({cleanContent:this.cleanContent,extractContent:this.extractContent,parseContent:this.parseOnLoad,dir:this.dir,lang:this.lang},this._contentSetterParams||{});
|
||||
dojo.mixin(_1c,_1e);
|
||||
_1c.set((dojo.isObject(_1a)&&_1a.domNode)?_1a.domNode:_1a);
|
||||
delete this._contentSetterParams;
|
||||
if(!_1b){
|
||||
dojo.forEach(this.getChildren(),function(_1f){
|
||||
if(!this.parseOnLoad||_1f.getParent){
|
||||
_1f.startup();
|
||||
}
|
||||
},this);
|
||||
this._scheduleLayout();
|
||||
this._onLoadHandler(_1a);
|
||||
}
|
||||
},_onError:function(_20,err,_21){
|
||||
this.onLoadDeferred.errback(err);
|
||||
var _22=this["on"+_20+"Error"].call(this,err);
|
||||
if(_21){
|
||||
console.error(_21,err);
|
||||
}else{
|
||||
if(_22){
|
||||
this._setContent(_22,true);
|
||||
}
|
||||
}
|
||||
},_scheduleLayout:function(){
|
||||
if(this._isShown()){
|
||||
this._layoutChildren();
|
||||
}else{
|
||||
this._needLayout=true;
|
||||
}
|
||||
},_layoutChildren:function(){
|
||||
if(this.doLayout){
|
||||
this._checkIfSingleChild();
|
||||
}
|
||||
if(this._singleChild&&this._singleChild.resize){
|
||||
var cb=this._contentBox||dojo.contentBox(this.containerNode);
|
||||
this._singleChild.resize({w:cb.w,h:cb.h});
|
||||
}else{
|
||||
dojo.forEach(this.getChildren(),function(_23){
|
||||
if(_23.resize){
|
||||
_23.resize();
|
||||
}
|
||||
});
|
||||
}
|
||||
delete this._needLayout;
|
||||
},onLoad:function(_24){
|
||||
},onUnload:function(){
|
||||
},onDownloadStart:function(){
|
||||
return this.loadingMessage;
|
||||
},onContentError:function(_25){
|
||||
},onDownloadError:function(_26){
|
||||
return this.errorMessage;
|
||||
},onDownloadEnd:function(){
|
||||
}});
|
||||
}
|
||||
28
lib/dijit/layout/LayoutContainer.js
Normal file
28
lib/dijit/layout/LayoutContainer.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.LayoutContainer"]){
|
||||
dojo._hasResource["dijit.layout.LayoutContainer"]=true;
|
||||
dojo.provide("dijit.layout.LayoutContainer");
|
||||
dojo.require("dijit.layout._LayoutWidget");
|
||||
dojo.declare("dijit.layout.LayoutContainer",dijit.layout._LayoutWidget,{baseClass:"dijitLayoutContainer",constructor:function(){
|
||||
dojo.deprecated("dijit.layout.LayoutContainer is deprecated","use BorderContainer instead",2);
|
||||
},layout:function(){
|
||||
dijit.layout.layoutChildren(this.domNode,this._contentBox,this.getChildren());
|
||||
},addChild:function(_1,_2){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
dijit.layout.layoutChildren(this.domNode,this._contentBox,this.getChildren());
|
||||
}
|
||||
},removeChild:function(_3){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
dijit.layout.layoutChildren(this.domNode,this._contentBox,this.getChildren());
|
||||
}
|
||||
}});
|
||||
dojo.extend(dijit._Widget,{layoutAlign:"none"});
|
||||
}
|
||||
20
lib/dijit/layout/LinkPane.js
Normal file
20
lib/dijit/layout/LinkPane.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.LinkPane"]){
|
||||
dojo._hasResource["dijit.layout.LinkPane"]=true;
|
||||
dojo.provide("dijit.layout.LinkPane");
|
||||
dojo.require("dijit.layout.ContentPane");
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.declare("dijit.layout.LinkPane",[dijit.layout.ContentPane,dijit._Templated],{templateString:"<div class=\"dijitLinkPane\" dojoAttachPoint=\"containerNode\"></div>",postMixInProperties:function(){
|
||||
if(this.srcNodeRef){
|
||||
this.title+=this.srcNodeRef.innerHTML;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_fillContent:function(_1){
|
||||
}});
|
||||
}
|
||||
199
lib/dijit/layout/ScrollingTabController.js
Normal file
199
lib/dijit/layout/ScrollingTabController.js
Normal file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.ScrollingTabController"]){
|
||||
dojo._hasResource["dijit.layout.ScrollingTabController"]=true;
|
||||
dojo.provide("dijit.layout.ScrollingTabController");
|
||||
dojo.require("dijit.layout.TabController");
|
||||
dojo.require("dijit.Menu");
|
||||
dojo.declare("dijit.layout.ScrollingTabController",dijit.layout.TabController,{templateString:dojo.cache("dijit.layout","templates/ScrollingTabController.html","<div class=\"dijitTabListContainer-${tabPosition}\" style=\"visibility:hidden\">\n\t<div dojoType=\"dijit.layout._ScrollingTabControllerButton\"\n\t\t\tclass=\"tabStripButton-${tabPosition}\"\n\t\t\tid=\"${id}_menuBtn\" iconClass=\"dijitTabStripMenuIcon\"\n\t\t\tdojoAttachPoint=\"_menuBtn\" showLabel=false>▼</div>\n\t<div dojoType=\"dijit.layout._ScrollingTabControllerButton\"\n\t\t\tclass=\"tabStripButton-${tabPosition}\"\n\t\t\tid=\"${id}_leftBtn\" iconClass=\"dijitTabStripSlideLeftIcon\"\n\t\t\tdojoAttachPoint=\"_leftBtn\" dojoAttachEvent=\"onClick: doSlideLeft\" showLabel=false>◀</div>\n\t<div dojoType=\"dijit.layout._ScrollingTabControllerButton\"\n\t\t\tclass=\"tabStripButton-${tabPosition}\"\n\t\t\tid=\"${id}_rightBtn\" iconClass=\"dijitTabStripSlideRightIcon\"\n\t\t\tdojoAttachPoint=\"_rightBtn\" dojoAttachEvent=\"onClick: doSlideRight\" showLabel=false>▶</div>\n\t<div class='dijitTabListWrapper' dojoAttachPoint='tablistWrapper'>\n\t\t<div wairole='tablist' dojoAttachEvent='onkeypress:onkeypress'\n\t\t\t\tdojoAttachPoint='containerNode' class='nowrapTabStrip'></div>\n\t</div>\n</div>\n"),useMenu:true,useSlider:true,tabStripClass:"",widgetsInTemplate:true,_minScroll:5,attributeMap:dojo.delegate(dijit._Widget.prototype.attributeMap,{"class":"containerNode"}),postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
var n=this.domNode;
|
||||
this.scrollNode=this.tablistWrapper;
|
||||
this._initButtons();
|
||||
if(!this.tabStripClass){
|
||||
this.tabStripClass="dijitTabContainer"+this.tabPosition.charAt(0).toUpperCase()+this.tabPosition.substr(1).replace(/-.*/,"")+"None";
|
||||
dojo.addClass(n,"tabStrip-disabled");
|
||||
}
|
||||
dojo.addClass(this.tablistWrapper,this.tabStripClass);
|
||||
},onStartup:function(){
|
||||
this.inherited(arguments);
|
||||
dojo.style(this.domNode,"visibility","visible");
|
||||
this._postStartup=true;
|
||||
},onAddChild:function(_1,_2){
|
||||
this.inherited(arguments);
|
||||
var _3;
|
||||
if(this.useMenu){
|
||||
var _4=this.containerId;
|
||||
_3=new dijit.MenuItem({id:_1.id+"_stcMi",label:_1.title,dir:_1.dir,lang:_1.lang,onClick:dojo.hitch(this,function(){
|
||||
var _5=dijit.byId(_4);
|
||||
_5.selectChild(_1);
|
||||
})});
|
||||
this._menuChildren[_1.id]=_3;
|
||||
this._menu.addChild(_3,_2);
|
||||
}
|
||||
this.pane2handles[_1.id].push(this.connect(this.pane2button[_1.id],"set",function(_6,_7){
|
||||
if(this._postStartup){
|
||||
if(_6=="label"){
|
||||
if(_3){
|
||||
_3.set(_6,_7);
|
||||
}
|
||||
if(this._dim){
|
||||
this.resize(this._dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
dojo.style(this.containerNode,"width",(dojo.style(this.containerNode,"width")+200)+"px");
|
||||
},onRemoveChild:function(_8,_9){
|
||||
var _a=this.pane2button[_8.id];
|
||||
if(this._selectedTab===_a.domNode){
|
||||
this._selectedTab=null;
|
||||
}
|
||||
if(this.useMenu&&_8&&_8.id&&this._menuChildren[_8.id]){
|
||||
this._menu.removeChild(this._menuChildren[_8.id]);
|
||||
this._menuChildren[_8.id].destroy();
|
||||
delete this._menuChildren[_8.id];
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_initButtons:function(){
|
||||
this._menuChildren={};
|
||||
this._btnWidth=0;
|
||||
this._buttons=dojo.query("> .tabStripButton",this.domNode).filter(function(_b){
|
||||
if((this.useMenu&&_b==this._menuBtn.domNode)||(this.useSlider&&(_b==this._rightBtn.domNode||_b==this._leftBtn.domNode))){
|
||||
this._btnWidth+=dojo.marginBox(_b).w;
|
||||
return true;
|
||||
}else{
|
||||
dojo.style(_b,"display","none");
|
||||
return false;
|
||||
}
|
||||
},this);
|
||||
if(this.useMenu){
|
||||
this._menu=new dijit.Menu({id:this.id+"_menu",dir:this.dir,lang:this.lang,targetNodeIds:[this._menuBtn.domNode],leftClickToOpen:true,refocus:false});
|
||||
this._supportingWidgets.push(this._menu);
|
||||
}
|
||||
},_getTabsWidth:function(){
|
||||
var _c=this.getChildren();
|
||||
if(_c.length){
|
||||
var _d=_c[this.isLeftToRight()?0:_c.length-1].domNode,_e=_c[this.isLeftToRight()?_c.length-1:0].domNode;
|
||||
return _e.offsetLeft+dojo.style(_e,"width")-_d.offsetLeft;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
},_enableBtn:function(_f){
|
||||
var _10=this._getTabsWidth();
|
||||
_f=_f||dojo.style(this.scrollNode,"width");
|
||||
return _10>0&&_f<_10;
|
||||
},resize:function(dim){
|
||||
if(this.domNode.offsetWidth==0){
|
||||
return;
|
||||
}
|
||||
this._dim=dim;
|
||||
this.scrollNode.style.height="auto";
|
||||
this._contentBox=dijit.layout.marginBox2contentBox(this.domNode,{h:0,w:dim.w});
|
||||
this._contentBox.h=this.scrollNode.offsetHeight;
|
||||
dojo.contentBox(this.domNode,this._contentBox);
|
||||
var _11=this._enableBtn(this._contentBox.w);
|
||||
this._buttons.style("display",_11?"":"none");
|
||||
this._leftBtn.layoutAlign="left";
|
||||
this._rightBtn.layoutAlign="right";
|
||||
this._menuBtn.layoutAlign=this.isLeftToRight()?"right":"left";
|
||||
dijit.layout.layoutChildren(this.domNode,this._contentBox,[this._menuBtn,this._leftBtn,this._rightBtn,{domNode:this.scrollNode,layoutAlign:"client"}]);
|
||||
if(this._selectedTab){
|
||||
if(this._anim&&this._anim.status()=="playing"){
|
||||
this._anim.stop();
|
||||
}
|
||||
var w=this.scrollNode,sl=this._convertToScrollLeft(this._getScrollForSelectedTab());
|
||||
w.scrollLeft=sl;
|
||||
}
|
||||
this._setButtonClass(this._getScroll());
|
||||
this._postResize=true;
|
||||
},_getScroll:function(){
|
||||
var sl=(this.isLeftToRight()||dojo.isIE<8||(dojo.isIE&&dojo.isQuirks)||dojo.isWebKit)?this.scrollNode.scrollLeft:dojo.style(this.containerNode,"width")-dojo.style(this.scrollNode,"width")+(dojo.isIE==8?-1:1)*this.scrollNode.scrollLeft;
|
||||
return sl;
|
||||
},_convertToScrollLeft:function(val){
|
||||
if(this.isLeftToRight()||dojo.isIE<8||(dojo.isIE&&dojo.isQuirks)||dojo.isWebKit){
|
||||
return val;
|
||||
}else{
|
||||
var _12=dojo.style(this.containerNode,"width")-dojo.style(this.scrollNode,"width");
|
||||
return (dojo.isIE==8?-1:1)*(val-_12);
|
||||
}
|
||||
},onSelectChild:function(_13){
|
||||
var tab=this.pane2button[_13.id];
|
||||
if(!tab||!_13){
|
||||
return;
|
||||
}
|
||||
var _14=tab.domNode;
|
||||
if(this._postResize&&_14!=this._selectedTab){
|
||||
this._selectedTab=_14;
|
||||
var sl=this._getScroll();
|
||||
if(sl>_14.offsetLeft||sl+dojo.style(this.scrollNode,"width")<_14.offsetLeft+dojo.style(_14,"width")){
|
||||
this.createSmoothScroll().play();
|
||||
}
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_getScrollBounds:function(){
|
||||
var _15=this.getChildren(),_16=dojo.style(this.scrollNode,"width"),_17=dojo.style(this.containerNode,"width"),_18=_17-_16,_19=this._getTabsWidth();
|
||||
if(_15.length&&_19>_16){
|
||||
return {min:this.isLeftToRight()?0:_15[_15.length-1].domNode.offsetLeft,max:this.isLeftToRight()?(_15[_15.length-1].domNode.offsetLeft+dojo.style(_15[_15.length-1].domNode,"width"))-_16:_18};
|
||||
}else{
|
||||
var _1a=this.isLeftToRight()?0:_18;
|
||||
return {min:_1a,max:_1a};
|
||||
}
|
||||
},_getScrollForSelectedTab:function(){
|
||||
var w=this.scrollNode,n=this._selectedTab,_1b=dojo.style(this.scrollNode,"width"),_1c=this._getScrollBounds();
|
||||
var pos=(n.offsetLeft+dojo.style(n,"width")/2)-_1b/2;
|
||||
pos=Math.min(Math.max(pos,_1c.min),_1c.max);
|
||||
return pos;
|
||||
},createSmoothScroll:function(x){
|
||||
if(arguments.length>0){
|
||||
var _1d=this._getScrollBounds();
|
||||
x=Math.min(Math.max(x,_1d.min),_1d.max);
|
||||
}else{
|
||||
x=this._getScrollForSelectedTab();
|
||||
}
|
||||
if(this._anim&&this._anim.status()=="playing"){
|
||||
this._anim.stop();
|
||||
}
|
||||
var _1e=this,w=this.scrollNode,_1f=new dojo._Animation({beforeBegin:function(){
|
||||
if(this.curve){
|
||||
delete this.curve;
|
||||
}
|
||||
var _20=w.scrollLeft,_21=_1e._convertToScrollLeft(x);
|
||||
_1f.curve=new dojo._Line(_20,_21);
|
||||
},onAnimate:function(val){
|
||||
w.scrollLeft=val;
|
||||
}});
|
||||
this._anim=_1f;
|
||||
this._setButtonClass(x);
|
||||
return _1f;
|
||||
},_getBtnNode:function(e){
|
||||
var n=e.target;
|
||||
while(n&&!dojo.hasClass(n,"tabStripButton")){
|
||||
n=n.parentNode;
|
||||
}
|
||||
return n;
|
||||
},doSlideRight:function(e){
|
||||
this.doSlide(1,this._getBtnNode(e));
|
||||
},doSlideLeft:function(e){
|
||||
this.doSlide(-1,this._getBtnNode(e));
|
||||
},doSlide:function(_22,_23){
|
||||
if(_23&&dojo.hasClass(_23,"dijitTabDisabled")){
|
||||
return;
|
||||
}
|
||||
var _24=dojo.style(this.scrollNode,"width");
|
||||
var d=(_24*0.75)*_22;
|
||||
var to=this._getScroll()+d;
|
||||
this._setButtonClass(to);
|
||||
this.createSmoothScroll(to).play();
|
||||
},_setButtonClass:function(_25){
|
||||
var _26=this._getScrollBounds();
|
||||
this._leftBtn.set("disabled",_25<=_26.min);
|
||||
this._rightBtn.set("disabled",_25>=_26.max);
|
||||
}});
|
||||
dojo.declare("dijit.layout._ScrollingTabControllerButton",dijit.form.Button,{baseClass:"dijitTab tabStripButton",templateString:dojo.cache("dijit.layout","templates/_ScrollingTabControllerButton.html","<div dojoAttachEvent=\"onclick:_onButtonClick\">\n\t<div waiRole=\"presentation\" class=\"dijitTabInnerDiv\" dojoattachpoint=\"innerDiv,focusNode\">\n\t\t<div waiRole=\"presentation\" class=\"dijitTabContent dijitButtonContents\" dojoattachpoint=\"tabContent\">\n\t\t\t<img waiRole=\"presentation\" alt=\"\" src=\"${_blankGif}\" class=\"dijitTabStripIcon\" dojoAttachPoint=\"iconNode\"/>\n\t\t\t<span dojoAttachPoint=\"containerNode,titleNode\" class=\"dijitButtonText\"></span>\n\t\t</div>\n\t</div>\n</div>\n"),tabIndex:"-1"});
|
||||
}
|
||||
348
lib/dijit/layout/SplitContainer.js
Normal file
348
lib/dijit/layout/SplitContainer.js
Normal file
@@ -0,0 +1,348 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.SplitContainer"]){
|
||||
dojo._hasResource["dijit.layout.SplitContainer"]=true;
|
||||
dojo.provide("dijit.layout.SplitContainer");
|
||||
dojo.require("dojo.cookie");
|
||||
dojo.require("dijit.layout._LayoutWidget");
|
||||
dojo.declare("dijit.layout.SplitContainer",dijit.layout._LayoutWidget,{constructor:function(){
|
||||
dojo.deprecated("dijit.layout.SplitContainer is deprecated","use BorderContainer with splitter instead",2);
|
||||
},activeSizing:false,sizerWidth:7,orientation:"horizontal",persist:true,baseClass:"dijitSplitContainer",postMixInProperties:function(){
|
||||
this.inherited("postMixInProperties",arguments);
|
||||
this.isHorizontal=(this.orientation=="horizontal");
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.sizers=[];
|
||||
if(dojo.isMozilla){
|
||||
this.domNode.style.overflow="-moz-scrollbars-none";
|
||||
}
|
||||
if(typeof this.sizerWidth=="object"){
|
||||
try{
|
||||
this.sizerWidth=parseInt(this.sizerWidth.toString());
|
||||
}
|
||||
catch(e){
|
||||
this.sizerWidth=7;
|
||||
}
|
||||
}
|
||||
var _1=dojo.doc.createElement("div");
|
||||
this.virtualSizer=_1;
|
||||
_1.style.position="relative";
|
||||
_1.style.zIndex=10;
|
||||
_1.className=this.isHorizontal?"dijitSplitContainerVirtualSizerH":"dijitSplitContainerVirtualSizerV";
|
||||
this.domNode.appendChild(_1);
|
||||
dojo.setSelectable(_1,false);
|
||||
},destroy:function(){
|
||||
delete this.virtualSizer;
|
||||
dojo.forEach(this._ownconnects,dojo.disconnect);
|
||||
this.inherited(arguments);
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
dojo.forEach(this.getChildren(),function(_2,i,_3){
|
||||
this._setupChild(_2);
|
||||
if(i<_3.length-1){
|
||||
this._addSizer();
|
||||
}
|
||||
},this);
|
||||
if(this.persist){
|
||||
this._restoreState();
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_setupChild:function(_4){
|
||||
this.inherited(arguments);
|
||||
_4.domNode.style.position="absolute";
|
||||
dojo.addClass(_4.domNode,"dijitSplitPane");
|
||||
},_onSizerMouseDown:function(e){
|
||||
if(e.target.id){
|
||||
for(var i=0;i<this.sizers.length;i++){
|
||||
if(this.sizers[i].id==e.target.id){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i<this.sizers.length){
|
||||
this.beginSizing(e,i);
|
||||
}
|
||||
}
|
||||
},_addSizer:function(_5){
|
||||
_5=_5===undefined?this.sizers.length:_5;
|
||||
var _6=dojo.doc.createElement("div");
|
||||
_6.id=dijit.getUniqueId("dijit_layout_SplitterContainer_Splitter");
|
||||
this.sizers.splice(_5,0,_6);
|
||||
this.domNode.appendChild(_6);
|
||||
_6.className=this.isHorizontal?"dijitSplitContainerSizerH":"dijitSplitContainerSizerV";
|
||||
var _7=dojo.doc.createElement("div");
|
||||
_7.className="thumb";
|
||||
_6.appendChild(_7);
|
||||
this.connect(_6,"onmousedown","_onSizerMouseDown");
|
||||
dojo.setSelectable(_6,false);
|
||||
},removeChild:function(_8){
|
||||
if(this.sizers.length){
|
||||
var i=dojo.indexOf(this.getChildren(),_8);
|
||||
if(i!=-1){
|
||||
if(i==this.sizers.length){
|
||||
i--;
|
||||
}
|
||||
dojo.destroy(this.sizers[i]);
|
||||
this.sizers.splice(i,1);
|
||||
}
|
||||
}
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
this.layout();
|
||||
}
|
||||
},addChild:function(_9,_a){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
var _b=this.getChildren();
|
||||
if(_b.length>1){
|
||||
this._addSizer(_a);
|
||||
}
|
||||
this.layout();
|
||||
}
|
||||
},layout:function(){
|
||||
this.paneWidth=this._contentBox.w;
|
||||
this.paneHeight=this._contentBox.h;
|
||||
var _c=this.getChildren();
|
||||
if(!_c.length){
|
||||
return;
|
||||
}
|
||||
var _d=this.isHorizontal?this.paneWidth:this.paneHeight;
|
||||
if(_c.length>1){
|
||||
_d-=this.sizerWidth*(_c.length-1);
|
||||
}
|
||||
var _e=0;
|
||||
dojo.forEach(_c,function(_f){
|
||||
_e+=_f.sizeShare;
|
||||
});
|
||||
var _10=_d/_e;
|
||||
var _11=0;
|
||||
dojo.forEach(_c.slice(0,_c.length-1),function(_12){
|
||||
var _13=Math.round(_10*_12.sizeShare);
|
||||
_12.sizeActual=_13;
|
||||
_11+=_13;
|
||||
});
|
||||
_c[_c.length-1].sizeActual=_d-_11;
|
||||
this._checkSizes();
|
||||
var pos=0;
|
||||
var _14=_c[0].sizeActual;
|
||||
this._movePanel(_c[0],pos,_14);
|
||||
_c[0].position=pos;
|
||||
pos+=_14;
|
||||
if(!this.sizers){
|
||||
return;
|
||||
}
|
||||
dojo.some(_c.slice(1),function(_15,i){
|
||||
if(!this.sizers[i]){
|
||||
return true;
|
||||
}
|
||||
this._moveSlider(this.sizers[i],pos,this.sizerWidth);
|
||||
this.sizers[i].position=pos;
|
||||
pos+=this.sizerWidth;
|
||||
_14=_15.sizeActual;
|
||||
this._movePanel(_15,pos,_14);
|
||||
_15.position=pos;
|
||||
pos+=_14;
|
||||
},this);
|
||||
},_movePanel:function(_16,pos,_17){
|
||||
if(this.isHorizontal){
|
||||
_16.domNode.style.left=pos+"px";
|
||||
_16.domNode.style.top=0;
|
||||
var box={w:_17,h:this.paneHeight};
|
||||
if(_16.resize){
|
||||
_16.resize(box);
|
||||
}else{
|
||||
dojo.marginBox(_16.domNode,box);
|
||||
}
|
||||
}else{
|
||||
_16.domNode.style.left=0;
|
||||
_16.domNode.style.top=pos+"px";
|
||||
var box={w:this.paneWidth,h:_17};
|
||||
if(_16.resize){
|
||||
_16.resize(box);
|
||||
}else{
|
||||
dojo.marginBox(_16.domNode,box);
|
||||
}
|
||||
}
|
||||
},_moveSlider:function(_18,pos,_19){
|
||||
if(this.isHorizontal){
|
||||
_18.style.left=pos+"px";
|
||||
_18.style.top=0;
|
||||
dojo.marginBox(_18,{w:_19,h:this.paneHeight});
|
||||
}else{
|
||||
_18.style.left=0;
|
||||
_18.style.top=pos+"px";
|
||||
dojo.marginBox(_18,{w:this.paneWidth,h:_19});
|
||||
}
|
||||
},_growPane:function(_1a,_1b){
|
||||
if(_1a>0){
|
||||
if(_1b.sizeActual>_1b.sizeMin){
|
||||
if((_1b.sizeActual-_1b.sizeMin)>_1a){
|
||||
_1b.sizeActual=_1b.sizeActual-_1a;
|
||||
_1a=0;
|
||||
}else{
|
||||
_1a-=_1b.sizeActual-_1b.sizeMin;
|
||||
_1b.sizeActual=_1b.sizeMin;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _1a;
|
||||
},_checkSizes:function(){
|
||||
var _1c=0;
|
||||
var _1d=0;
|
||||
var _1e=this.getChildren();
|
||||
dojo.forEach(_1e,function(_1f){
|
||||
_1d+=_1f.sizeActual;
|
||||
_1c+=_1f.sizeMin;
|
||||
});
|
||||
if(_1c<=_1d){
|
||||
var _20=0;
|
||||
dojo.forEach(_1e,function(_21){
|
||||
if(_21.sizeActual<_21.sizeMin){
|
||||
_20+=_21.sizeMin-_21.sizeActual;
|
||||
_21.sizeActual=_21.sizeMin;
|
||||
}
|
||||
});
|
||||
if(_20>0){
|
||||
var _22=this.isDraggingLeft?_1e.reverse():_1e;
|
||||
dojo.forEach(_22,function(_23){
|
||||
_20=this._growPane(_20,_23);
|
||||
},this);
|
||||
}
|
||||
}else{
|
||||
dojo.forEach(_1e,function(_24){
|
||||
_24.sizeActual=Math.round(_1d*(_24.sizeMin/_1c));
|
||||
});
|
||||
}
|
||||
},beginSizing:function(e,i){
|
||||
var _25=this.getChildren();
|
||||
this.paneBefore=_25[i];
|
||||
this.paneAfter=_25[i+1];
|
||||
this.isSizing=true;
|
||||
this.sizingSplitter=this.sizers[i];
|
||||
if(!this.cover){
|
||||
this.cover=dojo.create("div",{style:{position:"absolute",zIndex:5,top:0,left:0,width:"100%",height:"100%"}},this.domNode);
|
||||
}else{
|
||||
this.cover.style.zIndex=5;
|
||||
}
|
||||
this.sizingSplitter.style.zIndex=6;
|
||||
this.originPos=dojo.position(_25[0].domNode,true);
|
||||
if(this.isHorizontal){
|
||||
var _26=e.layerX||e.offsetX||0;
|
||||
var _27=e.pageX;
|
||||
this.originPos=this.originPos.x;
|
||||
}else{
|
||||
var _26=e.layerY||e.offsetY||0;
|
||||
var _27=e.pageY;
|
||||
this.originPos=this.originPos.y;
|
||||
}
|
||||
this.startPoint=this.lastPoint=_27;
|
||||
this.screenToClientOffset=_27-_26;
|
||||
this.dragOffset=this.lastPoint-this.paneBefore.sizeActual-this.originPos-this.paneBefore.position;
|
||||
if(!this.activeSizing){
|
||||
this._showSizingLine();
|
||||
}
|
||||
this._ownconnects=[];
|
||||
this._ownconnects.push(dojo.connect(dojo.doc.documentElement,"onmousemove",this,"changeSizing"));
|
||||
this._ownconnects.push(dojo.connect(dojo.doc.documentElement,"onmouseup",this,"endSizing"));
|
||||
dojo.stopEvent(e);
|
||||
},changeSizing:function(e){
|
||||
if(!this.isSizing){
|
||||
return;
|
||||
}
|
||||
this.lastPoint=this.isHorizontal?e.pageX:e.pageY;
|
||||
this.movePoint();
|
||||
if(this.activeSizing){
|
||||
this._updateSize();
|
||||
}else{
|
||||
this._moveSizingLine();
|
||||
}
|
||||
dojo.stopEvent(e);
|
||||
},endSizing:function(e){
|
||||
if(!this.isSizing){
|
||||
return;
|
||||
}
|
||||
if(this.cover){
|
||||
this.cover.style.zIndex=-1;
|
||||
}
|
||||
if(!this.activeSizing){
|
||||
this._hideSizingLine();
|
||||
}
|
||||
this._updateSize();
|
||||
this.isSizing=false;
|
||||
if(this.persist){
|
||||
this._saveState(this);
|
||||
}
|
||||
dojo.forEach(this._ownconnects,dojo.disconnect);
|
||||
},movePoint:function(){
|
||||
var p=this.lastPoint-this.screenToClientOffset;
|
||||
var a=p-this.dragOffset;
|
||||
a=this.legaliseSplitPoint(a);
|
||||
p=a+this.dragOffset;
|
||||
this.lastPoint=p+this.screenToClientOffset;
|
||||
},legaliseSplitPoint:function(a){
|
||||
a+=this.sizingSplitter.position;
|
||||
this.isDraggingLeft=!!(a>0);
|
||||
if(!this.activeSizing){
|
||||
var min=this.paneBefore.position+this.paneBefore.sizeMin;
|
||||
if(a<min){
|
||||
a=min;
|
||||
}
|
||||
var max=this.paneAfter.position+(this.paneAfter.sizeActual-(this.sizerWidth+this.paneAfter.sizeMin));
|
||||
if(a>max){
|
||||
a=max;
|
||||
}
|
||||
}
|
||||
a-=this.sizingSplitter.position;
|
||||
this._checkSizes();
|
||||
return a;
|
||||
},_updateSize:function(){
|
||||
var pos=this.lastPoint-this.dragOffset-this.originPos;
|
||||
var _28=this.paneBefore.position;
|
||||
var _29=this.paneAfter.position+this.paneAfter.sizeActual;
|
||||
this.paneBefore.sizeActual=pos-_28;
|
||||
this.paneAfter.position=pos+this.sizerWidth;
|
||||
this.paneAfter.sizeActual=_29-this.paneAfter.position;
|
||||
dojo.forEach(this.getChildren(),function(_2a){
|
||||
_2a.sizeShare=_2a.sizeActual;
|
||||
});
|
||||
if(this._started){
|
||||
this.layout();
|
||||
}
|
||||
},_showSizingLine:function(){
|
||||
this._moveSizingLine();
|
||||
dojo.marginBox(this.virtualSizer,this.isHorizontal?{w:this.sizerWidth,h:this.paneHeight}:{w:this.paneWidth,h:this.sizerWidth});
|
||||
this.virtualSizer.style.display="block";
|
||||
},_hideSizingLine:function(){
|
||||
this.virtualSizer.style.display="none";
|
||||
},_moveSizingLine:function(){
|
||||
var pos=(this.lastPoint-this.startPoint)+this.sizingSplitter.position;
|
||||
dojo.style(this.virtualSizer,(this.isHorizontal?"left":"top"),pos+"px");
|
||||
},_getCookieName:function(i){
|
||||
return this.id+"_"+i;
|
||||
},_restoreState:function(){
|
||||
dojo.forEach(this.getChildren(),function(_2b,i){
|
||||
var _2c=this._getCookieName(i);
|
||||
var _2d=dojo.cookie(_2c);
|
||||
if(_2d){
|
||||
var pos=parseInt(_2d);
|
||||
if(typeof pos=="number"){
|
||||
_2b.sizeShare=pos;
|
||||
}
|
||||
}
|
||||
},this);
|
||||
},_saveState:function(){
|
||||
if(!this.persist){
|
||||
return;
|
||||
}
|
||||
dojo.forEach(this.getChildren(),function(_2e,i){
|
||||
dojo.cookie(this._getCookieName(i),_2e.sizeShare,{expires:365});
|
||||
},this);
|
||||
}});
|
||||
dojo.extend(dijit._Widget,{sizeMin:10,sizeShare:10});
|
||||
}
|
||||
148
lib/dijit/layout/StackContainer.js
Normal file
148
lib/dijit/layout/StackContainer.js
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.StackContainer"]){
|
||||
dojo._hasResource["dijit.layout.StackContainer"]=true;
|
||||
dojo.provide("dijit.layout.StackContainer");
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.require("dijit.layout._LayoutWidget");
|
||||
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");
|
||||
dojo.require("dojo.cookie");
|
||||
dojo.declare("dijit.layout.StackContainer",dijit.layout._LayoutWidget,{doLayout:true,persist:false,baseClass:"dijitStackContainer",postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
dojo.addClass(this.domNode,"dijitLayoutContainer");
|
||||
dijit.setWaiRole(this.containerNode,"tabpanel");
|
||||
this.connect(this.domNode,"onkeypress",this._onKeyPress);
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
var _1=this.getChildren();
|
||||
dojo.forEach(_1,this._setupChild,this);
|
||||
if(this.persist){
|
||||
this.selectedChildWidget=dijit.byId(dojo.cookie(this.id+"_selectedChild"));
|
||||
}else{
|
||||
dojo.some(_1,function(_2){
|
||||
if(_2.selected){
|
||||
this.selectedChildWidget=_2;
|
||||
}
|
||||
return _2.selected;
|
||||
},this);
|
||||
}
|
||||
var _3=this.selectedChildWidget;
|
||||
if(!_3&&_1[0]){
|
||||
_3=this.selectedChildWidget=_1[0];
|
||||
_3.selected=true;
|
||||
}
|
||||
dojo.publish(this.id+"-startup",[{children:_1,selected:_3}]);
|
||||
this.inherited(arguments);
|
||||
},resize:function(){
|
||||
var _4=this.selectedChildWidget;
|
||||
if(_4&&!this._hasBeenShown){
|
||||
this._hasBeenShown=true;
|
||||
this._showChild(_4);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},_setupChild:function(_5){
|
||||
this.inherited(arguments);
|
||||
dojo.removeClass(_5.domNode,"dijitVisible");
|
||||
dojo.addClass(_5.domNode,"dijitHidden");
|
||||
_5.domNode.title="";
|
||||
},addChild:function(_6,_7){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
dojo.publish(this.id+"-addChild",[_6,_7]);
|
||||
this.layout();
|
||||
if(!this.selectedChildWidget){
|
||||
this.selectChild(_6);
|
||||
}
|
||||
}
|
||||
},removeChild:function(_8){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
dojo.publish(this.id+"-removeChild",[_8]);
|
||||
}
|
||||
if(this._beingDestroyed){
|
||||
return;
|
||||
}
|
||||
if(this.selectedChildWidget===_8){
|
||||
this.selectedChildWidget=undefined;
|
||||
if(this._started){
|
||||
var _9=this.getChildren();
|
||||
if(_9.length){
|
||||
this.selectChild(_9[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this._started){
|
||||
this.layout();
|
||||
}
|
||||
},selectChild:function(_a,_b){
|
||||
_a=dijit.byId(_a);
|
||||
if(this.selectedChildWidget!=_a){
|
||||
this._transition(_a,this.selectedChildWidget,_b);
|
||||
this.selectedChildWidget=_a;
|
||||
dojo.publish(this.id+"-selectChild",[_a]);
|
||||
if(this.persist){
|
||||
dojo.cookie(this.id+"_selectedChild",this.selectedChildWidget.id);
|
||||
}
|
||||
}
|
||||
},_transition:function(_c,_d){
|
||||
if(_d){
|
||||
this._hideChild(_d);
|
||||
}
|
||||
this._showChild(_c);
|
||||
if(_c.resize){
|
||||
if(this.doLayout){
|
||||
_c.resize(this._containerContentBox||this._contentBox);
|
||||
}else{
|
||||
_c.resize();
|
||||
}
|
||||
}
|
||||
},_adjacent:function(_e){
|
||||
var _f=this.getChildren();
|
||||
var _10=dojo.indexOf(_f,this.selectedChildWidget);
|
||||
_10+=_e?1:_f.length-1;
|
||||
return _f[_10%_f.length];
|
||||
},forward:function(){
|
||||
this.selectChild(this._adjacent(true),true);
|
||||
},back:function(){
|
||||
this.selectChild(this._adjacent(false),true);
|
||||
},_onKeyPress:function(e){
|
||||
dojo.publish(this.id+"-containerKeyPress",[{e:e,page:this}]);
|
||||
},layout:function(){
|
||||
if(this.doLayout&&this.selectedChildWidget&&this.selectedChildWidget.resize){
|
||||
this.selectedChildWidget.resize(this._containerContentBox||this._contentBox);
|
||||
}
|
||||
},_showChild:function(_11){
|
||||
var _12=this.getChildren();
|
||||
_11.isFirstChild=(_11==_12[0]);
|
||||
_11.isLastChild=(_11==_12[_12.length-1]);
|
||||
_11.selected=true;
|
||||
dojo.removeClass(_11.domNode,"dijitHidden");
|
||||
dojo.addClass(_11.domNode,"dijitVisible");
|
||||
_11._onShow();
|
||||
},_hideChild:function(_13){
|
||||
_13.selected=false;
|
||||
dojo.removeClass(_13.domNode,"dijitVisible");
|
||||
dojo.addClass(_13.domNode,"dijitHidden");
|
||||
_13.onHide();
|
||||
},closeChild:function(_14){
|
||||
var _15=_14.onClose(this,_14);
|
||||
if(_15){
|
||||
this.removeChild(_14);
|
||||
_14.destroyRecursive();
|
||||
}
|
||||
},destroyDescendants:function(_16){
|
||||
dojo.forEach(this.getChildren(),function(_17){
|
||||
this.removeChild(_17);
|
||||
_17.destroyRecursive(_16);
|
||||
},this);
|
||||
}});
|
||||
dojo.require("dijit.layout.StackController");
|
||||
dojo.extend(dijit._Widget,{selected:false,closable:false,iconClass:"",showTitle:true});
|
||||
}
|
||||
174
lib/dijit/layout/StackController.js
Normal file
174
lib/dijit/layout/StackController.js
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.StackController"]){
|
||||
dojo._hasResource["dijit.layout.StackController"]=true;
|
||||
dojo.provide("dijit.layout.StackController");
|
||||
dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dijit.form.ToggleButton");
|
||||
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");
|
||||
dojo.declare("dijit.layout.StackController",[dijit._Widget,dijit._Templated,dijit._Container],{templateString:"<span wairole='tablist' dojoAttachEvent='onkeypress' class='dijitStackController'></span>",containerId:"",buttonWidget:"dijit.layout._StackButton",postCreate:function(){
|
||||
dijit.setWaiRole(this.domNode,"tablist");
|
||||
this.pane2button={};
|
||||
this.pane2handles={};
|
||||
this.subscribe(this.containerId+"-startup","onStartup");
|
||||
this.subscribe(this.containerId+"-addChild","onAddChild");
|
||||
this.subscribe(this.containerId+"-removeChild","onRemoveChild");
|
||||
this.subscribe(this.containerId+"-selectChild","onSelectChild");
|
||||
this.subscribe(this.containerId+"-containerKeyPress","onContainerKeyPress");
|
||||
},onStartup:function(_1){
|
||||
dojo.forEach(_1.children,this.onAddChild,this);
|
||||
if(_1.selected){
|
||||
this.onSelectChild(_1.selected);
|
||||
}
|
||||
},destroy:function(){
|
||||
for(var _2 in this.pane2button){
|
||||
this.onRemoveChild(dijit.byId(_2));
|
||||
}
|
||||
this.inherited(arguments);
|
||||
},onAddChild:function(_3,_4){
|
||||
var _5=dojo.getObject(this.buttonWidget);
|
||||
var _6=new _5({id:this.id+"_"+_3.id,label:_3.title,dir:_3.dir,lang:_3.lang,showLabel:_3.showTitle,iconClass:_3.iconClass,closeButton:_3.closable,title:_3.tooltip});
|
||||
dijit.setWaiState(_6.focusNode,"selected","false");
|
||||
this.pane2handles[_3.id]=[this.connect(_3,"set",function(_7,_8){
|
||||
var _9={title:"label",showTitle:"showLabel",iconClass:"iconClass",closable:"closeButton",tooltip:"title"}[_7];
|
||||
if(_9){
|
||||
_6.set(_9,_8);
|
||||
}
|
||||
}),this.connect(_6,"onClick",dojo.hitch(this,"onButtonClick",_3)),this.connect(_6,"onClickCloseButton",dojo.hitch(this,"onCloseButtonClick",_3))];
|
||||
this.addChild(_6,_4);
|
||||
this.pane2button[_3.id]=_6;
|
||||
_3.controlButton=_6;
|
||||
if(!this._currentChild){
|
||||
_6.focusNode.setAttribute("tabIndex","0");
|
||||
dijit.setWaiState(_6.focusNode,"selected","true");
|
||||
this._currentChild=_3;
|
||||
}
|
||||
if(!this.isLeftToRight()&&dojo.isIE&&this._rectifyRtlTabList){
|
||||
this._rectifyRtlTabList();
|
||||
}
|
||||
},onRemoveChild:function(_a){
|
||||
if(this._currentChild===_a){
|
||||
this._currentChild=null;
|
||||
}
|
||||
dojo.forEach(this.pane2handles[_a.id],this.disconnect,this);
|
||||
delete this.pane2handles[_a.id];
|
||||
var _b=this.pane2button[_a.id];
|
||||
if(_b){
|
||||
this.removeChild(_b);
|
||||
delete this.pane2button[_a.id];
|
||||
_b.destroy();
|
||||
}
|
||||
delete _a.controlButton;
|
||||
},onSelectChild:function(_c){
|
||||
if(!_c){
|
||||
return;
|
||||
}
|
||||
if(this._currentChild){
|
||||
var _d=this.pane2button[this._currentChild.id];
|
||||
_d.set("checked",false);
|
||||
dijit.setWaiState(_d.focusNode,"selected","false");
|
||||
_d.focusNode.setAttribute("tabIndex","-1");
|
||||
}
|
||||
var _e=this.pane2button[_c.id];
|
||||
_e.set("checked",true);
|
||||
dijit.setWaiState(_e.focusNode,"selected","true");
|
||||
this._currentChild=_c;
|
||||
_e.focusNode.setAttribute("tabIndex","0");
|
||||
var _f=dijit.byId(this.containerId);
|
||||
dijit.setWaiState(_f.containerNode,"labelledby",_e.id);
|
||||
},onButtonClick:function(_10){
|
||||
var _11=dijit.byId(this.containerId);
|
||||
_11.selectChild(_10);
|
||||
},onCloseButtonClick:function(_12){
|
||||
var _13=dijit.byId(this.containerId);
|
||||
_13.closeChild(_12);
|
||||
if(this._currentChild){
|
||||
var b=this.pane2button[this._currentChild.id];
|
||||
if(b){
|
||||
dijit.focus(b.focusNode||b.domNode);
|
||||
}
|
||||
}
|
||||
},adjacent:function(_14){
|
||||
if(!this.isLeftToRight()&&(!this.tabPosition||/top|bottom/.test(this.tabPosition))){
|
||||
_14=!_14;
|
||||
}
|
||||
var _15=this.getChildren();
|
||||
var _16=dojo.indexOf(_15,this.pane2button[this._currentChild.id]);
|
||||
var _17=_14?1:_15.length-1;
|
||||
return _15[(_16+_17)%_15.length];
|
||||
},onkeypress:function(e){
|
||||
if(this.disabled||e.altKey){
|
||||
return;
|
||||
}
|
||||
var _18=null;
|
||||
if(e.ctrlKey||!e._djpage){
|
||||
var k=dojo.keys;
|
||||
switch(e.charOrCode){
|
||||
case k.LEFT_ARROW:
|
||||
case k.UP_ARROW:
|
||||
if(!e._djpage){
|
||||
_18=false;
|
||||
}
|
||||
break;
|
||||
case k.PAGE_UP:
|
||||
if(e.ctrlKey){
|
||||
_18=false;
|
||||
}
|
||||
break;
|
||||
case k.RIGHT_ARROW:
|
||||
case k.DOWN_ARROW:
|
||||
if(!e._djpage){
|
||||
_18=true;
|
||||
}
|
||||
break;
|
||||
case k.PAGE_DOWN:
|
||||
if(e.ctrlKey){
|
||||
_18=true;
|
||||
}
|
||||
break;
|
||||
case k.DELETE:
|
||||
if(this._currentChild.closable){
|
||||
this.onCloseButtonClick(this._currentChild);
|
||||
}
|
||||
dojo.stopEvent(e);
|
||||
break;
|
||||
default:
|
||||
if(e.ctrlKey){
|
||||
if(e.charOrCode===k.TAB){
|
||||
this.adjacent(!e.shiftKey).onClick();
|
||||
dojo.stopEvent(e);
|
||||
}else{
|
||||
if(e.charOrCode=="w"){
|
||||
if(this._currentChild.closable){
|
||||
this.onCloseButtonClick(this._currentChild);
|
||||
}
|
||||
dojo.stopEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_18!==null){
|
||||
this.adjacent(_18).onClick();
|
||||
dojo.stopEvent(e);
|
||||
}
|
||||
}
|
||||
},onContainerKeyPress:function(_19){
|
||||
_19.e._djpage=_19.page;
|
||||
this.onkeypress(_19.e);
|
||||
}});
|
||||
dojo.declare("dijit.layout._StackButton",dijit.form.ToggleButton,{tabIndex:"-1",postCreate:function(evt){
|
||||
dijit.setWaiRole((this.focusNode||this.domNode),"tab");
|
||||
this.inherited(arguments);
|
||||
},onClick:function(evt){
|
||||
dijit.focus(this.focusNode);
|
||||
},onClickCloseButton:function(evt){
|
||||
evt.stopPropagation();
|
||||
}});
|
||||
}
|
||||
23
lib/dijit/layout/TabContainer.js
Normal file
23
lib/dijit/layout/TabContainer.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.TabContainer"]){
|
||||
dojo._hasResource["dijit.layout.TabContainer"]=true;
|
||||
dojo.provide("dijit.layout.TabContainer");
|
||||
dojo.require("dijit.layout._TabContainerBase");
|
||||
dojo.require("dijit.layout.TabController");
|
||||
dojo.require("dijit.layout.ScrollingTabController");
|
||||
dojo.declare("dijit.layout.TabContainer",dijit.layout._TabContainerBase,{useMenu:true,useSlider:true,controllerWidget:"",_makeController:function(_1){
|
||||
var _2=this.baseClass+"-tabs"+(this.doLayout?"":" dijitTabNoLayout"),_3=dojo.getObject(this.controllerWidget);
|
||||
return new _3({id:this.id+"_tablist",dir:this.dir,lang:this.lang,tabPosition:this.tabPosition,doLayout:this.doLayout,containerId:this.id,"class":_2,nested:this.nested,useMenu:this.useMenu,useSlider:this.useSlider,tabStripClass:this.tabStrip?this.baseClass+(this.tabStrip?"":"No")+"Strip":null},_1);
|
||||
},postMixInProperties:function(){
|
||||
this.inherited(arguments);
|
||||
if(!this.controllerWidget){
|
||||
this.controllerWidget=(this.tabPosition=="top"||this.tabPosition=="bottom")&&!this.nested?"dijit.layout.ScrollingTabController":"dijit.layout.TabController";
|
||||
}
|
||||
}});
|
||||
}
|
||||
77
lib/dijit/layout/TabController.js
Normal file
77
lib/dijit/layout/TabController.js
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout.TabController"]){
|
||||
dojo._hasResource["dijit.layout.TabController"]=true;
|
||||
dojo.provide("dijit.layout.TabController");
|
||||
dojo.require("dijit.layout.StackController");
|
||||
dojo.require("dijit.Menu");
|
||||
dojo.require("dijit.MenuItem");
|
||||
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");
|
||||
dojo.declare("dijit.layout.TabController",dijit.layout.StackController,{templateString:"<div wairole='tablist' dojoAttachEvent='onkeypress:onkeypress'></div>",tabPosition:"top",buttonWidget:"dijit.layout._TabButton",_rectifyRtlTabList:function(){
|
||||
if(0>=this.tabPosition.indexOf("-h")){
|
||||
return;
|
||||
}
|
||||
if(!this.pane2button){
|
||||
return;
|
||||
}
|
||||
var _1=0;
|
||||
for(var _2 in this.pane2button){
|
||||
var ow=this.pane2button[_2].innerDiv.scrollWidth;
|
||||
_1=Math.max(_1,ow);
|
||||
}
|
||||
for(_2 in this.pane2button){
|
||||
this.pane2button[_2].innerDiv.style.width=_1+"px";
|
||||
}
|
||||
}});
|
||||
dojo.declare("dijit.layout._TabButton",dijit.layout._StackButton,{baseClass:"dijitTab",cssStateNodes:{closeNode:"dijitTabCloseButton"},templateString:dojo.cache("dijit.layout","templates/_TabButton.html","<div waiRole=\"presentation\" dojoAttachPoint=\"titleNode\" dojoAttachEvent='onclick:onClick'>\n <div waiRole=\"presentation\" class='dijitTabInnerDiv' dojoAttachPoint='innerDiv'>\n <div waiRole=\"presentation\" class='dijitTabContent' dojoAttachPoint='tabContent'>\n \t<div waiRole=\"presentation\" dojoAttachPoint='focusNode'>\n\t\t <img src=\"${_blankGif}\" alt=\"\" class=\"dijitIcon\" dojoAttachPoint='iconNode' />\n\t\t <span dojoAttachPoint='containerNode' class='tabLabel'></span>\n\t\t <span class=\"dijitInline dijitTabCloseButton dijitTabCloseIcon\" dojoAttachPoint='closeNode'\n\t\t \t\tdojoAttachEvent='onclick: onClickCloseButton' waiRole=\"presentation\">\n\t\t <span dojoAttachPoint='closeText' class='dijitTabCloseText'>x</span\n\t\t ></span>\n\t\t\t</div>\n </div>\n </div>\n</div>\n"),scrollOnFocus:false,postMixInProperties:function(){
|
||||
if(!this.iconClass){
|
||||
this.iconClass="dijitTabButtonIcon";
|
||||
}
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
dojo.setSelectable(this.containerNode,false);
|
||||
if(this.iconNode.className=="dijitTabButtonIcon"){
|
||||
dojo.style(this.iconNode,"width","1px");
|
||||
}
|
||||
},startup:function(){
|
||||
this.inherited(arguments);
|
||||
var n=this.domNode;
|
||||
setTimeout(function(){
|
||||
n.className=n.className;
|
||||
},1);
|
||||
},_setCloseButtonAttr:function(_3){
|
||||
this.closeButton=_3;
|
||||
dojo.toggleClass(this.innerDiv,"dijitClosable",_3);
|
||||
this.closeNode.style.display=_3?"":"none";
|
||||
if(_3){
|
||||
var _4=dojo.i18n.getLocalization("dijit","common");
|
||||
if(this.closeNode){
|
||||
dojo.attr(this.closeNode,"title",_4.itemClose);
|
||||
}
|
||||
var _4=dojo.i18n.getLocalization("dijit","common");
|
||||
this._closeMenu=new dijit.Menu({id:this.id+"_Menu",dir:this.dir,lang:this.lang,targetNodeIds:[this.domNode]});
|
||||
this._closeMenu.addChild(new dijit.MenuItem({label:_4.itemClose,dir:this.dir,lang:this.lang,onClick:dojo.hitch(this,"onClickCloseButton")}));
|
||||
}else{
|
||||
if(this._closeMenu){
|
||||
this._closeMenu.destroyRecursive();
|
||||
delete this._closeMenu;
|
||||
}
|
||||
}
|
||||
},_setLabelAttr:function(_5){
|
||||
this.inherited(arguments);
|
||||
if(this.showLabel==false&&!this.params.title){
|
||||
this.iconNode.alt=dojo.trim(this.containerNode.innerText||this.containerNode.textContent||"");
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this._closeMenu){
|
||||
this._closeMenu.destroyRecursive();
|
||||
delete this._closeMenu;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
}
|
||||
126
lib/dijit/layout/_LayoutWidget.js
Normal file
126
lib/dijit/layout/_LayoutWidget.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout._LayoutWidget"]){
|
||||
dojo._hasResource["dijit.layout._LayoutWidget"]=true;
|
||||
dojo.provide("dijit.layout._LayoutWidget");
|
||||
dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dijit._Contained");
|
||||
dojo.declare("dijit.layout._LayoutWidget",[dijit._Widget,dijit._Container,dijit._Contained],{baseClass:"dijitLayoutContainer",isLayoutContainer:true,postCreate:function(){
|
||||
dojo.addClass(this.domNode,"dijitContainer");
|
||||
this.inherited(arguments);
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
this.inherited(arguments);
|
||||
var _1=this.getParent&&this.getParent();
|
||||
if(!(_1&&_1.isLayoutContainer)){
|
||||
this.resize();
|
||||
this.connect(dojo.isIE?this.domNode:dojo.global,"onresize",function(){
|
||||
this.resize();
|
||||
});
|
||||
}
|
||||
},resize:function(_2,_3){
|
||||
var _4=this.domNode;
|
||||
if(_2){
|
||||
dojo.marginBox(_4,_2);
|
||||
if(_2.t){
|
||||
_4.style.top=_2.t+"px";
|
||||
}
|
||||
if(_2.l){
|
||||
_4.style.left=_2.l+"px";
|
||||
}
|
||||
}
|
||||
var mb=_3||{};
|
||||
dojo.mixin(mb,_2||{});
|
||||
if(!("h" in mb)||!("w" in mb)){
|
||||
mb=dojo.mixin(dojo.marginBox(_4),mb);
|
||||
}
|
||||
var cs=dojo.getComputedStyle(_4);
|
||||
var me=dojo._getMarginExtents(_4,cs);
|
||||
var be=dojo._getBorderExtents(_4,cs);
|
||||
var bb=(this._borderBox={w:mb.w-(me.w+be.w),h:mb.h-(me.h+be.h)});
|
||||
var pe=dojo._getPadExtents(_4,cs);
|
||||
this._contentBox={l:dojo._toPixelValue(_4,cs.paddingLeft),t:dojo._toPixelValue(_4,cs.paddingTop),w:bb.w-pe.w,h:bb.h-pe.h};
|
||||
this.layout();
|
||||
},layout:function(){
|
||||
},_setupChild:function(_5){
|
||||
dojo.addClass(_5.domNode,this.baseClass+"-child");
|
||||
if(_5.baseClass){
|
||||
dojo.addClass(_5.domNode,this.baseClass+"-"+_5.baseClass);
|
||||
}
|
||||
},addChild:function(_6,_7){
|
||||
this.inherited(arguments);
|
||||
if(this._started){
|
||||
this._setupChild(_6);
|
||||
}
|
||||
},removeChild:function(_8){
|
||||
dojo.removeClass(_8.domNode,this.baseClass+"-child");
|
||||
if(_8.baseClass){
|
||||
dojo.removeClass(_8.domNode,this.baseClass+"-"+_8.baseClass);
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
dijit.layout.marginBox2contentBox=function(_9,mb){
|
||||
var cs=dojo.getComputedStyle(_9);
|
||||
var me=dojo._getMarginExtents(_9,cs);
|
||||
var pb=dojo._getPadBorderExtents(_9,cs);
|
||||
return {l:dojo._toPixelValue(_9,cs.paddingLeft),t:dojo._toPixelValue(_9,cs.paddingTop),w:mb.w-(me.w+pb.w),h:mb.h-(me.h+pb.h)};
|
||||
};
|
||||
(function(){
|
||||
var _a=function(_b){
|
||||
return _b.substring(0,1).toUpperCase()+_b.substring(1);
|
||||
};
|
||||
var _c=function(_d,_e){
|
||||
_d.resize?_d.resize(_e):dojo.marginBox(_d.domNode,_e);
|
||||
dojo.mixin(_d,dojo.marginBox(_d.domNode));
|
||||
dojo.mixin(_d,_e);
|
||||
};
|
||||
dijit.layout.layoutChildren=function(_f,dim,_10){
|
||||
dim=dojo.mixin({},dim);
|
||||
dojo.addClass(_f,"dijitLayoutContainer");
|
||||
_10=dojo.filter(_10,function(_11){
|
||||
return _11.layoutAlign!="client";
|
||||
}).concat(dojo.filter(_10,function(_12){
|
||||
return _12.layoutAlign=="client";
|
||||
}));
|
||||
dojo.forEach(_10,function(_13){
|
||||
var elm=_13.domNode,pos=_13.layoutAlign;
|
||||
var _14=elm.style;
|
||||
_14.left=dim.l+"px";
|
||||
_14.top=dim.t+"px";
|
||||
_14.bottom=_14.right="auto";
|
||||
dojo.addClass(elm,"dijitAlign"+_a(pos));
|
||||
if(pos=="top"||pos=="bottom"){
|
||||
_c(_13,{w:dim.w});
|
||||
dim.h-=_13.h;
|
||||
if(pos=="top"){
|
||||
dim.t+=_13.h;
|
||||
}else{
|
||||
_14.top=dim.t+dim.h+"px";
|
||||
}
|
||||
}else{
|
||||
if(pos=="left"||pos=="right"){
|
||||
_c(_13,{h:dim.h});
|
||||
dim.w-=_13.w;
|
||||
if(pos=="left"){
|
||||
dim.l+=_13.w;
|
||||
}else{
|
||||
_14.left=dim.l+dim.w+"px";
|
||||
}
|
||||
}else{
|
||||
if(pos=="client"){
|
||||
_c(_13,dim);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
})();
|
||||
}
|
||||
68
lib/dijit/layout/_TabContainerBase.js
Normal file
68
lib/dijit/layout/_TabContainerBase.js
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (c) 2004-2010, 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.layout._TabContainerBase"]){
|
||||
dojo._hasResource["dijit.layout._TabContainerBase"]=true;
|
||||
dojo.provide("dijit.layout._TabContainerBase");
|
||||
dojo.require("dijit.layout.StackContainer");
|
||||
dojo.require("dijit._Templated");
|
||||
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(){
|
||||
this.baseClass+=this.tabPosition.charAt(0).toUpperCase()+this.tabPosition.substr(1).replace(/-.*/,"");
|
||||
this.srcNodeRef&&dojo.style(this.srcNodeRef,"visibility","hidden");
|
||||
this.inherited(arguments);
|
||||
},postCreate:function(){
|
||||
this.inherited(arguments);
|
||||
this.tablist=this._makeController(this.tablistNode);
|
||||
if(!this.doLayout){
|
||||
dojo.addClass(this.domNode,"dijitTabContainerNoLayout");
|
||||
}
|
||||
if(this.nested){
|
||||
dojo.addClass(this.domNode,"dijitTabContainerNested");
|
||||
dojo.addClass(this.tablist.containerNode,"dijitTabContainerTabListNested");
|
||||
dojo.addClass(this.tablistSpacer,"dijitTabContainerSpacerNested");
|
||||
dojo.addClass(this.containerNode,"dijitTabPaneWrapperNested");
|
||||
}else{
|
||||
dojo.addClass(this.domNode,"tabStrip-"+(this.tabStrip?"enabled":"disabled"));
|
||||
}
|
||||
},_setupChild:function(_1){
|
||||
dojo.addClass(_1.domNode,"dijitTabPane");
|
||||
this.inherited(arguments);
|
||||
},startup:function(){
|
||||
if(this._started){
|
||||
return;
|
||||
}
|
||||
this.tablist.startup();
|
||||
this.inherited(arguments);
|
||||
},layout:function(){
|
||||
if(!this._contentBox||typeof (this._contentBox.l)=="undefined"){
|
||||
return;
|
||||
}
|
||||
var sc=this.selectedChildWidget;
|
||||
if(this.doLayout){
|
||||
var _2=this.tabPosition.replace(/-h/,"");
|
||||
this.tablist.layoutAlign=_2;
|
||||
var _3=[this.tablist,{domNode:this.tablistSpacer,layoutAlign:_2},{domNode:this.containerNode,layoutAlign:"client"}];
|
||||
dijit.layout.layoutChildren(this.domNode,this._contentBox,_3);
|
||||
this._containerContentBox=dijit.layout.marginBox2contentBox(this.containerNode,_3[2]);
|
||||
if(sc&&sc.resize){
|
||||
sc.resize(this._containerContentBox);
|
||||
}
|
||||
}else{
|
||||
if(this.tablist.resize){
|
||||
this.tablist.resize({w:dojo.contentBox(this.domNode).w});
|
||||
}
|
||||
if(sc&&sc.resize){
|
||||
sc.resize();
|
||||
}
|
||||
}
|
||||
},destroy:function(){
|
||||
if(this.tablist){
|
||||
this.tablist.destroy();
|
||||
}
|
||||
this.inherited(arguments);
|
||||
}});
|
||||
}
|
||||
Reference in New Issue
Block a user