Print Friendly

Class Ext.dd.DragDropMgr

Package:Ext.dd
Class:DragDropMgr
Extends:Object
Defined In:DDCore.js
DragDropMgr is a singleton that tracks the element interaction for all DragDrop items in the window. Generally, you will not call this class directly, but it does have helper methods that could be useful in your DragDrop implementations.

This class is a singleton and cannot be created directly.

Properties   -  Methods   -  Events

Public Properties

Property Defined By
  INTERSECT : int DragDropMgr
<static> In intersect mode, drag and drop interactio nis defined by the overlap of two or more drag and drop ob...
  POINT : int DragDropMgr
<static> In point mode, drag and drop interaction is defined by the location of the cursor during the drag/drop
  clickPixelThresh : int DragDropMgr
<static> The number of pixels that the mouse needs to move after the mousedown before the drag is initiated. D...
  clickTimeThresh : int DragDropMgr
<static> The number of milliseconds after the mousedown event to initiate the drag if we don't get a mouseup ev...
  css : Object DragDropMgr
A reference to the style property
  el : Object DragDropMgr
The element
  id : Object DragDropMgr
The element id
  mode : int DragDropMgr
<static> The current drag and drop mode. Default: POINT
  preventDefault : boolean DragDropMgr
<static> Flag to determine if we should prevent the default behavior of the events we define. By default this i...
  stopPropagation : boolean DragDropMgr
<static> Flag to determine if we should stop the propagation of the events we generate. This is true by default...
  useCache : boolean DragDropMgr
<static> Set useCache to false if you want to force object the lookup of each drag and drop linked element cons...

Public Methods

Method Defined By
  getBestMatchDragDrop[] dds ) : DragDrop DragDropMgr
<static> Helper function for getting the best match from the list of drag and drop objects returned by the drag...
  getCssString id ) : Object DragDropMgr
Deprecated. <static> Returns the style property for the DOM element (i.e., document.getElById(id).style)
  getDDByIdString id ) : DragDrop DragDropMgr
<static> Returns the DragDrop instance for a given id
  getElementString id ) : Object DragDropMgr
Deprecated. <static> Returns the actual DOM element
  getLocationDragDrop oDD ) : Ext.lib.Region DragDropMgr
<static> Returns a Region object containing the drag and drop element's position and size, including the paddin...
  getPosXel the ) : int DragDropMgr
Deprecated. <static> Returns the X position of an html element
  getPosYel the ) : int DragDropMgr
Deprecated. <static> Returns the Y position of an html element
  getRelatedDragDrop p_oDD, boolean bTargetsOnly ) : DragDrop[] DragDropMgr
<static> Returns the drag and drop instances that are in all groups the passed in instance belongs to.
  getScrollLeft() : int DragDropMgr
<static> Gets the scrollLeft
  getScrollTop() : int DragDropMgr
<static> Gets the scrollTop
  getStyleHTMLElement el, string styleProp ) : string DragDropMgr
Deprecated. <static> Returns the specified element style property
  handleWasClickednode the ) : void DragDropMgr
<static> Recursively searches the immediate parent and all child nodes for the handle element in order to deter...
  isDragDropString id ) : boolean DragDropMgr
<static> Utility function to determine if a given element has been registered as a drag drop item.
  isHandleString id ) : boolean DragDropMgr
<static> Utility function to determine if a given element has been registered as a drag drop handle for the giv...
  isLegalTargetDragDrop the, DragDrop the ) : boolean DragDropMgr
<static> Returns true if the specified dd target is a legal target for the specifice drag obj
  isLocked() : boolean DragDropMgr
<static> Is drag and drop locked?
  isTypeOfDDObject the ) : boolean DragDropMgr
<static> My goal is to be able to transparently determine if an object is typeof DragDrop, and the exact subcla...
  lock() : void DragDropMgr
<static> Lock all drag and drop functionality
  moveToElHTMLElement moveEl, HTMLElement targetEl ) : void DragDropMgr
<static> Sets the x/y position of an element to the location of the target element.
  numericSort() : void DragDropMgr
<static> Numeric array sort function
  refreshCacheObject groups ) : void DragDropMgr
<static> Refreshes the cache of the top-left and bottom-right points of the drag and drop objects in the specif...
  regDragDropDragDrop oDD, String sGroup ) : void DragDropMgr
<static> Each DragDrop instance must be registered with the DragDropMgr. This is executed in DragDrop.init()
  regHandleString sDDId, String sHandleId ) : void DragDropMgr
<static> Each DragDrop handle element must be registered. This is done automatically when executing DragDrop.s...
  startDragx {int}, y {int} ) : void DragDropMgr
<static> Fired when either the drag pixel threshol or the mousedown hold time threshold has been met.
  stopEventEvent e ) : void DragDropMgr
<static> Utility to stop event propagation and event default, if these features are turned on.
  swapNoden1 the, n2 the ) : void DragDropMgr
<static> Swap two nodes. In IE, we use the native method, for others we emulate the IE behavior
  unlock() : void DragDropMgr
<static> Unlock all drag and drop functionality
  verifyElHTMLElement el ) : boolean DragDropMgr
