dojox/mdnd/AreaManager (version 1.10)

Summary

Drag And Drop manager

Usage

var foo = new AreaManager();
dojox/mdnd/AreaManager

See the dojox/mdnd/AreaManager reference documentation for more information.

Property Summary

Method Summary

  • _addMoveableItem(node) Create a draggable item with a DOM node.
  • _deleteMoveableItem(objItem) Delete the Moveable object associated with a node.
  • _getChildren(area) Get the children of a D&D area.
  • _getIndexArea(area) Get the index of an area.
  • _isAccepted(type,accept) True if user can drop widget on this node.
  • _placeDropIndicator(size) place the dropIndicator
  • _resetAfterDrop() reset manager properties after dropping an item
  • _searchDragHandle(node) Return the node which contains the first specific CSS class handle.
  • _setMarginArea(area,node) Set the value of margin in the data type of areaManager only when the margin has never been computed.
  • addDragItem(area,node,index,notCheckParent) To add an item programmatically.
  • destroy() Destroy the component.
  • findCurrentIndexArea(coords,size) find the nearest target area according to coordinates.
  • init() Initialize the manager by calling the registerByClass method
  • placeDropIndicator(coords,size) Search the right place to insert the dropIndicator and display the dropIndicator.
  • registerByClass() Register all Dnd Areas identified by the attribute areaClass : insert Dnd Areas using the specific sort of dropMode.
  • registerByNode(area,notInitAreas) To register Dnd Area : insert the DndArea using the specific sort of dropMode.
  • removeDragItem(area,node) Delete a moveable item programmatically.
  • unregister(area) Unregister a D&D Area and its children into the AreaManager.

Event Summary

  • onDrag(node,coords,size,mousePosition) Occurs when the dojo.dnd.Moveable.onDrag is fired.
  • onDragEnter(coords,size) Optionally called by the getTargetArea method of TargetFinder class.
  • onDragExit(coords,size) Optionally called by the getTargetArea method of TargetFinder class.
  • onDragStart(node,coords,size) Initialize the drag (see dojox.mdnd.Moveable.initOffsetDrag())
  • onDrop(node) Drop the dragged item where the dropIndicator is displayed.
  • onDropCancel() Cancel the drop.

Properties

areaClass

CSS class enabled an area if areaClass is defined

autoRefresh

Enable the refresh of registered areas on drag start.

dragHandleClass

CSS class enabled a drag handle.

Methods

_addMoveableItem(node)

Create a draggable item with a DOM node.

Parameter Type Description
node DOMNode

A child of the D&D Area.

Returns:any | object

The draggable item.

_deleteMoveableItem(objItem)

Delete the Moveable object associated with a node.

Parameter Type Description
objItem Object
_getChildren(area)

Get the children of a D&D area.

Parameter Type Description
area DOMNode

A DnD area.

Returns:any | Array

The children of a DnD area

_getIndexArea(area)

Get the index of an area.

Parameter Type Description
area DOMNode

A moveable Object.

Returns:any | number

area index or -1

_isAccepted(type,accept)

True if user can drop widget on this node.

Parameter Type Description
type Array

Array containing item type

accept Array

Array containing types

_placeDropIndicator(size)

place the dropIndicator

Parameter Type Description
size Object

an object encapsulating width and height values

_resetAfterDrop()

reset manager properties after dropping an item

_searchDragHandle(node)

Return the node which contains the first specific CSS class handle.

Parameter Type Description
node DOMNode

A child of the D&D Area.

Returns:any

The drag handle node.

_setMarginArea(area,node)

Set the value of margin in the data type of areaManager only when the margin has never been computed.

Parameter Type Description
area Object

The object of a D&D Area.

node DOMNode

The node which contains margins

addDragItem(area,node,index,notCheckParent)

To add an item programmatically.

Parameter Type Description
area DOMNode

a node corresponding to the D&D Area

node DOMNode

the node which has to be treated.

index Integer

the place in the area

notCheckParent Boolean
Returns:any | boolean

True if the node has been inserted else false.

destroy()

Destroy the component.

findCurrentIndexArea(coords,size)

find the nearest target area according to coordinates. Coordinates are representing by an object : for example, {'x':10,'y':10}

Parameter Type Description
coords Object

an object encapsulating X and Y position

size Object

an object encapsulating the area size

Returns:any | undefined

an index of area

init()

Initialize the manager by calling the registerByClass method

placeDropIndicator(coords,size)

Search the right place to insert the dropIndicator and display the dropIndicator.

Parameter Type Description
coords Object

an object encapsulating X and Y position

size Object

an object encapsulating width and height values

Returns:any | undefined

the current drop index

registerByClass()

Register all Dnd Areas identified by the attribute areaClass : insert Dnd Areas using the specific sort of dropMode.

registerByNode(area,notInitAreas)

To register Dnd Area : insert the DndArea using the specific sort of dropMode.

Parameter Type Description
area DOMNode

a DOM node corresponding to the Dnd Area

notInitAreas Boolean

if false or undefined, init the areas.

removeDragItem(area,node)

Delete a moveable item programmatically. The node is removed from the area.

Parameter Type Description
area DOMNode

A node corresponding to the DndArea.

node DOMNode

The node which has to be treated.

Returns:any | undefined | null

the removed node

unregister(area)

Unregister a D&D Area and its children into the AreaManager.

Parameter Type Description
area DOMNode

A node corresponding to the D&D Area.

Returns:any | boolean

True if the area is found and unregistered.

Events

onDrag(node,coords,size,mousePosition)

Occurs when the dojo.dnd.Moveable.onDrag is fired. Search the nearest target area and called the placeDropIndicator

Parameter Type Description
node DOMNode

The node which is dragged

coords Object

an object encapsulating X and Y position

size Object

an object encapsulating width and height values

mousePosition Object

coordinates of mouse

onDragEnter(coords,size)

Optionally called by the getTargetArea method of TargetFinder class.

Parameter Type Description
coords Object

coordinates of the dragged Node.

size Object

size of the dragged Node.

onDragExit(coords,size)

Optionally called by the getTargetArea method of TargetFinder class.

Parameter Type Description
coords Object

coordinates of the dragged Node.

size Object

size of the dragged Node.

onDragStart(node,coords,size)

Initialize the drag (see dojox.mdnd.Moveable.initOffsetDrag())

Parameter Type Description
node DOMNode

The node which is about to be dragged

coords Object

an object encapsulating X and Y position

size Object

an object encapsulating width and height values

onDrop(node)

Drop the dragged item where the dropIndicator is displayed.

Parameter Type Description
node DOMNode

The node which is about to be dropped

onDropCancel()

Cancel the drop. The dragNode returns into the source.

Error in the documentation? Can’t find what you are looking for? Let us know!