3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.dd.DropTarget"></div>/**
\r
9 * @class Ext.dd.DropTarget
\r
10 * @extends Ext.dd.DDTarget
\r
11 * A simple class that provides the basic implementation needed to make any element a drop target that can have
\r
12 * draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
\r
14 * @param {Mixed} el The container element
\r
15 * @param {Object} config
\r
17 Ext.dd.DropTarget = function(el, config){
\r
18 this.el = Ext.get(el);
\r
20 Ext.apply(this, config);
\r
22 if(this.containerScroll){
\r
23 Ext.dd.ScrollManager.register(this.el);
\r
26 Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
\r
31 Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {
\r
32 <div id="cfg-Ext.dd.DropTarget-ddGroup"></div>/**
\r
33 * @cfg {String} ddGroup
\r
34 * A named drag drop group to which this object belongs. If a group is specified, then this object will only
\r
35 * interact with other drag drop objects in the same group (defaults to undefined).
\r
37 <div id="cfg-Ext.dd.DropTarget-overClass"></div>/**
\r
38 * @cfg {String} overClass
\r
39 * The CSS class applied to the drop target element while the drag source is over it (defaults to "").
\r
41 <div id="cfg-Ext.dd.DropTarget-dropAllowed"></div>/**
\r
42 * @cfg {String} dropAllowed
\r
43 * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
\r
45 dropAllowed : "x-dd-drop-ok",
\r
46 <div id="cfg-Ext.dd.DropTarget-dropNotAllowed"></div>/**
\r
47 * @cfg {String} dropNotAllowed
\r
48 * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
\r
50 dropNotAllowed : "x-dd-drop-nodrop",
\r
56 isNotifyTarget : true,
\r
58 <div id="method-Ext.dd.DropTarget-notifyEnter"></div>/**
\r
59 * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the
\r
60 * target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
\r
61 * and returns the dropAllowed config value. This method should be overridden if drop validation is required.
\r
62 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
\r
63 * @param {Event} e The event
\r
64 * @param {Object} data An object containing arbitrary data supplied by the drag source
\r
65 * @return {String} status The CSS class that communicates the drop status back to the source so that the
\r
66 * underlying {@link Ext.dd.StatusProxy} can be updated
\r
68 notifyEnter : function(dd, e, data){
\r
70 this.el.addClass(this.overClass);
\r
72 return this.dropAllowed;
\r
75 <div id="method-Ext.dd.DropTarget-notifyOver"></div>/**
\r
76 * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.
\r
77 * This method will be called on every mouse movement while the drag source is over the drop target.
\r
78 * This default implementation simply returns the dropAllowed config value.
\r
79 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
\r
80 * @param {Event} e The event
\r
81 * @param {Object} data An object containing arbitrary data supplied by the drag source
\r
82 * @return {String} status The CSS class that communicates the drop status back to the source so that the
\r
83 * underlying {@link Ext.dd.StatusProxy} can be updated
\r
85 notifyOver : function(dd, e, data){
\r
86 return this.dropAllowed;
\r
89 <div id="method-Ext.dd.DropTarget-notifyOut"></div>/**
\r
90 * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged
\r
91 * out of the target without dropping. This default implementation simply removes the CSS class specified by
\r
92 * overClass (if any) from the drop element.
\r
93 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
\r
94 * @param {Event} e The event
\r
95 * @param {Object} data An object containing arbitrary data supplied by the drag source
\r
97 notifyOut : function(dd, e, data){
\r
99 this.el.removeClass(this.overClass);
\r
103 <div id="method-Ext.dd.DropTarget-notifyDrop"></div>/**
\r
104 * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has
\r
105 * been dropped on it. This method has no default implementation and returns false, so you must provide an
\r
106 * implementation that does something to process the drop event and returns true so that the drag source's
\r
107 * repair action does not run.
\r
108 * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
\r
109 * @param {Event} e The event
\r
110 * @param {Object} data An object containing arbitrary data supplied by the drag source
\r
111 * @return {Boolean} True if the drop was valid, else false
\r
113 notifyDrop : function(dd, e, data){
\r