(function(){zul.sel.Treecell=zk.$extends(zul.LabelImageWidget,{setWidth:zk.$void,_colspan:1,$define:{colspan:[function(a){return 1<a?a:1},function(){var a=this.$n();a&&(a.colSpan=this._colspan)}]},getTree:function(){return this.parent?this.parent.getTree():null},domStyle_:function(a){a=zk.copy(a,{width:!0});var b="",c=this.getTreecol();c&&(c._align&&(b+="text-align: "+c._align+";"),c.isVisible()||(a=zk.copy(a,{visible:!0})));return this.$supers("domStyle_",[a])+b},getTreecol:function(){var a=this.getTree();
if(a&&a.treecols){var b=this.getChildIndex();if(b<a.treecols.nChildren)return a.treecols.getChildAt(b)}return null},getLevel:function(){return this.parent?this.parent.getLevel():0},getMaxlength:function(){var a=this.getTreecol();return a?a.getMaxlength():0},domLabel_:function(){return zUtl.encodeXML(this.getLabel(),{maxlength:this.getMaxlength()})},getTextNode:function(){return this.getCaveNode()},domContent_:function(){var a=this.$supers("domContent_",arguments),b=this._colHtmlPre();return a?b?b+
'<span class="'+this.$s("text")+'">&nbsp;'+a+"</span>":a:b},bind_:function(){this.$supers("bind_",arguments);if(this._clearCache){this._clearCache=!1;var a;(a=this.parent)&&a.clearCache()}},doMouseOver_:function(a){var b=this.$n();b&&zk.gecko&&(this._draggable||this.parent._draggable)&&!jq.nodeName(a.domTarget,"input","textarea")&&jq(b).addClass("z-draggable-over");this.$supers("doMouseOver_",arguments)},doMouseOut_:function(a){var b=this.$n();b&&zk.gecko&&(this._draggable||this.parent._draggable)&&
!jq.nodeName(a.domTarget,"input","textarea")&&jq(b).removeClass("z-draggable-over");this.$supers("doMouseOut_",arguments)},doFocus_:function(a){this.$supers("doFocus_",arguments);var b=this.getTree(),c=b?b.frozen:null,e=b&&b._treechildren?b._treechildren.$n():null;if(c&&e){var d=jq(a.domTarget).parents("td");for(var f=0,g=d.length;f<g;f++)if(c=d[f],c.parentNode.parentNode==e){b._moveToHidingFocusCell(c.cellIndex);break}}},_syncIcon:function(a){this.rerender(a?-1:!1);this.parent&&(this._clearCache=
!0)},_colHtmlPre:function(){if(this.parent.firstChild==this){var a=this.parent.parent,b=a.getTree(),c=new zk.Buffer;if(b&&b.isCheckmark()){var e=a.isSelectable(),d=b.isMultiple(),f=d?a.$s("checkbox"):a.$s("radio");d=d?" z-icon-check":" z-icon-radio";c.push('<span id="',this.parent.uuid,'-cm" class="',a.$s("checkable")," ",f);e&&!a.isDisabled()||c.push(" ",a.$s("disabled"));c.push('"');e||c.push(' style="visibility:hidden"');c.push('><i class="',a.$s("icon"),d,'"></i></span>')}e=b?b.getZclass():"";
f=0;for(b=this._getTreeitems(a,b).length;f<b;++f)this._appendIcon(c,e,"spacer",!1);a.isContainer()?(a=a.isOpen()?"open":"close",this._appendIcon(c,e,a,!0)):this._appendIcon(c,e,"spacer",!1);return c.join("")}return this.getImage()||this.getLabel()||this.nChildren?null:"&nbsp;"},_getTreeitems:function(a,b){for(var c=[];;){a=a.parent;if(!a)break;a=a.parent;if(!a||a==b)break;c.unshift(a)}return c},_appendIcon:function(a,b,c,e){var d,f="";a.push('<span class="');if("spacer"==c)a.push(b,"-line ",b,"-",
c,'"'),f+="&nbsp;";else{var g="";e&&(d=this.parent)&&(g=d.uuid+"-icon");a.push(b,'-icon"');d=this.getIconOpenClass_();-1<c.indexOf("close")&&(d=this.getIconCloseClass_());f+='<i id="'+g+'" class="'+d+" "+b+"-"+c+'"></i>'}e&&(d=this.parent)&&a.push(' id="',d.uuid,'-open"');a.push(">",f,"</span>")},getIconOpenClass_:function(){return"z-icon-caret-down"},getIconCloseClass_:function(){return"z-icon-caret-right"},getWidth:function(){var a=this.getTreecol();return a?a.getWidth():null},domAttrs_:function(){return this.$supers("domAttrs_",
arguments)+(1<this._colspan?' colspan="'+this._colspan+'"':"")},domClass_:function(a){var b=this.$supers("domClass_",arguments),c=this.getTreecol();c&&(c.isVisible()||(b+=" "+this.$s("hidden-col")));return b},updateDomContent_:function(){this.$supers("updateDomContent_",arguments);this.parent&&this.parent.clearCache()},deferRedrawHTML_:function(a){a.push("<td",this.domAttrs_({domClass:1}),' class="z-renderdefer"></td>')}})})();
