3
* Copyright(c) 2006-2008, Ext JS, LLC.
6
* http://extjs.com/license
10
* @class Ext.dd.DropTarget
11
* @extends Ext.dd.DDTarget
12
* A simple class that provides the basic implementation needed to make any element a drop target that can have
13
* draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
15
* @param {Mixed} el The container element
16
* @param {Object} config
18
Ext.dd.DropTarget = function(el, config){
19
this.el = Ext.get(el);
21
Ext.apply(this, config);
23
if(this.containerScroll){
24
Ext.dd.ScrollManager.register(this.el);
27
Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
32
Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {
34
* @cfg {String} ddGroup
35
* A named drag drop group to which this object belongs. If a group is specified, then this object will only
36
* interact with other drag drop objects in the same group (defaults to undefined).
39
* @cfg {String} overClass
40
* The CSS class applied to the drop target element while the drag source is over it (defaults to "").
43
* @cfg {String} dropAllowed
44
* The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
46
dropAllowed : "x-dd-drop-ok",
48
* @cfg {String} dropNotAllowed
49
* The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
51
dropNotAllowed : "x-dd-drop-nodrop",
57
isNotifyTarget : true,
60
* The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the
61
* target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
62
* and returns the dropAllowed config value. This method should be overridden if drop validation is required.
63
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
64
* @param {Event} e The event
65
* @param {Object} data An object containing arbitrary data supplied by the drag source
66
* @return {String} status The CSS class that communicates the drop status back to the source so that the
67
* underlying {@link Ext.dd.StatusProxy} can be updated
69
notifyEnter : function(dd, e, data){
71
this.el.addClass(this.overClass);
73
return this.dropAllowed;
77
* The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.
78
* This method will be called on every mouse movement while the drag source is over the drop target.
79
* This default implementation simply returns the dropAllowed config value.
80
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
81
* @param {Event} e The event
82
* @param {Object} data An object containing arbitrary data supplied by the drag source
83
* @return {String} status The CSS class that communicates the drop status back to the source so that the
84
* underlying {@link Ext.dd.StatusProxy} can be updated
86
notifyOver : function(dd, e, data){
87
return this.dropAllowed;
91
* The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged
92
* out of the target without dropping. This default implementation simply removes the CSS class specified by
93
* overClass (if any) from the drop element.
94
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
95
* @param {Event} e The event
96
* @param {Object} data An object containing arbitrary data supplied by the drag source
98
notifyOut : function(dd, e, data){
100
this.el.removeClass(this.overClass);
105
* The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has
106
* been dropped on it. This method has no default implementation and returns false, so you must provide an
107
* implementation that does something to process the drop event and returns true so that the drag source's
108
* repair action does not run.
109
* @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
110
* @param {Event} e The event
111
* @param {Object} data An object containing arbitrary data supplied by the drag source
112
* @return {Boolean} True if the drop was valid, else false
114
notifyDrop : function(dd, e, data){
b'\\ No newline at end of file'