AdfRichUIPeer.createPeerClass(AdfRichUIPeer,"AdfDhtmlPanelDashboardPeer",!1);AdfDhtmlPanelDashboardPeer.InitSubclass=function(){this._INSERT_DELETE_PIXEL_HEIGHT="40";this._PHASE_2_DURATION_FACTOR=this._PHASE_1_DURATION_FACTOR=0.5};AdfDhtmlPanelDashboardPeer.prototype.InitDomElement=function(a,b){var d=a.getProperty("_allowedFlavors"),e=[];null!=d&&0<d.length&&(e=eval(d));a.setDropTarget(new AdfDashboardDropTarget(e))};AdfDhtmlPanelDashboardPeer.prototype.needsResizeNotify=function(a){return!0};
AdfDhtmlPanelDashboardPeer.prototype.ResizeNotify=function(a,b,d,e){delete this._cachedChildWidthInPixels;delete this._cachedChildHeightInPixels;this._workaroundForInternetExplorer(d)};AdfDhtmlPanelDashboardPeer.prototype.ComponentRemoved=function(a){null!=this._animator&&this._animator.stop()};
AdfDhtmlPanelDashboardPeer.prototype.DomReplaceNotify=function(a){if(0<a.id.indexOf("optRnd")){if(null!=this._animator){var b=this._animator.stop();this._processingOptimizedChanges&&null!=b&&2==b.length&&this._deleteElements(b[1],!0)}this._processingOptimizedChanges=!0;var d=AdfAgent.AGENT,e=this.__getDataBody(),b=AdfDomUtils.getChildElements(e),f=b.length,g=[],h=0,k,l;for(k=0;k<f;k++)l=AdfDomUtils.getFirstChildElement(b[k]),null==l||"afrPlaceholder"==l.name?(g[k]="placeholder",h++):g[k]="existing";
f=d.getAttribute(a,"afrDel");if(null!=f){f=eval(f);f.sort(AdfDhtmlPanelDashboardPeer._sortAscending);for(k=l=0;k<g.length;k++)"existing"==g[k]&&(AdfDhtmlPanelDashboardPeer._arrayContains(f,l)&&(g[k]="delete"),l++)}l=AdfDomUtils.getChildElements(a);f=l.length;k=parseInt(d.getAttribute(a,"afrIns"));if(0<f&&(isNaN(k)||k!=f))AdfLogger.LOGGER.severe("Error - the panelDashboard was told to expect "+k+" inserted "+(1==k?"child":"children")+" but "+f+" were sent.");if(0!=h||0!=f){h=[];for(k=0;k<f;k++)h.push(parseInt(d.getAttribute(l[k],
"afrIns")));h.sort(AdfDhtmlPanelDashboardPeer._sortAscending);var d=e.ownerDocument,m=l=0;for(k=0;k<g.length;k++)if("delete"!=g[k])if("placeholder"==g[k])AdfDhtmlPanelDashboardPeer._arrayContains(h,l)?(m++,l++):(g.splice(k,1),e.removeChild(b[k]),b=AdfDomUtils.getChildElements(e),k--);else{if(AdfDhtmlPanelDashboardPeer._arrayContains(h,l)){g.splice(k,0,"placeholder");var n=d.createElement("div"),p=n.style;p.position="absolute";p.overflow="hidden";p.width="1px";p.height=AdfDhtmlPanelDashboardPeer._INSERT_DELETE_PIXEL_HEIGHT+
"px";k<b.length?e.insertBefore(n,b[k]):e.appendChild(n);b=AdfDomUtils.getChildElements(e);m++}l++}for(;m<f;)g.push("placeholder"),h=d.createElement("div"),l=h.style,l.position="absolute",l.overflow="hidden",l.width="1px",l.height=AdfDhtmlPanelDashboardPeer._INSERT_DELETE_PIXEL_HEIGHT+"px",k++<b.length?e.insertBefore(h,b[k++]):e.appendChild(h),b=AdfDomUtils.getChildElements(e),m++}e=[];for(k=0;k<g.length;k++)"placeholder"==g[k]&&e.push(b[k]);for(k=0;k<f;k++){d=e[k];for(h=AdfDomUtils.getFirstChildElement(d);h;)d.removeChild(h),
h=AdfDomUtils.getFirstChildElement(d);h=AdfDomUtils.getFirstChildElement(a);l=AdfDomUtils.getFirstChildElement(h);a.removeChild(h);h.removeChild(l);d.appendChild(l)}e=[];for(k=0;k<g.length;k++)"delete"==g[k]&&e.push(b[k]);var p=AdfPage.PAGE.getLocaleContext().isRightToLeft(),q=this.getComponent(),d=q.getColumns(),h=this._getChildWidthInPixels(q);l=this._getChildHeightInPixels(q);var r=0,m=[];if(g.length>b.length)AdfLogger.LOGGER.severe("ERROR - Mismatch among metaData "+g.length+" and dataBodyChildren "+
b.length);else{for(k=n=0;k<g.length;k++){var s=r%d,u=Math.floor(r/d),t=b[k];this._preventDiagonalMovement(t,s,u,d,h,l,p);"delete"==g[k]?u={element:t,properties:{height:AdfDhtmlPanelDashboardPeer._INSERT_DELETE_PIXEL_HEIGHT,offsetLeft:s*h,offsetTop:u*l}}:(++n,u={element:t,properties:{width:h,offsetLeft:s*h,offsetTop:u*l}});p&&(t.style.left=t.offsetLeft+"px",t.style.right="auto",u.properties.offsetLeft=(d-1-s)*h);m.push(u);r++}k=q.getClientId();AdfDhtmlPanelDashboardPeer._adjustShim(m,k,d,l,n);p=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelDashboard-tr-insert-delete-animation-duration"));
p=isNaN(p)?0:Math.round(p*AdfDhtmlPanelDashboardPeer._PHASE_1_DURATION_FACTOR);q=null;AdfDhtmlPanelDashboardPeer._isDimensionsFromChildren(k)&&(q=this.getComponent());this._animator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,p,m,null,AdfDhtmlPanelDashboardPeer._domReplaceNotifyPhase2,[this,e,g,b,d,h,l,f,k,n],q)}}return a};
AdfDhtmlPanelDashboardPeer._domReplaceNotifyPhase2=function(a){var b=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],k=a[6],l=a[7],m=a[8],n=a[9];a=[];var p=0,q=AdfPage.PAGE.getLocaleContext().isRightToLeft(),r;for(r=0;r<e.length;r++){var s=f[r],u;if("delete"==e[r]){if(u={element:s,properties:{width:1}},q){var t=s.offsetLeft;s.style.left=t+"px";s.style.right="auto";u.properties.offsetLeft=t+h}}else t=p%g,u=Math.floor(p/g),b._preventDiagonalMovement(s,t,u,g,h,k,q),u={element:s,properties:{height:k,offsetLeft:t*
h,offsetTop:u*k}},q&&(s.style.left=s.offsetLeft+"px",s.style.right="auto",u.properties.offsetLeft=(g-1-t)*h),p++;a.push(u)}if(1==l&&0==d.length)for(r=f=0;r<e.length;r++)if("placeholder"==e[r]){e=k*Math.floor(f/g);f=b.getDomElement();a.push({element:f,properties:{scrollTop:e}});break}else"delete"!=e[r]&&f++;AdfDhtmlPanelDashboardPeer._adjustShim(a,m,g,k,n);g=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelDashboard-tr-insert-delete-animation-duration"));g=isNaN(g)?0:Math.round(g*AdfDhtmlPanelDashboardPeer._PHASE_2_DURATION_FACTOR);
k=null;AdfDhtmlPanelDashboardPeer._isDimensionsFromChildren(m)&&(k=b.getComponent());b._animator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,g,a,null,AdfDhtmlPanelDashboardPeer._resetChildrenPositioningStyles,[b,d],k)};AdfDhtmlPanelDashboardPeer._isDimensionsFromChildren=function(a){a=AdfRichUIPeer.CreateSubId(a,"shim");return null!=AdfAgent.AGENT.getElementById(a)};
AdfDhtmlPanelDashboardPeer._adjustShim=function(a,b,d,e,f){b=AdfRichUIPeer.CreateSubId(b,"shim");b=AdfAgent.AGENT.getElementById(b);null!=b&&(d=Math.ceil(f/d)*e,null==a?b.style.height=d+"px":a.push({element:b,properties:{height:d}}))};
AdfDhtmlPanelDashboardPeer.prototype.insertChildBehavior=function(a,b,d){var e=this.__getDataBody(),f=AdfDomUtils.getChildElements(e),g=f.length,h=a.getColumns(),k=this._getChildWidthInPixels(a),l=this._getChildHeightInPixels(a);-1==b&&(b=g);var m=b%h,n=Math.floor(b/h),p=e.ownerDocument,q=p.createElement("div"),r=q.style;d=n*l;r.position="absolute";r.top=d+"px";var s=AdfPage.PAGE.getLocaleContext().isRightToLeft();s?(r.right="auto",r.left=(h-1-m)*k+"px"):r.left=m*k+"px";r.overflow="hidden";r.width=
"1px";r.height=AdfDhtmlPanelDashboardPeer._INSERT_DELETE_PIXEL_HEIGHT+"px";b<f.length?e.insertBefore(q,f[b]):e.appendChild(q);f=AdfDomUtils.getChildElements(e);m=p.createElement("div");m.name="afrPlaceholder";n=m.style;n.position="absolute";n.top="2px";n.bottom="2px";n.left="2px";n.right="2px";n.padding="4px";n.borderWidth="1px";n.borderStyle="solid";n.borderColor="#CCCCCC";q.appendChild(m);m.appendChild(p.createTextNode(" "));p=[];p.push({element:q,properties:{width:k}});for(b=1+b;b<=g;b++)m=b%h,
n=Math.floor(b/h),q=f[b],this._preventDiagonalMovement(q,m,n,h,k,l,s),n={element:q,properties:{offsetLeft:m*k,offsetTop:n*l}},s&&(q.style.left=q.offsetLeft+"px",q.style.right="auto",n.properties.offsetLeft=(h-1-m)*k),p.push(n);a=a.getClientId();AdfDhtmlPanelDashboardPeer._adjustShim(p,a,h,l,1+g);g=this.getDomElement();p.push({element:g,properties:{scrollTop:d}});d=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelDashboard-tr-insert-delete-animation-duration"));d=isNaN(d)?0:Math.round(d*
AdfDhtmlPanelDashboardPeer._PHASE_1_DURATION_FACTOR);g=null;AdfDhtmlPanelDashboardPeer._isDimensionsFromChildren(a)&&(g=this.getComponent());this._animator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,d,p,null,AdfDhtmlPanelDashboardPeer._resetChildrenPositioningStyles,[this,null],g)};
AdfDhtmlPanelDashboardPeer.prototype.showDragFeedback=function(a,b,d,e,f,g,h){AdfAssert.assertPrototype(a,AdfDnDContext);AdfAssert.assertStringOrNull(b);AdfAssert.assertNumber(d);AdfAssert.assertStringOrNull(e);f=a.getDragSource().getComponent();a=this.getComponent();f=this.getDraggedSourceChildIndex(f,!0);g=AdfRichUIPeer.CreateSubId(a.getClientId(),"drpt");g=AdfAgent.AGENT.getElementById(g);if(h&&d==AdfDnDContext.ACTION_NONE)AdfDomUtils.removeCSSClassName(g,"p_AFDropTarget"),this._animateReorderPositionTo(a,
f,null);else if(e!=b)if(d=null,null!=b){d=parseInt(b);var k=a.getColumns();b=this._getChildWidthInPixels(a);e=this._getChildHeightInPixels(a);var l=Math.max(0,d%k),m=Math.max(0,Math.floor(d/k));h=l*b;m*=e;AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(h=(k-1-l)*b);k=g.style;k.width=b+"px";k.height=e+"px";k.left=h+4+"px";k.top=m+4+"px";AdfDomUtils.addCSSClassName(g,"p_AFDropTarget");this._animateReorderPositionTo(a,f,d)}else null!=e&&(AdfDomUtils.removeCSSClassName(g,"p_AFDropTarget"),null!=f&&
(null!=this._animator&&this._animator.stop(),AdfDhtmlPanelDashboardPeer._resetChildrenPositioningStyles([this,null],f,parseInt(e))))};
AdfDhtmlPanelDashboardPeer.prototype.getRowKeyBounds=function(a){if(null==a)return null;var b=this.__getDataBody(),d=AdfDomUtils.getChildElements(b).length;a=parseInt(a);if(a<d){var e=this.getComponent(),f=e.getColumns(),d=a%f,f=Math.floor(a/f);a=this._getChildWidthInPixels(e);var e=this._getChildHeightInPixels(e),d=d*a,f=f*e,g=AdfAgent.AGENT.getElementPageBounds(b);g.left+=d-b.scrollLeft;g.right=g.left+a;g.top+=f-b.scrollTop;g.bottom=g.top+e;return g}return null};
AdfDhtmlPanelDashboardPeer.prototype.getRowKeyAndOrientationFromHints=function(a,b,d){AdfAssert.assertNumber(a);AdfAssert.assertNumber(b);AdfAssert.assert(null!=d);var e=d[AdfStampedDropTarget.HINT_LAST_ROWKEY],f=d[AdfStampedDropTarget.HINT_LAST_ROWKEY_BOUNDS],g=d[AdfStampedDropTarget.HINT_LAST_DROP_ORIENTATION];if(e&&f&&(AdfAssert.assertString(e),AdfAssert.assertObject(f),a>=f.left&&b>=f.top&&a<=f.right&&b<=f.bottom)){d[AdfStampedDropTarget.ROW_KEY]=e;d[AdfStampedDropTarget.DROP_ORIENTATION]=g;return}e=
!0;f=AdfPage.PAGE.getDnDContext();null!=f&&(f=f.getDragSource().getComponent(),g=this.getComponent(),f.getParent()==g&&(e=!1));this._getRowKeyAndOrientationForPosition(a,b,d,e)};
AdfDhtmlPanelDashboardPeer.prototype.getDraggedSourceChildIndex=function(a,b){var d=this.__getDataBody(),d=AdfDomUtils.getChildElements(d),e=d.length,f=a.getClientId();if(!b&&this._draggedSourceClientId==f)return this._draggedSourceIndex;this._draggedSourceClientId=f;for(var g=null,h=0;h<e;h++){var k=AdfDomUtils.getFirstChildElement(d[h]);if(k&&f==AdfAgent.AGENT.getAttribute(k,"id")){g=h;break}}return this._draggedSourceIndex=g};AdfDhtmlPanelDashboardPeer._sortAscending=function(a,b){return a-b};
AdfDhtmlPanelDashboardPeer._arrayContains=function(a,b){var d,e=a.length;for(d=0;d<e;d++)if(a[d]==b)return!0;return!1};
AdfDhtmlPanelDashboardPeer.prototype._getDispayDropIndexFromCoordinates=function(a,b,d,e,f){var g=AdfAgent.AGENT;if(g.pointInElementBounds(this.getDomElement(),d,e)){d=d-document.documentElement.scrollLeft-g.getElementLeft(b)+b.scrollLeft;e=e-g.getElementTop(b)+b.scrollTop;var h=this._getChildWidthInPixels(a),g=this._getChildHeightInPixels(a);a=a.getColumns();d=Math.floor(d/h);AdfPage.PAGE.getLocaleContext().isRightToLeft()&&(d=a-1-d);a=Math.floor(e/g)*a+d;b=AdfDomUtils.getChildElements(b).length;
f||b--;return""+Math.min(b,a)}return null};AdfDhtmlPanelDashboardPeer.prototype._getRowKeyAndOrientationForPosition=function(a,b,d,e){AdfAssert.assertNumber(a);AdfAssert.assertNumber(b);var f=this.__getDataBody();a=this._getDispayDropIndexFromCoordinates(this.getComponent(),f,a,b,e);d[AdfStampedDropTarget.ROW_KEY]=null!=a?a:null;d[AdfStampedDropTarget.DROP_ORIENTATION]=AdfDropEvent.DROP_ORIENTATION_INSIDE};
AdfDhtmlPanelDashboardPeer.prototype.__getDataBody=function(){var a=this.getDomElement(),a=AdfDomUtils.getFirstChildElement(a);AdfAssert.assertDomElement(a);return a};
AdfDhtmlPanelDashboardPeer.prototype._animateReorderPositionTo=function(a,b,d){null!=this._animator&&this._animator.stop();var e=this.__getDataBody(),f=AdfDomUtils.getChildElements(e),g=f.length;if(0!=g){for(var e=[],h=a.getColumns(),k=this._getChildWidthInPixels(a),l=this._getChildHeightInPixels(a),m=null==d,n=0;n<g;n++){var p=f[n],q={};n==b&&(p.style.display=m?"":"none");if(n!=b){var r=n;m||(null!=b&&r>b&&r--,r>=d&&r++);var s=r%h,r=Math.floor(r/h),u=AdfPage.PAGE.getLocaleContext().isRightToLeft();
u?(p.style.left=p.offsetLeft+"px",p.style.right="auto",q.offsetLeft=(h-1-s)*k):q.offsetLeft=s*k;this._preventDiagonalMovement(p,s,r,h,k,l,u);q.offsetTop=r*l}e[n]={element:p,properties:q}}var t,v;a=a.getClientId();null==d?(t=AdfDhtmlPanelDashboardPeer._resetChildrenPositioningStyles,v=[this,null]):null==b&&AdfDhtmlPanelDashboardPeer._adjustShim(e,a,h,l,g+1);b=parseInt(AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|panelDashboard-tr-reorder-animation-duration"));isNaN(b)&&(b=0);d=null;AdfDhtmlPanelDashboardPeer._isDimensionsFromChildren(a)&&
(d=this.getComponent());this._animator=AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_SLOW_FAST_SLOW,b,e,null,t,v,d)}};AdfDhtmlPanelDashboardPeer.prototype._preventDiagonalMovement=function(a,b,d,e,f,g,h){g*=d;a.offsetTop!=g&&(d=a.style,d.top=g+"px",b>=Math.floor(e/2)?h?(a.style.right="auto",d.left=-f+"px"):d.left=e*f+"px":h?(a.style.right="auto",d.left=e*f+"px"):d.left=-f+"px")};
AdfDhtmlPanelDashboardPeer.prototype._getChildWidthInPixels=function(a){var b=this.__getDataBody(),d=AdfDomUtils.getChildElements(b).length;if(this._cachedChildWidthInPixels&&d==this._cachedChildCount)return this._cachedChildWidthInPixels;a=a.getColumns();this._cachedChildWidthInPixels=Math.floor(b.offsetWidth/a);this._cachedChildCount=d;return this._cachedChildWidthInPixels};
AdfDhtmlPanelDashboardPeer.prototype._getChildHeightInPixels=function(a){if(this._cachedChildHeightInPixels)return this._cachedChildHeightInPixels;a=a.getRowHeight();var b=a.replace(/[0-9]/g,"");if("px"==b)a=parseInt(a.substring(0,a.length-b.length));else if(a=this.__getDataBody(),a=AdfDomUtils.getChildElements(a),0<a.length)a=a[0].offsetHeight;else return 20;return this._cachedChildHeightInPixels=a};
AdfDhtmlPanelDashboardPeer.prototype._deleteElements=function(a,b){if(null!=a){var d=this.__getDataBody(),e;for(e=0;e<a.length;e++){var f=a[e];b||(AdfPage.PAGE.removeComponentsInSubtree(f),AdfAgent.AGENT.elementsRemoved(f));d.removeChild(f)}}};
AdfDhtmlPanelDashboardPeer._resetChildrenPositioningStyles=function(a,b,d){var e=a[0];if(e.getDomElement()){e._deleteElements(a[1],!1);var f=e.__getDataBody();null!=b&&b!=d&&(a=AdfDomUtils.getChildElements(f),b=a[b],f.removeChild(b),a=AdfDomUtils.getChildElements(f),d<a.length?f.insertBefore(b,a[d]):f.appendChild(b),b.style.display="");a=AdfDomUtils.getChildElements(f);d=a.length;e=e.getComponent();b=e.getColumns();var f=e.getRowHeight(),g=f.replace(/[0-9]/g,""),h=f.substring(0,f.length-g.length),
h=parseFloat(h),k=AdfDhtmlPanelDashboardPeer._formatPercent(1/b);for(i=0;i<d;i++){var l=AdfDhtmlPanelDashboardPeer._formatPercent(i%b/b),m=a[i].style;m.top=h*Math.floor(i/b)+g;AdfPage.PAGE.getLocaleContext().isRightToLeft()?(m.left="auto",m.right=l):m.left=l;m.height=f;m.width=k}a=e.getClientId();AdfDhtmlPanelDashboardPeer._adjustShim(null,a,b,h,d);this._processingOptimizedChanges=!1;AdfPage.PAGE.doResizeNotify(e)}};
AdfDhtmlPanelDashboardPeer._formatPercent=function(a){a=""+100*a;var b=a.length,d=a.indexOf(".");-1!=d&&d<b-2&&(a=a.substring(0,d+3));return a+"%"};
AdfDhtmlPanelDashboardPeer.prototype._workaroundForInternetExplorer=function(a){if(AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM){var b=this.getDomElement(),d=b.scrollWidth;null==a&&(a=b.offsetWidth);d>a&&(b=this.__getDataBody(),AdfDhtmlPanelDashboardPeer._scrollBarWidth||(AdfDhtmlPanelDashboardPeer._scrollBarWidth=d-a+2+"px"),AdfPage.PAGE.getLocaleContext().isRightToLeft()||(b.style.right=AdfDhtmlPanelDashboardPeer._scrollBarWidth))}};