AdfRichUIPeer.createPeerClass(AdfRichUIPeer,"AdfDhtmlPanelGridLayoutPeer",!1);AdfDhtmlPanelGridLayoutPeer.InitSubclass=function(){AdfRichUIPeer.addComponentPropertyChanges(this,AdfRichPanelGridLayout.INLINE_STYLE)};
AdfDhtmlPanelGridLayoutPeer.prototype.ComponentInlineStyleChanged=function(a,b,d,e){var f=b.style,g=f.display,h=f.position,k=f.left,l=f.right,m=f.top,n=f.bottom,p=f.width,q=f.minWidth,r=f.maxWidth,s=f.height,u=f.minHeight,t=f.maxHeight,v=[];if("n"==AdfAgent.AGENT.getAttribute(b,"_afrm")){var w=f.msGridColumns,f=f.msGridRows;AdfDhtmlPanelGridLayoutPeer.superclass.ComponentInlineStyleChanged.call(this,a,b,d,e);null!=w&&""!=w&&v.push("-ms-grid-columns:"+w);null!=f&&""!=f&&v.push("-ms-grid-rows:"+f)}else AdfDhtmlPanelGridLayoutPeer.superclass.ComponentInlineStyleChanged.call(this,
a,b,d,e),null!=this._forcedDimensionStyles&&AdfDomUtils.addInlineStyle(b,this._forcedDimensionStyles,!0);null!=g&&""!=g&&v.push("display:"+g);null!=h&&""!=h&&v.push("position:"+h);null!=k&&""!=k&&v.push("left:"+k);null!=l&&""!=l&&v.push("right:"+l);null!=m&&""!=m&&v.push("top:"+m);null!=n&&""!=n&&v.push("bottom:"+n);null!=p&&""!=p&&v.push("width:"+p);null!=q&&""!=q&&v.push("min-width:"+q);null!=r&&""!=r&&v.push("max-width:"+r);null!=s&&""!=s&&v.push("height:"+s);null!=u&&""!=u&&v.push("min-height:"+
u);null!=t&&""!=t&&v.push("max-height:"+t);0<v.length&&AdfDomUtils.addInlineStyle(b,v.join(";"),!0)};AdfDhtmlPanelGridLayoutPeer.prototype.needsResizeNotify=function(a){return!0};AdfDhtmlPanelGridLayoutPeer.prototype.needsChildVisibilityChanges=function(a){return!0};AdfDhtmlPanelGridLayoutPeer.prototype.ComponentRemoved=function(a){this._registeredForDescendantResize&&AdfPage.PAGE.__unregisterDescendantResizeNotifyComponent(a)};
AdfDhtmlPanelGridLayoutPeer.prototype.ResizeNotify=function(a,b,d,e){a=this.getComponent();if(null!=this._forcedDimensionStyles){b=-1!=this._getColumns(a).indexOf("%");var f=-1!=this._getRows(a).indexOf("%"),g=-1!=this._getColumns(a).indexOf("auto"),h=-1!=this._getRows(a).indexOf("auto");if(!b&&!f&&!g&&!h)return}b=this.getDomElement();null!=AdfDomUtils.getFirstChildElement(b)&&(d=this._repositionPanes(d,e),this._registeredForDescendantResize&&!d?(AdfPage.PAGE.__unregisterDescendantResizeNotifyComponent(a),
this._registeredForDescendantResize=!1):d&&(AdfPage.PAGE.__registerDescendantResizeNotifyComponent(a),this._registeredForDescendantResize=!0),"hidden"==b.style.visibility&&(b.style.visibility="visible"))};AdfDhtmlPanelGridLayoutPeer.prototype.ChildVisibilityChanged=function(a,b,d){return this._isChild(b)?(AdfDomUtils.setVisible(b.parentNode,d),this._repositionPanes(),AdfDomUtils.setVisible(b,d),AdfPage.PAGE.doResizeNotify(this.getComponent()),!0):!1};
AdfDhtmlPanelGridLayoutPeer.prototype._isChild=function(a){return a.parentNode.parentNode==this.getDomElement()};AdfDhtmlPanelGridLayoutPeer.prototype._getColumns=function(a){null==this._columns&&(this._columns=a.getProperty("_privateColumns"));return this._columns};AdfDhtmlPanelGridLayoutPeer.prototype._getRows=function(a){null==this._rows&&(this._rows=a.getProperty("_privateRows"));return this._rows};
AdfDhtmlPanelGridLayoutPeer.prototype._repositionPanes=function(a,b){var d=this.getDomElement(),e=AdfAgent.AGENT;if("n"==e.getAttribute(d,"_afrm"))return!1;for(var f=this.getComponent(),g=this._getColumns(f).split(" "),h=this._getRows(f).split(" "),k=0,l=0,m=AdfDomUtils.getChildElements(d),n=[],p=AdfLogger.LOGGER,q=null,r=-1!=this._getColumns(f).indexOf("%"),s=-1!=this._getRows(f).indexOf("%"),u,t,v,w,z=m.length-1,y=0;y<=z;y++){var A=m[y],B=AdfDomUtils.getFirstChildElement(A);null==B&&(B=AdfDomUtils.getFirstChildNodeByType(A,
3));if(null==B)y==z&&null!=e.getAttribute(A,"_afrr")?q=A:p.finest("The grid layout ("+f.getClientId()+") has an empty grid cell under wrapper index \x3d "+y+", wrapper.innerHTML \x3d "+A.innerHTML+")");else if(3==B.nodeType||AdfDomUtils.isVisible(B)){var C=this._getAttribute(e,A,"_afrc","1 1 1 1 stretch stretch").split(" ");u=parseInt(C[0],10);t=parseInt(C[1],10);v=parseInt(C[2],10);w=parseInt(C[3],10);var D=C[4],C=C[5];0<u&&0<v&&(data={wrapper:A,child:B,col:u,cspan:t,row:v,rspan:w,halign:D,valign:C},
k=Math.max(k,u+t-1),l=Math.max(l,v+w-1),n.push(data))}else p.isLoggable(AdfLogger.FINE)&&p.fine("The grid layout ("+f.getClientId()+") has an invisible child (wrapper index \x3d "+y+", child.id \x3d "+B.id+", wrapper.innerHTML \x3d "+A.innerHTML+")")}if(0==n.length)return p.isLoggable(AdfLogger.FINE)&&p.fine("The grid layout ("+f.getClientId()+") has no child data to process (wrappers.length \x3d "+m.length+")."),!1;m=AdfPage.PAGE.getLocaleContext().isRightToLeft();z=!1;u=this._resolveSizes(g,k,d,
n,"col","cspan","halign","clientWidth",a);w=this._resolveSizes(h,l,d,n,"row","rspan","valign","clientHeight",b);t=u[0];v=w[0];z||(z=u[1]||w[1]);null==q&&(q=d.ownerDocument.createElement("div"),e.setAttribute(q,"_afrr","y"),d.appendChild(q));AdfDomUtils.addInlineStyle(q,"width:"+t+"px;height:"+v+"px",!0);u="";r||(u+="max-width:"+t+"px;min-width:"+t+"px;");s||(u+="max-height:"+v+"px;min-height:"+v+"px;");""!=u&&(AdfDomUtils.addInlineStyle(d,u,!0),this._forcedDimensionStyles=u);p.isLoggable(AdfLogger.FINE)&&
(p.fine("Grid layout details for "+f.getClientId()+" (childData.length \x3d "+n.length+")"),p.fine("Columns: "+g),p.fine("Rows: "+h),p.fine("Grid (permanent) dimensions: "+t+"px and "+v+"px."));r=n.length;for(y=0;y<r;y++)data=n[y],"center"==data.halign&&(data.sw=data.wrapper.scrollWidth),"middle"==data.valign&&(data.sh=data.wrapper.scrollHeight);for(y=0;y<r;y++)data=n[y],A=data.wrapper,u=data.col,t=data.cspan,v=data.row,w=data.rspan,D=data.halign,C=data.valign,s=[],"center"==D?(z=!0,e=this._getFirstEdge(g,
u),q=this._getFirstEdge(g,u+t),q=Math.max(0,q-e),q=Math.ceil(q/2-data.sw/2),e=e+q+"px",m?s.push("right:"+e):s.push("left:"+e)):"stretch"==D?(e=this._getFirstEdge(g,u),q=this._getFirstEdge(g,u+t),m?s.push("right:"+e+"px"):s.push("left:"+e+"px"),s.push("width:"+(q-e)+"px")):m?("end"!=D&&s.push("right:"+this._getFirstEdge(g,u)+"px"),"start"!=D&&(e=this._getLastEdge(g,u+t-1),s.push("left:"+e+"px"))):("end"!=D&&s.push("left:"+this._getFirstEdge(g,u)+"px"),"start"!=D&&(e=this._getLastEdge(g,u+t-1),s.push("right:"+
e+"px"))),"middle"==C?(z=!0,e=this._getFirstEdge(h,v),q=this._getFirstEdge(h,v+w),q=Math.max(0,q-e),q=Math.ceil(q/2-data.sh/2),s.push("top:"+(e+q)+"px")):"stretch"==C?(e=this._getFirstEdge(h,v),q=this._getFirstEdge(h,v+w),s.push("top:"+e+"px"),s.push("height:"+(q-e)+"px")):("bottom"!=C&&s.push("top:"+this._getFirstEdge(h,v)+"px"),"top"!=C&&(e=this._getLastEdge(h,v+w-1),s.push("bottom:"+e+"px"))),0<s.length&&AdfDomUtils.addInlineStyle(A,s.join(";"),!0),p.isLoggable(AdfLogger.FINE)&&p.fine("child "+
y+": c\x3d"+u+" (span\x3d"+t+") halign\x3d"+D+" -- r\x3d"+v+" (span\x3d"+w+") valign\x3d"+C);a!=d.clientWidth||b!=d.clientHeight?this._repositionPanesDirty(f,d,a,b):this._cancelRepositionCallback();return z};AdfDhtmlPanelGridLayoutPeer.prototype._stopRepositionCallback=function(){this._repositionTimer=this._repositionCount=null};
AdfDhtmlPanelGridLayoutPeer.prototype._cancelRepositionCallback=function(){null!=this._repositionTimer&&AdfPage.PAGE.cancelTimer(this._repositionTimer);this._repositionTimer=this._repositionCount=null};AdfDhtmlPanelGridLayoutPeer.prototype._startRepositionCallback=function(){this._repositionCount=1;this._repositionTimer=AdfPage.PAGE.scheduleTimer(this,this._stopRepositionCallback,{},1E3)};
AdfDhtmlPanelGridLayoutPeer.prototype._repositionPanesDirty=function(a,b,d,e){var f=AdfLogger.LOGGER;if(null==this._repositionCount)this._startRepositionCallback();else{if(10<++this._repositionCount&&(null==d||d>b.clientWidth||null==e||e>b.clientHeight)){f.isLoggable(AdfLogger.FINE)&&f.fine("Unsable structure encountered, stopping repositioning attempts (case a).");this._cancelRepositionCallback();return}if(15<++this._repositionCount){f.isLoggable(AdfLogger.FINE)&&f.fine("Unsable structure encountered, stopping repositioning attempts (case b).");
this._cancelRepositionCallback();return}}f.isLoggable(AdfLogger.FINE)&&f.fine("Grid layout size change, notifying ancestors: panelGridLayout\x3d"+b.id+" oldW\x3d"+d+", newW\x3d"+b.clientWidth+", oldH\x3d"+e+", newH\x3d"+b.clientHeight);AdfPage.PAGE.__queueDescendantResizeNotifySource(a);AdfPage.PAGE.__doDescendantResizeNotify()};AdfDhtmlPanelGridLayoutPeer.prototype._getFirstEdge=function(a,b){for(var d=0,e=0;e<b-1;e++)d+=a[e];return d};
AdfDhtmlPanelGridLayoutPeer.prototype._getLastEdge=function(a,b){for(var d=0,e=a.length-1;e>=b;e--)d+=a[e];return d};AdfDhtmlPanelGridLayoutPeer.prototype._getAttribute=function(a,b,d,e){a=a.getAttribute(b,d);return null==a?e:a};
AdfDhtmlPanelGridLayoutPeer.prototype._resolveSizes=function(a,b,d,e,f,g,h,k,l){h=0;var m,n,p,q,r=a.length;for(m=b-r;0<m;m--)a.push("auto");b=!1;var s=0,r=a.length;for(m=0;m<r;m++)n=a[m],"auto"==n?(b=!0,n=["auto"]):-1!=n.indexOf("%")?s+=parseFloat(n):(n=AdfDomUtils.getOffsetSizeFromCssLength(d,n),h+=n),a[m]=n;if(b){n=AdfAgent.AGENT;var u=[],t,v,w,z=e.length;for(m=0;m<z;m++)if(p=e[m],t=p[f]-1,v=t+p[g]-1,t!=v)AdfLogger.LOGGER.isLoggable(AdfLogger.FINE)&&AdfLogger.LOGGER.fine("Skipped auto resolution for a multi-span child because firstLineIndex \x3d "+
t+" and lastLineIndex \x3d "+v);else{w=-1;for(q=t;q<=v;q++)if("object"==typeof a[q]){w=q;break}-1!=w&&(q=p.wrapper,AdfDomUtils.addInlineStyle(q,"top:auto;top:auto;bottom:auto;left:auto;right:auto;width:auto;height:auto;max-width:none;max-height:none",!0),u.push([q,t,v,w]))}e=u.length;for(m=0;m<e;m++){f=u[m];q=f[0];t=f[1];v=f[2];w=f[3];f=0;"clientWidth"==k?(f=q.scrollWidth,n.getPlatform()==AdfAgent.GECKO_PLATFORM&&1.8<n.getVersion()&&++f):f=q.scrollHeight;for(q=t;q<=v;q++){if(w==q){a[q].push(f);break}g=
a[q];if("number"==typeof g&&(f=Math.max(0,f-g),0==f))break}}for(q=0;q<r;q++)if(n=a[q],u=0,"object"==typeof n){v=n.length;for(m=1;m<v;m++)u=Math.max(u,n[m]);a[q]=u;h+=u}}m=0;if(0<s){m=Math.max(0,null==l?d[k]:l);r=a.length;for(q=0;q<r&&0<m;q++)n=a[q],"number"==typeof n&&(m=Math.max(0,m-n));for(q=0;q<r;q++)n=a[q],"string"==typeof n&&(d=parseFloat(n),a[q]=Math.floor(m*d/s))}return[h,b]};