function AdfDhtmlDnDContext() {
  this.Init();
}
AdfObject.createSubclass(AdfDhtmlDnDContext, AdfDnDContext);
AdfDhtmlDnDContext.prototype.Init = function() {
  AdfDhtmlDnDContext.superclass.Init.call(this);
  this._clearDrag();
  this._dropTargetComponents = new Array;
  this._isAndroid = AdfAgent.AGENT.getOS() == AdfAgent.ANDROID_OS;
};
AdfDhtmlDnDContext.InitClass = function() {
  var agent = AdfAgent.AGENT;
  this._NOT_ALLOWED_CURSOR = agent.getCursor("not-allowed");
  this._LINK_CURSOR = agent.getCursor("alias");
  this._COPY_CURSOR = agent.getCursor("copy");
  this._MOVE_CURSOR = agent.getCursor("default");
  this._INHERIT_CURSOR = agent.getCursor("inherit");
};
AdfDhtmlDnDContext.prototype.__addComponentTarget = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  AdfAssert.assertPrototype(component.getDropTarget(), AdfDropTarget);
  this._dropTargetComponents.push(component);
  AdfLogger.LOGGER.finer("Add drop component", component, " New count:", this._dropTargetComponents.length);
};
AdfDhtmlDnDContext.prototype.__removeComponentTarget = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  var removedIndex = AdfCollections.removeArrayValue(this._dropTargetComponents, component);
  AdfLogger.LOGGER.finer("Remove drop component", component, " New count:", this._dropTargetComponents.length);
  AdfAssert.assert(removedIndex != -1, "Could not find component in components array");
  var lastDropTarget = this._lastDropTarget;
  if (lastDropTarget && lastDropTarget.getComponent() === component) {
    this._lastDropTarget = null;
  }
};
AdfDhtmlDnDContext.prototype.__removeDragSource = function(component) {
  AdfAssert.assertPrototype(component, AdfUIComponent);
  var dragSource = this._dragSource;
  if (dragSource) {
    var sourceComponent = dragSource.getComponent();
    if (sourceComponent == component) {
      this._dragSource = null;
    }
  }
};
AdfDhtmlDnDContext.prototype.isDragging = function() {
  return this._draggingContext != null;
};
AdfDhtmlDnDContext.prototype.__isDragPrepped = function() {
  return this._prepContext != null;
};
AdfDhtmlDnDContext.prototype.getDragSource = function() {
  return this._dragSource;
};
AdfDhtmlDnDContext.prototype.getTransferable = function() {
  var draggingContext = this._draggingContext;
  if (draggingContext) {
    return draggingContext._transferable;
  } else {
    return null;
  }
};
AdfDhtmlDnDContext.prototype.getSourceActions = function() {
  var draggingContext = this._draggingContext;
  if (draggingContext) {
    return draggingContext._sourceActions;
  } else {
    return AdfDnDContext.ACTION_NONE;
  }
};
AdfDhtmlDnDContext.prototype.getUserAction = function() {
  var draggingContext = this._draggingContext;
  if (draggingContext) {
    return draggingContext._userAction;
  } else {
    return AdfDnDContext.ACTION_NONE;
  }
};
AdfDhtmlDnDContext.prototype.setDropTargetProperty = function(name, value) {
  AdfAssert.assertString(name);
  var draggingContext = this._draggingContext;
  AdfAssert.assert(draggingContext, "setDropTargetProperty only allowed when dragging");
  AdfAssert.assertString(name);
  var currTargetProperties = draggingContext._currDropProperties;
  AdfAssert.assert(currTargetProperties, "setAdfDropTargetProperty only allowed when we have a possible DropTarget");
  currTargetProperties[name] = value;
};
AdfDhtmlDnDContext.prototype.getDropTargetProperty = function(name) {
  AdfAssert.assertString(name);
  var draggingContext = this._draggingContext;
  AdfAssert.assert(draggingContext, "getDropTargetProperty only allowed when dragging");
  var currTargetProperties = draggingContext._currDropProperties;
  AdfAssert.assert(currTargetProperties, "getAdfDropTargetProperty only allowed when we have a possible DropTarget");
  return currTargetProperties[name];
};
AdfDhtmlDnDContext.prototype.getTriggerEvent = function() {
  var draggingContext = this._draggingContext;
  if (draggingContext) {
    return draggingContext._triggerEvent;
  } else {
    return null;
  }
};
AdfDhtmlDnDContext.prototype.startDrag = function(triggerEvent, transferable, allowedActions, defaultAction, dragOverNode, cursorOffsetX, cursorOffsetY, cursor) {
  AdfAssert.assertPrototype(triggerEvent, AdfDomUIInputEvent);
  AdfAssert.assertPrototype(transferable, AdfTransferable);
  AdfAssert.assert(this._draggingContext == null, "Already dragging");
  AdfAssert.assertNumeric(allowedActions);
  AdfAssert.assert(allowedActions != AdfDnDContext.ACTION_NONE, "At least one action must be allowed");
  AdfAssert.assert((allowedActions & ~AdfDnDContext.ACTIONS_ALL) == 0, "allowedActions includes an undefined action flag");
  var dragSource = this._dragSource;
  this._dragSourceObj = dragSource.applyDragSourceState(triggerEvent);
  if (defaultAction == undefined) {
    defaultAction = allowedActions & AdfDnDContext.ACTION_MOVE ? AdfDnDContext.ACTION_MOVE : allowedActions & AdfDnDContext.ACTION_COPY ? AdfDnDContext.ACTION_COPY : AdfDnDContext.ACTION_LINK;
  }
  AdfAssert.assert(defaultAction == AdfDnDContext.ACTION_MOVE || defaultAction == AdfDnDContext.ACTION_COPY || defaultAction == AdfDnDContext.ACTION_LINK, "defaultAction contains an invalid value");
  AdfAssert.assert((allowedActions & defaultAction) != 0, "Default action not an allowed action");
  AdfAssert.assertNumeric(cursorOffsetX);
  AdfAssert.assertNumeric(cursorOffsetY);
  if (cursor == "auto") {
    cursor = null;
  }
  var draggingContext = new Object;
  draggingContext._triggerEvent = triggerEvent;
  draggingContext._transferable = transferable;
  draggingContext._sourceActions = allowedActions;
  draggingContext._cursor = cursor;
  draggingContext._userAction = AdfDnDContext.ACTION_NONE;
  draggingContext._defaultAction = defaultAction;
  draggingContext._autoscrollTimerID = null;
  draggingContext._dropTarget = null;
  draggingContext._lastDropTarget = null;
  draggingContext._dropProperties = new Object;
  draggingContext._currDropProperties = null;
  draggingContext._lastMousePage = null;
  this._draggingContext = draggingContext;
  AdfAssert.assert(!this._pendingMouseUp);
  this._pendingMouseUp = false;
  AdfLogger.LOGGER.finer("start drag: transferable:", transferable);
  if (dragOverNode) {
    var dragger = this._getDragDiv();
    var richPage = AdfPage.PAGE;
    if (!dragOverNode.dir && richPage.getLocaleContext().isRightToLeft()) {
      dragOverNode.dir = "rtl";
    }
    richPage.showFloatingDiv(dragger, dragOverNode);
    var dragWidth = dragOverNode.offsetWidth;
    var dragHeight = dragOverNode.offsetHeight;
    draggingContext._dragWidth = dragWidth;
    draggingContext._dragHeight = dragHeight;
    draggingContext._originX = cursorOffsetX < 0 ? 0 : dragWidth < cursorOffsetX ? dragWidth : cursorOffsetX;
    draggingContext._originY = cursorOffsetY < 0 ? 0 : dragHeight < cursorOffsetY ? dragHeight : cursorOffsetY;
  } else {
    dragger = null;
    draggingContext._dragWidth = 0;
    draggingContext._dragHeight = 0;
    draggingContext._originX = 0;
    draggingContext._originY = 0;
  }
  draggingContext._dragger = dragger;
  AdfPage.PAGE.showGlassPane(this._getCaptureMap(), "no-drop");
};
AdfDhtmlDnDContext.prototype._abortDrag = function() {
  AdfAssert.assert(this._dragSource, "Aborting drag from an invalid drag state");
  AdfLogger.LOGGER.fine("Abort drag of:", this._dragSource);
  var draggingContext = this._draggingContext;
  if (draggingContext) {
    draggingContext._userAction = AdfDnDContext.ACTION_NONE;
    var dropTarget = draggingContext._dropTarget;
    if (dropTarget) {
      try {
        dropTarget.dragExit(this);
      } catch (e) {
        AdfLogger.LOGGER.logErrorAsWarning(e, "DropTarget.dragExit() failed");
      }
      this._changeActiveDropCSSClass(dropTarget, false);
    }
    this._dragComplete(false);
  } else {
    if (this._prepContext) {
      this._clearDrag();
    }
  }
};
AdfDhtmlDnDContext.prototype.__handleInputEvent = function(inputEvent) {
  AdfAssert.assertPrototype(inputEvent, AdfUIInputEvent);
  var logger = AdfLogger.LOGGER;
  var draggingContext = this._draggingContext;
  if (!draggingContext) {
    if (!this._prepContext && AdfAgent.AGENT.isDragPrepEvent(inputEvent)) {
      this._dragSource = this._findDragSource(inputEvent);
    }
    var dragSource = this._dragSource;
    if (dragSource) {
      var recognizer = dragSource.getDragRecognizer();
      prepContext = this._prepContext;
      if (prepContext) {
        AdfPage.PAGE.getGlassPane();
        var abort = true;
        try {
          abort = recognizer.abortPrep(prepContext, inputEvent);
        } catch (e) {
          logger.logErrorAsWarning(e, "Recognizer abort prep failed");
        }
        if (abort) {
          this._abortDrag();
          var originalEvent = prepContext.triggerEvent;
          var targetNode = originalEvent.getNativeEventTarget();
          if (AdfFocusUtils.isFocusable(targetNode) && !AdfFocusUtils.containsFocus()) {
            AdfFocusUtils.focusElement(targetNode);
          }
        } else {
          logger.finest("recognize drag for ", prepContext, " ", inputEvent);
          var triggerEvent = null;
          try {
            triggerEvent = recognizer.recognizeDrag(prepContext, inputEvent);
          } catch (e) {
            logger.logErrorAsWarning(e, "Drag recognition failed");
          }
          if (triggerEvent) {
            this._prepContext = null;
            logger.fine("initiate drag of ", dragSource, " for event:", triggerEvent);
            AdfAgent.AGENT.disableUserSelect(AdfPage.PAGE.getDocument().body);
            try {
              dragSource.initiateDrag(this, triggerEvent);
            } catch (e) {
              logger.logErrorAsWarning(e, "Drag initiation failed");
              throw e;
            }
            if (this._draggingContext != null) {
              this._trackDrag(inputEvent.getNativeEvent());
            }
          }
        }
      } else {
        var prepContext = null;
        try {
          prepContext = recognizer.prepDrag(this, dragSource, inputEvent);
        } catch (e) {
          logger.logErrorAsWarning(e, "Drag prep failed");
        }
        if (prepContext) {
          logger.finer("drag prep context:", prepContext);
          this._prepContext = prepContext;
        }
      }
    }
  }
};
AdfDhtmlDnDContext.prototype._setCursor = function(newCursor) {
  AdfAssert.assertString(newCursor);
  AdfLogger.LOGGER.finer("Set cursor to:", newCursor);
  AdfAgent.AGENT.setCursor(AdfPage.PAGE.getGlassPane(), newCursor);
};
AdfDhtmlDnDContext.prototype._findDragSource = function(inputEvent) {
  AdfAssert.assertPrototype(inputEvent, AdfUIInputEvent);
  var newDragSource = this._findContainingDragSource(inputEvent);
  AdfAssert.assertPrototypeOrNull(newDragSource, AdfDragSource);
  var oldDragSource = this._dragSource;
  AdfAssert.assertPrototypeOrNull(newDragSource, AdfDragSource);
  if (newDragSource != oldDragSource) {
    AdfLogger.LOGGER.finest("Change drag source from:", oldDragSource, " to ", newDragSource);
    return newDragSource;
  }
  return oldDragSource;
};
AdfDhtmlDnDContext.prototype._findContainingDragSource = function(inputEvent) {
  AdfAssert.assertPrototype(inputEvent, AdfUIInputEvent);
  var currComponent = inputEvent.getSource();
  AdfAssert.assertPrototype(currComponent, AdfUIComponent);
  var richPopupType = "oracle.adf.RichPopup";
  while (currComponent != null && richPopupType !== currComponent.getComponentType()) {
    var dragSource = currComponent.getDragSource();
    if (dragSource) {
      try {
        if (dragSource.isAvailable(this, inputEvent)) {
          return dragSource;
        }
      } catch (e) {
        AdfLogger.LOGGER.logErrorAsWarning(e, "dragSource.isAvailable() failed");
      }
    }
    currComponent = currComponent.getParent();
  }
  return null;
};
AdfDhtmlDnDContext.prototype._findDropTarget = function(oldDropTarget, pageX, pageY) {
  var dropTargetComponents = this._dropTargetComponents;
  var dropTargetCount = dropTargetComponents.length;
  for (var i = dropTargetCount - 1;i >= 0;i--) {
    var currComponent = dropTargetComponents[i];
    if (AdfDhtmlDnDContext._pointInDropTarget(currComponent, pageX, pageY)) {
      return currComponent.getDropTarget();
    }
  }
  return null;
};
AdfDhtmlDnDContext._pointInDropTarget = function(component, pageX, pageY) {
  var domElement = AdfRichUIPeer.getDomElementForComponent(component);
  return domElement ? AdfAgent.AGENT.pointInElementOrChildBounds(domElement, pageX, pageY) : false;
};
AdfDhtmlDnDContext.prototype._getDragDiv = function() {
  if (!this._dragDiv) {
    var richPage = AdfPage.PAGE;
    var zIndex = AdfDhtmlZOrderManager.getMaxZIndex();
    this._dragDiv = richPage.createFloatingDiv(richPage.getDocument().body, zIndex, "DragContent");
    this._dragDiv.dir = "ltr";
  }
  return this._dragDiv;
};
AdfDhtmlDnDContext.prototype._clearDrag = function() {
  AdfAgent.AGENT.enableUserSelect(AdfPage.PAGE.getDocument().body);
  this._dragSource = null;
  this._prepContext = null;
  this._draggingContext = null;
};
AdfDhtmlDnDContext.prototype.toDebugString = function() {
  return AdfDhtmlDnDContext.superclass.toDebugString.call(this) + "[" + " dragSource:" + this._dragSource + " prepContext:" + this._prepContext + " drag context:" + this._draggingContext + " drag div:" + this._dragDiv + "]";
};
AdfDhtmlDnDContext.prototype._trackDrag = function(event) {
  if (this._pendingMouseUp) {
    return;
  }
  var draggingContext = this._draggingContext;
  AdfAssert.assert(draggingContext, "Not in dragging state");
  var agent = AdfAgent.AGENT;
  var mousePage = agent.getMousePosition(event);
  draggingContext._lastMousePage = mousePage;
  var oldDropTarget = draggingContext._dropTarget;
  var lastDropTarget = this._lastDropTarget;
  var proposedDropTarget = oldDropTarget ? oldDropTarget : lastDropTarget ? lastDropTarget : null;
  var newDropTarget = this._findDropTarget(proposedDropTarget, mousePage.x, mousePage.y);
  AdfAssert.assertPrototypeOrNull(newDropTarget, AdfDropTarget);
  var dragSource = this._dragSource;
  var logger = AdfLogger.LOGGER;
  if (newDropTarget != oldDropTarget) {
    logger.finest("Attempt to change drop target changed from:", oldDropTarget, " to ", newDropTarget);
    if (oldDropTarget) {
      this._setUserAction(AdfDnDContext.ACTION_NONE, false);
    }
    if (newDropTarget) {
      this._lastDropTarget = newDropTarget;
      var dropTargetID = newDropTarget.getComponent().getClientId();
      var dropProperties = draggingContext._dropProperties;
      var currDropProperties = dropProperties[dropTargetID];
      if (!currDropProperties) {
        currDropProperties = new Object;
        dropProperties[dropTargetID] = currDropProperties;
      }
      draggingContext._currDropProperties = currDropProperties;
      this._acceptDrag(newDropTarget, event, "acceptDragEnter", mousePage);
      if (draggingContext._userAction != AdfDnDContext.ACTION_NONE) {
        if (AdfAssert.DEBUG) {
          logger.finest("New drop target:", newDropTarget);
        }
        draggingContext._dropTarget = newDropTarget;
        this._changeActiveDropCSSClass(newDropTarget, true);
        try {
          dragSource.dragEnter(this);
        } catch (e) {
          logger.logErrorAsWarning(e, "dragSource.isAvailable() failed");
        }
      }
    }
  } else {
    if (newDropTarget) {
      this._acceptDrag(newDropTarget, event, "acceptDragOver", mousePage);
      if (draggingContext._userAction != AdfDnDContext.ACTION_NONE) {
        try {
          dragSource.dragOver(this);
        } catch (e) {
          logger.logErrorAsWarning(e, "dragSource.dragOver() failed");
        }
      }
    }
  }
  var dragX = mousePage.x - draggingContext._originX;
  if (dragX < 0) {
    dragX = 0;
  }
  var dragY = mousePage.y - draggingContext._originY;
  if (dragY < 0) {
    dragY = 0;
  }
  if (draggingContext._dragger) {
    var draggerStyle = draggingContext._dragger.style;
    var dragRight = dragX + draggingContext._dragWidth;
    var dragBottom = dragY + draggingContext._dragHeight;
    var window = agent.getDomWindow();
    dragRight -= agent.getWindowScrollWidth(window);
    dragBottom -= agent.getWindowScrollHeight(window);
    if (dragRight > 0) {
      dragX -= dragRight;
    }
    if (dragBottom > 0) {
      dragY -= dragBottom;
    }
    draggerStyle.left = dragX + "px";
    draggerStyle.top = dragY + "px";
  }
  draggingContext._dragPageX = dragX;
  draggingContext._dragPageY = dragY;
};
AdfDhtmlDnDContext.prototype._acceptDrag = function(dropTarget, event, dropTargetFuncName, mousePage) {
  AdfAssert.assertPrototype(dropTarget, AdfDropTarget);
  if (mousePage == null) {
    mousePage = AdfAgent.AGENT.getMousePosition(event);
  }
  var proposedAction = AdfDnDContext.ACTION_NONE;
  var draggingContext = this._draggingContext;
  AdfAssert.assert(draggingContext, "No dragging context");
  if (event.ctrlKey && event.shiftKey) {
    proposedAction = AdfDnDContext.ACTION_LINK;
  } else {
    if (event.ctrlKey) {
      proposedAction = AdfDnDContext.ACTION_COPY;
    } else {
      if (event.shiftKey) {
        proposedAction = AdfDnDContext.ACTION_MOVE;
      }
    }
  }
  proposedAction &= draggingContext._sourceActions;
  if (proposedAction == AdfDnDContext.ACTION_NONE) {
    proposedAction = draggingContext._defaultAction;
  }
  var logger = AdfLogger.LOGGER;
  logger.finest("Initial Proposed action:", proposedAction);
  var userAction = AdfDnDContext.ACTION_NONE;
  try {
    userAction = dropTarget[dropTargetFuncName](this, proposedAction, mousePage.x, mousePage.y);
    if (AdfAssert.DEBUG) {
      AdfDnDContext.assertUserAction(userAction);
    }
  } catch (e) {
    logger.logErrorAsWarning(e, "DropTarget." + dropTargetFuncName + "() failed");
  }
  logger.finest("User action:", userAction);
  this._setUserAction(userAction, "acceptDropActionChanged" == dropTargetFuncName);
};
AdfDhtmlDnDContext.prototype._setUserAction = function(newUserAction, deliverDropActionChanged) {
  if (AdfAssert.DEBUG) {
    AdfDnDContext.assertUserAction(newUserAction);
  }
  var draggingContext = this._draggingContext;
  var oldUserAction = draggingContext._userAction;
  if (newUserAction != oldUserAction) {
    var logger = AdfLogger.LOGGER;
    draggingContext._userAction = newUserAction;
    var newCursor = "auto";
    switch(newUserAction) {
      case AdfDnDContext.ACTION_NONE:
        newCursor = AdfDhtmlDnDContext._NOT_ALLOWED_CURSOR;
        break;
      case AdfDnDContext.ACTION_LINK:
        newCursor = AdfDhtmlDnDContext._LINK_CURSOR;
        break;
      case AdfDnDContext.ACTION_COPY:
        newCursor = AdfDhtmlDnDContext._COPY_CURSOR;
        break;
      case AdfDnDContext.ACTION_MOVE:
        newCursor = AdfDhtmlDnDContext._MOVE_CURSOR;
        break;
    }
    logger.finer("New cursor:", newCursor);
    this._setCursor(newCursor);
    if (newUserAction != AdfDnDContext.ACTION_NONE) {
      if (deliverDropActionChanged) {
        try {
          this._dragSource.dropActionChanged(this);
        } catch (e) {
          logger.logErrorAsWarning(e, "dragSource.dropActionChanged() failed");
        }
      }
    } else {
      if (oldUserAction != AdfDnDContext.ACTION_NONE) {
        try {
          this._dragSource.dragExit(this);
        } catch (e) {
          logger.logErrorAsWarning(e, "dragSource.dragExit() failed");
        }
        var dropTarget = draggingContext._dropTarget;
        AdfAssert.assert(dropTarget, "Must have drop target if had user action");
        try {
          dropTarget.dragExit(this);
        } catch (e) {
          logger.logErrorAsWarning(e, "dropTarget.dragExit() failed");
        }
        logger.finer("Clear out old dropTarget:", dropTarget);
        this._changeActiveDropCSSClass(dropTarget, false);
        draggingContext._dropTarget = null;
        draggingContext._currDropProperties = null;
      }
    }
  }
};
AdfDhtmlDnDContext.prototype._changeActiveDropCSSClass = function(dropTarget, addClass) {
  AdfAssert.assertPrototype(dropTarget, AdfDropTarget);
  var targetComponent = dropTarget.getComponent();
  var targetPeer = targetComponent.getPeer();
  if (targetPeer != null) {
    targetPeer.bind(targetComponent);
    var func = addClass ? AdfDomUtils.addCSSClassName : AdfDomUtils.removeCSSClassName;
    func(targetPeer.getDomElement(), AdfRichUIPeer.DROP_TARGET_STYLECLASS);
  } else {
    AdfAssert.assert(addClass === false, "Orphanned component when adding CSS style");
  }
};
AdfDhtmlDnDContext.prototype._doDrop = function(event) {
  if (this._pendingMouseUp) {
    AdfPage.PAGE.hideGlassPane(this._getCaptureMap());
    this._pendingMouseUp = false;
    return;
  }
  var draggingContext = this._draggingContext;
  AdfAssert.assert(draggingContext, "Not in dragging state");
  if (draggingContext._userAction != AdfDnDContext.ACTION_NONE) {
    var dropTarget = draggingContext._dropTarget;
    AdfAssert.assert(dropTarget, "Must have a valid drop target to drop");
    var mousePage = AdfAgent.AGENT.getMousePosition(event);
    var result = AdfDnDContext.ACTION_NONE;
    try {
      result = dropTarget.drop(this, draggingContext._userAction, mousePage.x, mousePage.y);
      this._changeActiveDropCSSClass(dropTarget, false);
      if (AdfAssert.DEBUG) {
        AdfDnDContext.assertUserAction(result);
      }
    } catch (e) {
      AdfLogger.LOGGER.logErrorAsWarning(e, "dropTarget.drop() failed");
    }
    this._setUserAction(result, false);
  }
  this._dragComplete(true);
};
AdfDhtmlDnDContext.prototype._dragComplete = function(mouseReleased) {
  AdfAssert.assert(this._draggingContext, "Not in dragging state");
  var dragSource = this._dragSource;
  if (dragSource != null) {
    dragSource.clearDragSourceState(this._dragSourceObj);
    delete this._dragSourceObj;
    try {
      dragSource.dragDropEnd(this, this.getUserAction());
    } catch (e) {
      AdfLogger.LOGGER.logErrorAsWarning(e, "dragSource.dragDropEnd() failed");
    }
  }
  var agent = AdfAgent.AGENT;
  var richPage = AdfPage.PAGE;
  richPage.hideFloatingDiv(this._getDragDiv());
  this._clearDrag();
  if (agent.getPlatform() == AdfAgent.IE_PLATFORM && !mouseReleased) {
    this._pendingMouseUp = true;
  } else {
    richPage.hideGlassPane(this._getCaptureMap());
  }
};
AdfDhtmlDnDContext.prototype._abortEvent = function(event) {
  if (this._pendingMouseUp) {
    return;
  }
  this._abortDrag();
  AdfAgent.eatEventCallback(event);
};
AdfDhtmlDnDContext.prototype._checkAbort = function(event) {
  if (this._pendingMouseUp) {
    return;
  }
  AdfAssert.assert(this._draggingContext, "Not in dragging state");
  if (event.keyCode == 27) {
    this._abortEvent(event);
  } else {
    var draggingContext = this._draggingContext;
    var dropTarget = draggingContext._dropTarget;
    if (dropTarget) {
      this._acceptDrag(dropTarget, event, "acceptDropActionChanged", draggingContext._lastMousePage);
    }
  }
};
AdfDhtmlDnDContext._trackDragCallback = function(event) {
  AdfPage.PAGE.getDnDContext()._trackDrag(event);
  AdfAgent.eatEventCallback(event);
  return false;
};
AdfDhtmlDnDContext._doDropCallback = function(event) {
  AdfPage.PAGE.getDnDContext()._doDrop(event);
  AdfAgent.eatEventCallback(event);
  return false;
};
AdfDhtmlDnDContext._checkAbortCallback = function(event) {
  return AdfPage.PAGE.getDnDContext()._checkAbort(event);
};
AdfDhtmlDnDContext._abortCallback = function(event) {
  return AdfPage.PAGE.getDnDContext()._abortEvent(event);
};
AdfDhtmlDnDContext._updateDragOptionsCallback = function(event) {
  var dndContext = AdfPage.PAGE.getDnDContext();
  var dropTarget = dndContext._dropTarget;
  if (dropTarget) {
    dndContext._acceptDrag(dropTarget, event, "acceptDropActionChanged", this._lastMousePage);
  }
};
AdfDhtmlDnDContext._autoscrollCallback = function() {
  AdfPage.PAGE.getDnDContext()._autoscroll();
};
AdfDhtmlDnDContext._abortIfOutsideWindowCallback = function(event) {
  if (event.pageX === undefined) {
    return true;
  }
  var docBoundsElement = document.documentElement;
  if (docBoundsElement.offsetHeight == 0) {
    docBoundsElement = document.body;
  }
  if (!AdfAgent.AGENT.pointInElementBounds(docBoundsElement, event.clientX, event.clientY)) {
    AdfPage.PAGE.getDnDContext()._abortEvent(event);
    return false;
  } else {
    return true;
  }
};
AdfDhtmlDnDContext.prototype._getCaptureMap = function() {
  if (AdfDhtmlDnDContext._CAPTURE_MAP == null) {
    var isAndroid = this._isAndroid;
    if (isAndroid) {
      AdfDhtmlDnDContext._CAPTURE_MAP = {"touchmove":AdfDhtmlDnDContext._trackDragCallback, "touchend":AdfDhtmlDnDContext._doDropCallback, "touchstart":AdfDhtmlDnDContext._abortCallback};
    } else {
      AdfDhtmlDnDContext._CAPTURE_MAP = {"mouseout":AdfDhtmlDnDContext._abortIfOutsideWindowCallback, "mousemove":AdfDhtmlDnDContext._trackDragCallback, "mouseup":AdfDhtmlDnDContext._doDropCallback, "keydown":AdfDhtmlDnDContext._checkAbortCallback, "touchmove":AdfDhtmlDnDContext._trackDragCallback, "touchend":AdfDhtmlDnDContext._doDropCallback, "touchcancel":AdfDhtmlDnDContext._abortCallback, "touchstart":AdfDhtmlDnDContext._abortCallback, "keyup":AdfDhtmlDnDContext._updateDragOptionsCallback};
    }
  }
  return AdfDhtmlDnDContext._CAPTURE_MAP;
};
AdfDhtmlDnDContext._CAPTURE_MAP = null;
AdfPage.PAGE.__clearDnDContext();
