4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-dd-DropTarget'>/**
19 </span> * @class Ext.dd.DropTarget
20 * @extends Ext.dd.DDTarget
21 * A simple class that provides the basic implementation needed to make any element a drop target that can have
22 * draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
24 Ext.define('Ext.dd.DropTarget', {
25 extend: 'Ext.dd.DDTarget',
26 requires: ['Ext.dd.ScrollManager'],
28 <span id='Ext-dd-DropTarget-method-constructor'> /**
29 </span> * Creates new DropTarget.
30 * @param {Mixed} el The container element
31 * @param {Object} config
33 constructor : function(el, config){
34 this.el = Ext.get(el);
36 Ext.apply(this, config);
38 if(this.containerScroll){
39 Ext.dd.ScrollManager.register(this.el);
42 this.callParent([this.el.dom, this.ddGroup || this.group,
46 <span id='Ext-dd-DropTarget-cfg-ddGroup'> /**
47 </span> * @cfg {String} ddGroup
48 * A named drag drop group to which this object belongs. If a group is specified, then this object will only
49 * interact with other drag drop objects in the same group (defaults to undefined).
51 <span id='Ext-dd-DropTarget-cfg-overClass'> /**
52 </span> * @cfg {String} overClass
53 * The CSS class applied to the drop target element while the drag source is over it (defaults to "").
55 <span id='Ext-dd-DropTarget-cfg-dropAllowed'> /**
56 </span> * @cfg {String} dropAllowed
57 * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
59 dropAllowed : Ext.baseCSSPrefix + 'dd-drop-ok',
60 <span id='Ext-dd-DropTarget-cfg-dropNotAllowed'> /**
61 </span> * @cfg {String} dropNotAllowed
62 * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
64 dropNotAllowed : Ext.baseCSSPrefix + 'dd-drop-nodrop',
70 isNotifyTarget : true,
72 <span id='Ext-dd-DropTarget-method-notifyEnter'> /**
73 </span> * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the
74 * target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
75 * and returns the dropAllowed config value. This method should be overridden if drop validation is required.
76 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
77 * @param {Event} e The event
78 * @param {Object} data An object containing arbitrary data supplied by the drag source
79 * @return {String} status The CSS class that communicates the drop status back to the source so that the
80 * underlying {@link Ext.dd.StatusProxy} can be updated
82 notifyEnter : function(dd, e, data){
84 this.el.addCls(this.overClass);
86 return this.dropAllowed;
89 <span id='Ext-dd-DropTarget-method-notifyOver'> /**
90 </span> * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.
91 * This method will be called on every mouse movement while the drag source is over the drop target.
92 * This default implementation simply returns the dropAllowed config value.
93 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
94 * @param {Event} e The event
95 * @param {Object} data An object containing arbitrary data supplied by the drag source
96 * @return {String} status The CSS class that communicates the drop status back to the source so that the
97 * underlying {@link Ext.dd.StatusProxy} can be updated
99 notifyOver : function(dd, e, data){
100 return this.dropAllowed;
103 <span id='Ext-dd-DropTarget-method-notifyOut'> /**
104 </span> * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged
105 * out of the target without dropping. This default implementation simply removes the CSS class specified by
106 * overClass (if any) from the drop element.
107 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
108 * @param {Event} e The event
109 * @param {Object} data An object containing arbitrary data supplied by the drag source
111 notifyOut : function(dd, e, data){
113 this.el.removeCls(this.overClass);
117 <span id='Ext-dd-DropTarget-method-notifyDrop'> /**
118 </span> * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has
119 * been dropped on it. This method has no default implementation and returns false, so you must provide an
120 * implementation that does something to process the drop event and returns true so that the drag source's
121 * repair action does not run.
122 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
123 * @param {Event} e The event
124 * @param {Object} data An object containing arbitrary data supplied by the drag source
125 * @return {Boolean} False if the drop was invalid.
127 notifyDrop : function(dd, e, data){
131 destroy : function(){
133 if(this.containerScroll){
134 Ext.dd.ScrollManager.unregister(this.el);