function AdfColumnDropTarget(){this.Init()}AdfObject.createSubclass(AdfColumnDropTarget,AdfDropTarget);AdfColumnDropTarget.prototype.Init=function(){AdfColumnDropTarget.superclass.Init.call(this,AdfDnDContext.ACTION_MOVE)};AdfColumnDropTarget.prototype.dragExit=function(a){this._removeUserFeedback(a);return AdfColumnDropTarget.superclass.dragExit.apply(this,arguments)};AdfColumnDropTarget.prototype.GetAllowedActions=function(a){return AdfDnDContext.ACTION_MOVE};
AdfColumnDropTarget.prototype.drop=function(a,b,d,e){this._removeUserFeedback(a);if(null==a._targetReorderId||null==a._insertColumnAfter)return AdfDnDContext.ACTION_NONE;d=this.getComponent();b=this._getDragColumn(a);d=this._getTable(d);b=new AdfTableShowColumnsEvent(d,b.getClientId(),"reorderColumn");b.setTargetColumnId(a._targetReorderId);b.setAfterTarget(a._insertColumnAfter);b.queue();delete a._targetReorderId;delete a._insertColumnAfter;return AdfDnDContext.ACTION_NONE};
AdfColumnDropTarget.prototype.GetAllowedFlavors=function(a){return[AdfColumnDropTarget._FLAVOR]};AdfColumnDropTarget.prototype.acceptDragEnter=function(a,b,d,e){var f=AdfColumnDropTarget.superclass.acceptDragEnter.apply(this,arguments);if(f!=AdfDnDContext.ACTION_NONE){if(!this._isDragAllowed(a))return AdfDnDContext.ACTION_NONE;this._applyUserFeedback(a,d,e)}return f};
AdfColumnDropTarget.prototype.acceptDragOver=function(a,b,d,e){var f=AdfColumnDropTarget.superclass.acceptDragOver.apply(this,arguments);if(f!=AdfDnDContext.ACTION_NONE){if(!this._isDragAllowed(a))return AdfDnDContext.ACTION_NONE;this._positionColumnDropTarget(a,d,e)}return f};AdfColumnDropTarget.prototype._isDragAllowed=function(a){var b=this.getComponent();a=this._getDragColumn(a);return null==a||a==b||this._getTable(a)!=this._getTable(b)?!1:!0};
AdfColumnDropTarget.prototype._getTable=function(a){for(;null!=a;a=a.getParent())if(a instanceof AdfRichTable)return a;return null};AdfColumnDropTarget.prototype._getDragColumn=function(a){(a=a.getTransferable().getTransferData(AdfColumnDropTarget._FLAVOR))&&(a=a[0]);return a instanceof AdfRichColumn?a:null};AdfColumnDropTarget.prototype._applyUserFeedback=function(a,b,d){var e=this.getComponent();this._columnDropTarget=this._createColumnDropTarget(e);this._positionColumnDropTarget(a,b,d)};
AdfColumnDropTarget.prototype._createColumnReorderTracker=function(a){var b=this._getTable(a);a=AdfRichUIPeer.getDomContentElementForComponent(a);var d=AdfRichUIPeer.getDomContentElementForComponent(b),e=d.ownerDocument,b=e.createElement("div"),f=b.style;d.appendChild(b);f.position="absolute";f.overflow="hidden";f.zIndex=1E3;d=e.createElement("table");b.appendChild(d);d=d.insertRow(-1);e=a.cloneNode(!0);e.style.height=a.offsetHeight+"px";e.style.width=a.offsetWidth+"px";d.appendChild(e);AdfAgent.AGENT.setOpacity(b,
90);return b};
AdfColumnDropTarget.prototype._positionColumnDropTarget=function(a,b,d){d=AdfPage.PAGE.getLocaleContext().isRightToLeft();var e=this.getComponent(),f=this._getTable(e),g=AdfRichUIPeer.getDomContentElementForComponent(f),e=this._columnDropTarget,h=e.style,k=AdfAgent.AGENT.getElementPosition(g);b=Math.max(b-k.x,0);var l=f.getPeer(),f=l.__getColumnHeader(),m,n=AdfDhtmlTableBasePeer.__getChildBySubId(f,"t"),q,r=l.__getLastFrozen();0<=r&&(m=AdfDhtmlTableBasePeer.__getChildBySubId(f,"d2"),q=AdfDhtmlTableBasePeer.__getChildBySubId(m,
"t2"));var t,f=0,k=null,u=l.__getCurrentScrollLeft();d?(t=g.offsetWidth-n.offsetWidth,m&&b<=t?(t=q,f=-this._currentScrollLeft,m=l.__getScrollerDimensions(),l.__getScrollDimensions().scrollHeight>m.offsetHeight&&(f+=m.offsetWidth-m.clientWidth)):(g.offsetWidth>n.offsetWidth&&(f=g.offsetWidth-n.offsetWidth),t=n)):b<=n.offsetWidth?t=n:m&&(f=n.offsetWidth,f-=u,t=q);if(null!=t){-1==r&&(f-=u);for(m=n.rows.length-1;0<=m;--m)for(q=t.rows[m].cells,g=q.length,l=0;l<g;++l)if(n=q[l],n.getAttribute("_afrRoot")&&
null==n.getAttribute("_afrRH"))if(cellLeft=n.offsetLeft+f,cellRight=cellLeft+n.offsetWidth,b>=cellLeft&&b<=cellRight-n.offsetWidth/2){a._insertColumnAfter=d;a._targetReorderId=n.id;k=cellLeft-e.offsetWidth/2;break}else if(b>=cellLeft&&b<=cellRight){a._insertColumnAfter=!d;a._targetReorderId=n.id;k=cellRight-e.offsetWidth/2;break}null!=k&&(h.left=Math.max(k,0)+"px")}};
AdfColumnDropTarget.prototype._createColumnDropTarget=function(a){a=this._getTable(a);a=AdfRichUIPeer.getDomContentElementForComponent(a);var b=a.ownerDocument.createElement("div");b.className=AdfColumnDropTarget._COL_DROP_TAGET_CLASS;var d=b.style;d.position="absolute";d.width="10px";d.overflow="hidden";d.top="0px";d.zIndex=1E3;d.height=a.offsetHeight+"px";AdfAgent.AGENT.setOpacity(b,80);a.appendChild(b);return b};
AdfColumnDropTarget.prototype._removeUserFeedback=function(a){a=this._getTable(this.getComponent());a=AdfRichUIPeer.getDomContentElementForComponent(a);null!=this._columnDropTarget&&(a.removeChild(this._columnDropTarget),delete this._columnDropTarget)};AdfColumnDropTarget._FLAVOR=AdfDataFlavor.getDataFlavorForClass(AdfUIComponent,"AdfRichColumn");AdfColumnDropTarget._COL_DROP_TAGET_CLASS="AFColumnDropTarget";