<static> This checks to make sure an element exists and is in the DOM. The main purpose is to handle cases whe...

Public Events

This class has no public events.

Property Details

INTERSECT

public int INTERSECT
<static> In intersect mode, drag and drop interactio nis defined by the overlap of two or more drag and drop objects.
This property is defined by DragDropMgr.

POINT

public int POINT
<static> In point mode, drag and drop interaction is defined by the location of the cursor during the drag/drop
This property is defined by DragDropMgr.

clickPixelThresh

public int clickPixelThresh
<static> The number of pixels that the mouse needs to move after the mousedown before the drag is initiated. Default=3;
This property is defined by DragDropMgr.

clickTimeThresh

public int clickTimeThresh
<static> The number of milliseconds after the mousedown event to initiate the drag if we don't get a mouseup event. Default=1000
This property is defined by DragDropMgr.

css

public Object css
A reference to the style property
This property is defined by DragDropMgr.

el

public Object el
The element
This property is defined by DragDropMgr.

id

public Object id
The element id
This property is defined by DragDropMgr.

mode

public int mode
<static> The current drag and drop mode. Default: POINT
This property is defined by DragDropMgr.

preventDefault

public boolean preventDefault
<static> Flag to determine if we should prevent the default behavior of the events we define. By default this is true, but this can be set to false if you need the default behavior (not recommended)
This property is defined by DragDropMgr.

stopPropagation

public boolean stopPropagation
<static> Flag to determine if we should stop the propagation of the events we generate. This is true by default but you may want to set it to false if the html element contains other features that require the mouse click.
This property is defined by DragDropMgr.

useCache

public boolean useCache
<static> Set useCache to false if you want to force object the lookup of each drag and drop linked element constantly during a drag.
This property is defined by DragDropMgr.

Method Details

getBestMatch

public function getBestMatch( DragDrop[] dds )
<static> Helper function for getting the best match from the list of drag and drop objects returned by the drag and drop events when we are in INTERSECT mode. It returns either the first object that the cursor is over, or the object that has the greatest overlap with the dragged element.
Parameters:
  • dds : DragDrop[]
    The array of drag and drop objects targeted
Returns:
  • DragDrop
    The best single match
This method is defined by DragDropMgr.

getCss

public function getCss( String id )
Deprecated. <static> Returns the style property for the DOM element (i.e., document.getElById(id).style)
Parameters:
  • id : String
    the id of the elment to get
Returns:
  • Object
    The style property of the element
This method is defined by DragDropMgr.

getDDById

public function getDDById( String id )
<static> Returns the DragDrop instance for a given id
Parameters:
  • id : String
    the id of the DragDrop object
Returns:
  • DragDrop
    the drag drop object, null if it is not found
This method is defined by DragDropMgr.

getElement

public function getElement( String id )
Deprecated. <static> Returns the actual DOM element
Parameters:
  • id : String
    the id of the elment to get
Returns:
  • Object
    The element
This method is defined by DragDropMgr.

getLocation

public function getLocation( DragDrop oDD )
<static> Returns a Region object containing the drag and drop element's position and size, including the padding configured for it
Parameters:
  • oDD : DragDrop
    the drag and drop object to get the location for
Returns:
  • Ext.lib.Region
    a Region object representing the total area the element occupies, including any padding the instance is configured for.
This method is defined by DragDropMgr.

getPosX

public function getPosX( el the )
Deprecated. <static> Returns the X position of an html element
Parameters:
  • the : el
    element for which to get the position
Returns:
  • int
    the X coordinate @for DragDropMgr
This method is defined by DragDropMgr.

getPosY

public function getPosY( el the )
Deprecated. <static> Returns the Y position of an html element
Parameters:
  • the : el
    element for which to get the position
Returns:
  • int
    the Y coordinate
This method is defined by DragDropMgr.

getRelated

public function getRelated( DragDrop p_oDD, boolean bTargetsOnly )
<static> Returns the drag and drop instances that are in all groups the passed in instance belongs to.
Parameters:
  • p_oDD : DragDrop
    the obj to get related data for
  • bTargetsOnly : boolean
    if true, only return targetable objs
Returns:
  • DragDrop[]
    the related instances
This method is defined by DragDropMgr.

getScrollLeft

public function getScrollLeft()
<static> Gets the scrollLeft
Parameters:
  • None.
Returns:
  • int
    the document's scrollTop
This method is defined by DragDropMgr.

getScrollTop

public function getScrollTop()
<static> Gets the scrollTop
Parameters:
  • None.
Returns:
  • int
    the document's scrollTop
This method is defined by DragDropMgr.

getStyle

public function getStyle( HTMLElement el, string styleProp )
Deprecated. <static> Returns the specified element style property
Parameters:
  • el : HTMLElement
    the element
  • styleProp : string
    the style property
Returns:
  • string
    The value of the style property
This method is defined by DragDropMgr.

handleWasClicked

public function handleWasClicked( node the )
<static> Recursively searches the immediate parent and all child nodes for the handle element in order to determine wheter or not it was clicked.
Parameters:
  • the : node
    html element to inspect
