zul.wgt.Groupbox=zk.$extends(zul.ContainerWidget,{_open:!0,_closable:!0,$define:{open:function(a,b){var c=this.$n();if(c&&this._closable){var d=this.getCaveNode();a&&(jq(c).removeClass(this.$s("collapsed")),zk(this).redoCSS(-1,{fixFontIcon:!0}));if(0===zk(this).getAnimationSpeed())jq(d)[a?"show":"hide"](),this._afterOpen(a);else zk(d)[a?"slideDown":"slideUp"](this);b||this.fire("onOpen",{open:a})}},closable:_zkf=function(){this._updDomOuter()},contentStyle:_zkf,contentSclass:_zkf,title:_zkf},_isDefault:function(){return"default"==
this._mold},_updDomOuter:function(){this.rerender(zk.Skipper.nonCaptionSkipper)},_contentAttrs:function(){var a=' class="',b=this._contentSclass;b&&(a+=b+" ");a+=this.$s("content")+'"';b=this._contentStyle;if(this.caption||this.getTitle())b="border-top:0;"+(b||"");this._open||(b="display:none;"+(b||""));b&&(a+=' style="'+b+'"');return a},_redrawCave:function(a,b){a.push('<div id="',this.uuid,'-cave"',this._contentAttrs(),">");if(!b){b=this.firstChild;for(var c=this.caption;b;b=b.nextSibling)b!=c&&
b.redraw(a)}a.push("</div>")},setHeight:function(){this.$supers("setHeight",arguments);this.desktop&&this._fixHgh()},_fixHgh:function(){var a=this.$n(),b=a.style.height;!b&&this._cssflex&&this._vflex&&(b=a.offsetHeight);b&&"auto"!=b&&this.isOpen()&&(a=this.$n("cave"))&&(b=zk(a),a.style.height=b.revisedHeight(b.vflexHeight(),!0)-(this._isDefault()?parseInt(jq(this).css("padding-top")):0)+"px");if(this._isDefault()){a=this.$n("title");if(b=this.caption)b.$n().style.top=jq.px(zk(b.$n("cave")).offsetHeight()/
2*-1);a&&(a.style.top=jq.px(zk(this.$n("title-cnt")).offsetHeight()/2*-1))}},setFlexSizeH_:function(a,b,c,d){if(d&&(this.caption||this._title)){c=this._isDefault()?parseInt(jq(this).css("padding-top")):0;for(var e=a.firstChild;e;e=e.nextSibling)c+=jq(e).outerHeight()}this.$supers("setFlexSizeH_",arguments)},onSize:function(){this._fixHgh()},clearCachedSize_:function(){this.$supers("clearCachedSize_",arguments);this.$n("cave").style.height=""},updateDomStyle_:function(){this.$supers("updateDomStyle_",
arguments);if(this.desktop)this.onSize()},focus_:function(a){for(var b=this.caption,c=this.firstChild;c;c=c.nextSibling)if(c.desktop&&c!=b&&c.focus_(a))return!0;return b&&b.focus_(a)},bind_:function(){this.$supers(zul.wgt.Groupbox,"bind_",arguments);zWatch.listen({onSize:this});var a;this.getTitle()&&(a=this.$n("title"))&&this.domListen_(a,"onClick","_doTitleClick")},unbind_:function(){zWatch.unlisten({onSize:this});var a;(a=this.$n("title"))&&this.domUnlisten_(a,"onClick","_doTitleClick");this.$supers(zul.wgt.Groupbox,
"unbind_",arguments)},_doTitleClick:function(){this._closable&&this.setOpen(!this.isOpen());this.$supers("doClick_",arguments)},onChildAdded_:function(a){this.$supers("onChildAdded_",arguments);a.$instanceof(zul.wgt.Caption)&&(this.caption=a,this.rerender())},onChildRemoved_:function(a){this.$supers("onChildRemoved_",arguments);a==this.caption&&(this.caption=null,this.rerender())},getChildMinSize_:function(a,b){if(!b.$instanceof(zul.wgt.Caption))return this.$supers("getChildMinSize_",arguments)},
domClass_:function(){var a=this.$supers("domClass_",arguments);this._isDefault()||(a&&(a+=" "),a+=this.$s("3d"));this.caption||this.getTitle()||(a&&(a+=" "),a+=" "+this.$s("notitle"));!this._open&&this._isDefault()&&(a&&(a+=" "),a+=this.$s("collapsed"));return a},afterAnima_:function(a){this.$supers("afterAnima_",arguments);this._afterOpen(a)},_afterOpen:function(a){!a&&this._isDefault()&&jq(this.$n()).addClass(this.$s("collapsed"));if(a=this.parent)if(a.getHflex&&"min"!=a.getHflex()||a.getVflex&&
"min"!=a.getVflex())zUtl.fireSized(a);else for(var b=a.firstChild;b;b=b.nextSibling)if(b!=this){var c=b.getVflex();if(c&&"min"!=c){zUtl.fireSized(a);break}}this.doResizeScroll_()}});
