function AdfRepositionable(a,b){this.Init(a,b)}AdfObject.createSubclass(AdfRepositionable);AdfRepositionable.InitClass=function(){var a=this.prototype;a.NORMAL=0;a.START_DRAGGING=1;a.DRAGGING=2};
AdfRepositionable.prototype.Init=function(a,b){AdfRepositionable.superclass.Init.call(this);this._floatingElement=a;this._handle=b;var d=AdfAgent.AGENT;this._mousedownStub=this.createCallback(this._mouseDownHandler);this._mousemoveStub=this.createCallback(this._mouseMoveHandler);this._mouseupStub=this.createCallback(this._stopDragging);d.getCapabilities();d.addBubbleEventListener(this._handle,"touchstart",this._mousedownStub);d.addBubbleEventListener(this._handle,"mousedown",this._mousedownStub);
d.disableUserSelect(b);this._mouseStartY=this._mouseStartX=this._originalLeftPosition=this._originalTopPosition=null;this._state=this.NORMAL};AdfRepositionable.prototype.destroy=function(){var a=AdfAgent.AGENT;a.removeBubbleEventListener(this._handle,"touchstart",this._mousedownStub);a.removeBubbleEventListener(this._handle,"mousedown",this._mousedownStub);this._state!=this.NORMAL&&AdfPage.PAGE.stopDrag()};AdfRepositionable.prototype.getElement=function(){return this._floatingElement.getElement()};
AdfRepositionable.prototype._mouseDownHandler=function(a){var b=AdfPage.PAGE;if(!b.isDragging()){var d=AdfAgent.AGENT;a=a||d.getDomWindow().event;if(!(a instanceof MouseEvent)||d.isLeftButton(a)){this._state=this.START_DRAGGING;d.preventDefault(a);var e=d.getEventTarget(a);AdfPage.PAGE.getAutoDismissalManager().dismiss(e);if(d.getPlatform()==AdfAgent.IE_PLATFORM){d=this._handle;try{d.setActive()}catch(f){AdfLogger.LOGGER.fine("Could not restore focus to handle:",d.id?d.id:"unknown")}}b.startDrag(a,
this._mousemoveStub,this._mouseupStub,null,!0)}}};
AdfRepositionable.prototype._mouseMoveHandler=function(a,b,d){var e=AdfAgent.AGENT;a=e.getMousePosition(a);if(this._state==this.START_DRAGGING){this._onDragStart.apply(this._floatingElement);this._state=this.DRAGGING;this._mouseStartX=a.x;this._mouseStartY=a.y;this._originalLeftPosition=parseInt(this._floatingElement.getLeft());this._originalTopPosition=parseInt(this._floatingElement.getTop());this._moveDeltaY=this._moveDeltaX=0;this._originalLeftPosition||(this._originalLeftPosition=0);this._originalTopPosition||
(this._originalTopPosition=0);var f=AdfPage.PAGE.getDomDocument().documentElement,g=e.getPlatform()==AdfAgent.IE_PLATFORM,h=AdfPage.PAGE.getLocaleContext().isRightToLeft(),k=e.getDomWindow();a=e.getWindowScrollWidth(k);var e=e.getWindowScrollHeight(k),k=AdfDhtmlShadowDecorator.getShadowSize(),l=h?k:0;g&&h&&(f=f.scrollWidth-f.clientWidth,l-=f,a-=f);this._minLeft=l;f=this.getElement();this._wiggleWidth=a-f.offsetWidth-2*k;this._wiggleHeight=e-f.offsetHeight-2*k}this._state==this.DRAGGING&&(b=this._moveDeltaX+=
b,d=this._moveDeltaY+=d,this._move(b,d))};AdfRepositionable.prototype._stopDragging=function(a,b,d){this._mouseStartY=this._mouseStartX=this._originalTopPosition=this._originalLeftPosition=null;this._state==this.DRAGGING&&this._onDragEnd.apply(this._floatingElement);this._state=this.NORMAL};
AdfRepositionable.prototype._move=function(a,b){var d=this._originalLeftPosition+a,e=this._originalTopPosition+b,f=this._minLeft,g=this._wiggleWidth,h=this._wiggleHeight,d=d>f?Math.min(d,g):f,e=0<e?Math.min(e,h):0;this._floatingElement.setPosition(e,d);this._onDrag()};AdfRepositionable.prototype.setDragStartHandler=function(a){this._onDragStart=a};AdfRepositionable.prototype.setDragEndHandler=function(a){this._onDragEnd=a};AdfRepositionable.prototype.setDragHandler=function(a){this._onDrag=a};
AdfRepositionable.prototype._onDragStart=function(){};AdfRepositionable.prototype._onDragEnd=function(){};AdfRepositionable.prototype._onDrag=function(){};