Returns:
  • void
This method is defined by DragDropMgr.

isDragDrop

public function isDragDrop( String id )
<static> Utility function to determine if a given element has been registered as a drag drop item.
Parameters:
  • id : String
    the element id to check
Returns:
  • boolean
    true if this element is a DragDrop item, false otherwise
This method is defined by DragDropMgr.

isHandle

public function isHandle( String id )
<static> Utility function to determine if a given element has been registered as a drag drop handle for the given Drag Drop object.
Parameters:
  • id : String
    the element id to check
Returns:
  • boolean
    true if this element is a DragDrop handle, false otherwise
This method is defined by DragDropMgr.

isLegalTarget

public function isLegalTarget( DragDrop the, DragDrop the )
<static> Returns true if the specified dd target is a legal target for the specifice drag obj
Parameters:
  • the : DragDrop
    drag obj
  • the : DragDrop
    target
Returns:
  • boolean
    true if the target is a legal target for the dd obj
This method is defined by DragDropMgr.

isLocked

public function isLocked()
<static> Is drag and drop locked?
Parameters:
  • None.
Returns:
  • boolean
    True if drag and drop is locked, false otherwise.
This method is defined by DragDropMgr.

isTypeOfDD

public function isTypeOfDD( Object the )
<static> My goal is to be able to transparently determine if an object is typeof DragDrop, and the exact subclass of DragDrop. typeof returns "object", oDD.constructor.toString() always returns "DragDrop" and not the name of the subclass. So for now it just evaluates a well-known variable in DragDrop.
Parameters:
  • the : Object
    object to evaluate
Returns:
  • boolean
    true if typeof oDD = DragDrop
This method is defined by DragDropMgr.

lock

public function lock()
<static> Lock all drag and drop functionality
Parameters:
  • None.
Returns:
  • void
This method is defined by DragDropMgr.

moveToEl

public function moveToEl( HTMLElement moveEl, HTMLElement targetEl )
<static> Sets the x/y position of an element to the location of the target element.
Parameters:
  • moveEl : HTMLElement
    The element to move
  • targetEl : HTMLElement
    The position reference element
Returns:
  • void
This method is defined by DragDropMgr.

numericSort

public function numericSort()
<static> Numeric array sort function
Parameters:
  • None.
Returns:
  • void
This method is defined by DragDropMgr.

refreshCache

public function refreshCache( Object groups )
<static> Refreshes the cache of the top-left and bottom-right points of the drag and drop objects in the specified group(s). This is in the format that is stored in the drag and drop instance, so typical usage is: Ext.dd.DragDropMgr.refreshCache(ddinstance.groups); Alternatively: Ext.dd.DragDropMgr.refreshCache({group1:true, group2:true}); @TODO this really should be an indexed array. Alternatively this method could accept both.
Parameters:
  • groups : Object
    an associative array of groups to refresh
Returns:
  • void
This method is defined by DragDropMgr.

regDragDrop

public function regDragDrop( DragDrop oDD, String sGroup )
<static> Each DragDrop instance must be registered with the DragDropMgr. This is executed in DragDrop.init()
Parameters:
  • oDD : DragDrop
    the DragDrop object to register
  • sGroup : String
    the name of the group this element belongs to
Returns:
  • void
This method is defined by DragDropMgr.

regHandle

public function regHandle( String sDDId, String sHandleId )
<static> Each DragDrop handle element must be registered. This is done automatically when executing DragDrop.setHandleElId()
Parameters:
  • sDDId : String
    the DragDrop id this element is a handle for
  • sHandleId : String
    the id of the element that is the drag handle
Returns:
  • void
This method is defined by DragDropMgr.

startDrag

public function startDrag( x {int}, y {int} )
<static> Fired when either the drag pixel threshol or the mousedown hold time threshold has been met.
Parameters:
  • {int} : x
    the X position of the original mousedown
  • {int} : y
    the Y position of the original mousedown
Returns:
  • void
This method is defined by DragDropMgr.

stopEvent

public function stopEvent( Event e )
<static> Utility to stop event propagation and event default, if these features are turned on.
Parameters:
  • e : Event
    the event as returned by this.getEvent()
Returns:
  • void
This method is defined by DragDropMgr.

swapNode

public function swapNode( n1 the, n2 the )
<static> Swap two nodes. In IE, we use the native method, for others we emulate the IE behavior
Parameters:
  • the : n1
    first node to swap
  • the : n2
    other node to swap
Returns:
  • void
This method is defined by DragDropMgr.

unlock

public function unlock()
<static> Unlock all drag and drop functionality
Parameters:
  • None.
Returns:
  • void
This method is defined by DragDropMgr.

verifyEl

public function verifyEl( HTMLElement el )
<static> This checks to make sure an element exists and is in the DOM. The main purpose is to handle cases where innerHTML is used to remove drag and drop objects from the DOM. IE provides an 'unspecified error' when trying to access the offsetParent of such an element
Parameters:
  • el : HTMLElement
    the element to check
Returns:
  • boolean
    true if the element looks usable
This method is defined by DragDropMgr.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.