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,q=f.width,r=f.minWidth,t=f.maxWidth,u=f.height,v=f.minHeight,w=f.maxHeight,y=[];if("n"==AdfAgent.AGENT.getAttribute(b,"_afrm")){var z=f.msGridColumns,f=f.msGridRows;AdfDhtmlPanelGridLayoutPeer.superclass.ComponentInlineStyleChanged.call(this,a,b,d,e);null!=z&&""!=z&&y.push("-ms-grid-columns:"+z);null!=f&&""!=f&&y.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&&y.push("display:"+g);null!=h&&""!=h&&y.push("position:"+h);null!=k&&""!=k&&y.push("left:"+k);null!=l&&""!=l&&y.push("right:"+l);null!=m&&""!=m&&y.push("top:"+m);null!=n&&""!=n&&y.push("bottom:"+n);null!=q&&""!=q&&y.push("width:"+q);null!=r&&""!=r&&y.push("min-width:"+r);null!=t&&""!=t&&y.push("max-width:"+t);null!=u&&""!=u&&y.push("height:"+u);null!=v&&""!=v&&y.push("min-height:"+
v);null!=w&&""!=w&&y.push("max-height:"+w);0<y.length&&AdfDomUtils.addInlineStyle(b,y.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=[],q=AdfLogger.LOGGER,r=null,t=-1!=this._getColumns(f).indexOf("%"),u=-1!=this._getRows(f).indexOf("%"),v,w,y,z,B=m.length-1,C=0;C<=B;C++){var A=m[C];if(null!=e.getAttribute(A,"_afrc")||null!=e.getAttribute(A,
"_afrr")){var E=AdfDomUtils.getFirstChildElement(A);null==E&&(E=AdfDomUtils.getFirstChildNodeByType(A,3));if(null==E)C==B&&null!=e.getAttribute(A,"_afrr")?r=A:q.finest("The grid layout ("+f.getClientId()+") has an empty grid cell under wrapper index \x3d "+C+", wrapper.innerHTML \x3d "+A.innerHTML+")");else if(3==E.nodeType||AdfDomUtils.isVisible(E)){var F=this._getAttribute(e,A,"_afrc","1 1 1 1 stretch stretch").split(" ");v=parseInt(F[0],10);w=parseInt(F[1],10);y=parseInt(F[2],10);z=parseInt(F[3],
10);var D=F[4],F=F[5];0<v&&0<y&&(data={wrapper:A,child:E,col:v,cspan:w,row:y,rspan:z,halign:D,valign:F},k=Math.max(k,v+w-1),l=Math.max(l,y+z-1),n.push(data))}else q.isLoggable(AdfLogger.FINE)&&q.fine("The grid layout ("+f.getClientId()+") has an invisible child (wrapper index \x3d "+C+", child.id \x3d "+E.id+", wrapper.innerHTML \x3d "+A.innerHTML+")")}}if(0==n.length)return q.isLoggable(AdfLogger.FINE)&&q.fine("The grid layout ("+f.getClientId()+") has no child data to process (wrappers.length \x3d "+
m.length+")."),!1;m=AdfPage.PAGE.getLocaleContext().isRightToLeft();B=!1;v=this._resolveSizes(g,k,d,n,"col","cspan","halign","clientWidth",a);z=this._resolveSizes(h,l,d,n,"row","rspan","valign","clientHeight",b);w=v[0];y=z[0];B||(B=v[1]||z[1]);null==r&&(r=d.ownerDocument.createElement("div"),e.setAttribute(r,"_afrr","y"),d.appendChild(r));AdfDomUtils.addInlineStyle(r,"width:"+w+"px;height:"+y+"px",!0);v="";t||(v+="max-width:"+w+"px;min-width:"+w+"px;");u||(v+="max-height:"+y+"px;min-height:"+y+"px;");
""!=v&&(AdfDomUtils.addInlineStyle(d,v,!0),this._forcedDimensionStyles=v);q.isLoggable(AdfLogger.FINE)&&(q.fine("Grid layout details for "+f.getClientId()+" (childData.length \x3d "+n.length+")"),q.fine("Columns: "+g),q.fine("Rows: "+h),q.fine("Grid (permanent) dimensions: "+w+"px and "+y+"px."));t=n.length;for(C=0;C<t;C++)data=n[C],"center"==data.halign&&(data.sw=data.wrapper.scrollWidth),"middle"==data.valign&&(data.sh=data.wrapper.scrollHeight);for(C=0;C<t;C++)data=n[C],A=data.wrapper,v=data.col,
w=data.cspan,y=data.row,z=data.rspan,D=data.halign,F=data.valign,u=[],"center"==D?(B=!0,e=this._getFirstEdge(g,v),r=this._getFirstEdge(g,v+w),e=e+Math.ceil(Math.max(0,r-e)/2-data.sw/2)+"px",m?u.push("right:"+e):u.push("left:"+e)):"stretch"==D?(e=this._getFirstEdge(g,v),r=this._getFirstEdge(g,v+w),m?u.push("right:"+e+"px"):u.push("left:"+e+"px"),u.push("width:"+(r-e)+"px")):m?("end"!=D&&u.push("right:"+this._getFirstEdge(g,v)+"px"),"start"!=D&&(e=this._getLastEdge(g,v+w-1),u.push("left:"+e+"px"))):
("end"!=D&&u.push("left:"+this._getFirstEdge(g,v)+"px"),"start"!=D&&(e=this._getLastEdge(g,v+w-1),u.push("right:"+e+"px"))),"middle"==F?(B=!0,e=this._getFirstEdge(h,y),r=this._getFirstEdge(h,y+z),u.push("top:"+(e+Math.ceil(Math.max(0,r-e)/2-data.sh/2))+"px")):"stretch"==F?(e=this._getFirstEdge(h,y),r=this._getFirstEdge(h,y+z),u.push("top:"+e+"px"),u.push("height:"+(r-e)+"px")):("bottom"!=F&&u.push("top:"+this._getFirstEdge(h,y)+"px"),"top"!=F&&(e=this._getLastEdge(h,y+z-1),u.push("bottom:"+e+"px"))),
0<u.length&&AdfDomUtils.addInlineStyle(A,u.join(";"),!0),q.isLoggable(AdfLogger.FINE)&&q.fine("child "+C+": c\x3d"+v+" (span\x3d"+w+") halign\x3d"+D+" -- r\x3d"+y+" (span\x3d"+z+") valign\x3d"+F);a!=d.clientWidth||b!=d.clientHeight?this._repositionPanesDirty(f,d,a,b):this._cancelRepositionCallback();return B};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,q,r,t=a.length;for(m=b-t;0<m;m--)a.push("auto");b=!1;var u=0,t=a.length;for(m=0;m<t;m++)n=a[m],"auto"==n?(b=!0,n=["auto"]):-1!=n.indexOf("%")?u+=parseFloat(n):(n=AdfDomUtils.getOffsetSizeFromCssLength(d,n),h+=n),a[m]=n;if(b){n=AdfAgent.AGENT;var v=[],w,y,z,B=e.length;for(m=0;m<B;m++)if(q=e[m],w=q[f]-1,y=w+q[g]-1,w!=y)AdfLogger.LOGGER.isLoggable(AdfLogger.FINE)&&AdfLogger.LOGGER.fine("Skipped auto resolution for a multi-span child because firstLineIndex \x3d "+
w+" and lastLineIndex \x3d "+y);else{z=-1;for(r=w;r<=y;r++)if("object"==typeof a[r]){z=r;break}-1!=z&&(r=q.wrapper,AdfDomUtils.addInlineStyle(r,"top:auto;top:auto;bottom:auto;left:auto;right:auto;width:auto;height:auto;max-width:none;max-height:none",!0),v.push([r,w,y,z]))}e=v.length;for(m=0;m<e;m++)for(f=v[m],r=f[0],w=f[1],y=f[2],z=f[3],f=0,"clientWidth"==k?(f=r.scrollWidth,n.getPlatform()==AdfAgent.GECKO_PLATFORM&&1.8<n.getVersion()&&++f):f=r.scrollHeight,r=w;r<=y;r++){if(z==r){a[r].push(f);break}g=
a[r];if("number"==typeof g&&(f=Math.max(0,f-g),0==f))break}for(r=0;r<t;r++)if(n=a[r],v=0,"object"==typeof n){y=n.length;for(m=1;m<y;m++)v=Math.max(v,n[m]);a[r]=v;h+=v}}m=0;if(0<u){m=Math.max(0,null==l?d[k]:l);t=a.length;for(r=0;r<t&&0<m;r++)n=a[r],"number"==typeof n&&(m=Math.max(0,m-n));for(r=0;r<t;r++)n=a[r],"string"==typeof n&&(d=parseFloat(n),a[r]=Math.floor(m*d/u))}return[h,b]};