Upgrade to ExtJS 3.2.2 - Released 06/02/2010
[extjs.git] / docs / source / DDCore.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
4   <title>The source code</title>
5     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 </head>
8 <body  onload="prettyPrint();">
9     <pre class="prettyprint lang-js">/*!
10  * Ext JS Library 3.2.2
11  * Copyright(c) 2006-2010 Ext JS, Inc.
12  * licensing@extjs.com
13  * http://www.extjs.com/license
14  */
15 /*
16  * These classes are derivatives of the similarly named classes in the YUI Library.
17  * The original license:
18  * Copyright (c) 2006, Yahoo! Inc. All rights reserved.
19  * Code licensed under the BSD License:
20  * http://developer.yahoo.net/yui/license.txt
21  */
22
23 (function() {
24
25 var Event=Ext.EventManager;
26 var Dom=Ext.lib.Dom;
27
28 <div id="cls-Ext.dd.DragDrop"></div>/**
29  * @class Ext.dd.DragDrop
30  * Defines the interface and base operation of items that that can be
31  * dragged or can be drop targets.  It was designed to be extended, overriding
32  * the event handlers for startDrag, onDrag, onDragOver and onDragOut.
33  * Up to three html elements can be associated with a DragDrop instance:
34  * <ul>
35  * <li>linked element: the element that is passed into the constructor.
36  * This is the element which defines the boundaries for interaction with
37  * other DragDrop objects.</li>
38  * <li>handle element(s): The drag operation only occurs if the element that
39  * was clicked matches a handle element.  By default this is the linked
40  * element, but there are times that you will want only a portion of the
41  * linked element to initiate the drag operation, and the setHandleElId()
42  * method provides a way to define this.</li>
43  * <li>drag element: this represents the element that would be moved along
44  * with the cursor during a drag operation.  By default, this is the linked
45  * element itself as in {@link Ext.dd.DD}.  setDragElId() lets you define
46  * a separate element that would be moved, as in {@link Ext.dd.DDProxy}.
47  * </li>
48  * </ul>
49  * This class should not be instantiated until the onload event to ensure that
50  * the associated elements are available.
51  * The following would define a DragDrop obj that would interact with any
52  * other DragDrop obj in the "group1" group:
53  * <pre>
54  *  dd = new Ext.dd.DragDrop("div1", "group1");
55  * </pre>
56  * Since none of the event handlers have been implemented, nothing would
57  * actually happen if you were to run the code above.  Normally you would
58  * override this class or one of the default implementations, but you can
59  * also override the methods you want on an instance of the class...
60  * <pre>
61  *  dd.onDragDrop = function(e, id) {
62  *  &nbsp;&nbsp;alert("dd was dropped on " + id);
63  *  }
64  * </pre>
65  * @constructor
66  * @param {String} id of the element that is linked to this instance
67  * @param {String} sGroup the group of related DragDrop objects
68  * @param {object} config an object containing configurable attributes
69  *                Valid properties for DragDrop:
70  *                    padding, isTarget, maintainOffset, primaryButtonOnly
71  */
72 Ext.dd.DragDrop = function(id, sGroup, config) {
73     if(id) {
74         this.init(id, sGroup, config);
75     }
76 };
77
78 Ext.dd.DragDrop.prototype = {
79
80     <div id="prop-Ext.dd.DragDrop-ignoreSelf"></div>/**
81      * Set to false to enable a DragDrop object to fire drag events while dragging
82      * over its own Element. Defaults to true - DragDrop objects do not by default
83      * fire drag events to themselves.
84      * @property ignoreSelf
85      * @type Boolean
86      */
87
88     <div id="prop-Ext.dd.DragDrop-id"></div>/**
89      * The id of the element associated with this object.  This is what we
90      * refer to as the "linked element" because the size and position of
91      * this element is used to determine when the drag and drop objects have
92      * interacted.
93      * @property id
94      * @type String
95      */
96     id: null,
97
98     <div id="prop-Ext.dd.DragDrop-config"></div>/**
99      * Configuration attributes passed into the constructor
100      * @property config
101      * @type object
102      */
103     config: null,
104
105     /**
106      * The id of the element that will be dragged.  By default this is same
107      * as the linked element, but could be changed to another element. Ex:
108      * Ext.dd.DDProxy
109      * @property dragElId
110      * @type String
111      * @private
112      */
113     dragElId: null,
114
115     /**
116      * The ID of the element that initiates the drag operation.  By default
117      * this is the linked element, but could be changed to be a child of this
118      * element.  This lets us do things like only starting the drag when the
119      * header element within the linked html element is clicked.
120      * @property handleElId
121      * @type String
122      * @private
123      */
124     handleElId: null,
125
126     <div id="prop-Ext.dd.DragDrop-invalidHandleTypes"></div>/**
127      * An object who's property names identify HTML tags to be considered invalid as drag handles.
128      * A non-null property value identifies the tag as invalid. Defaults to the 
129      * following value which prevents drag operations from being initiated by &lt;a> elements:<pre><code>
130 {
131     A: "A"
132 }</code></pre>
133      * @property invalidHandleTypes
134      * @type Object
135      */
136     invalidHandleTypes: null,
137
138     <div id="prop-Ext.dd.DragDrop-invalidHandleIds"></div>/**
139      * An object who's property names identify the IDs of elements to be considered invalid as drag handles.
140      * A non-null property value identifies the ID as invalid. For example, to prevent
141      * dragging from being initiated on element ID "foo", use:<pre><code>
142 {
143     foo: true
144 }</code></pre>
145      * @property invalidHandleIds
146      * @type Object
147      */
148     invalidHandleIds: null,
149
150     <div id="prop-Ext.dd.DragDrop-invalidHandleClasses"></div>/**
151      * An Array of CSS class names for elements to be considered in valid as drag handles.
152      * @property invalidHandleClasses
153      * @type Array
154      */
155     invalidHandleClasses: null,
156
157     /**
158      * The linked element's absolute X position at the time the drag was
159      * started
160      * @property startPageX
161      * @type int
162      * @private
163      */
164     startPageX: 0,
165
166     /**
167      * The linked element's absolute X position at the time the drag was
168      * started
169      * @property startPageY
170      * @type int
171      * @private
172      */
173     startPageY: 0,
174
175     <div id="prop-Ext.dd.DragDrop-groups"></div>/**
176      * The group defines a logical collection of DragDrop objects that are
177      * related.  Instances only get events when interacting with other
178      * DragDrop object in the same group.  This lets us define multiple
179      * groups using a single DragDrop subclass if we want.
180      * @property groups
181      * @type object An object in the format {'group1':true, 'group2':true}
182      */
183     groups: null,
184
185     /**
186      * Individual drag/drop instances can be locked.  This will prevent
187      * onmousedown start drag.
188      * @property locked
189      * @type boolean
190      * @private
191      */
192     locked: false,
193
194     <div id="method-Ext.dd.DragDrop-lock"></div>/**
195      * Lock this instance
196      * @method lock
197      */
198     lock: function() {
199         this.locked = true;
200     },
201
202     <div id="prop-Ext.dd.DragDrop-moveOnly"></div>/**
203      * When set to true, other DD objects in cooperating DDGroups do not receive
204      * notification events when this DD object is dragged over them. Defaults to false.
205      * @property moveOnly
206      * @type boolean
207      */
208     moveOnly: false,
209
210     <div id="method-Ext.dd.DragDrop-unlock"></div>/**
211      * Unlock this instace
212      * @method unlock
213      */
214     unlock: function() {
215         this.locked = false;
216     },
217
218     <div id="prop-Ext.dd.DragDrop-isTarget"></div>/**
219      * By default, all instances can be a drop target.  This can be disabled by
220      * setting isTarget to false.
221      * @property isTarget
222      * @type boolean
223      */
224     isTarget: true,
225
226     <div id="prop-Ext.dd.DragDrop-padding"></div>/**
227      * The padding configured for this drag and drop object for calculating
228      * the drop zone intersection with this object.
229      * @property padding
230      * @type int[] An array containing the 4 padding values: [top, right, bottom, left]
231      */
232     padding: null,
233
234     /**
235      * Cached reference to the linked element
236      * @property _domRef
237      * @private
238      */
239     _domRef: null,
240
241     /**
242      * Internal typeof flag
243      * @property __ygDragDrop
244      * @private
245      */
246     __ygDragDrop: true,
247
248     /**
249      * Set to true when horizontal contraints are applied
250      * @property constrainX
251      * @type boolean
252      * @private
253      */
254     constrainX: false,
255
256     /**
257      * Set to true when vertical contraints are applied
258      * @property constrainY
259      * @type boolean
260      * @private
261      */
262     constrainY: false,
263
264     /**
265      * The left constraint
266      * @property minX
267      * @type int
268      * @private
269      */
270     minX: 0,
271
272     /**
273      * The right constraint
274      * @property maxX
275      * @type int
276      * @private
277      */
278     maxX: 0,
279
280     /**
281      * The up constraint
282      * @property minY
283      * @type int
284      * @private
285      */
286     minY: 0,
287
288     /**
289      * The down constraint
290      * @property maxY
291      * @type int
292      * @private
293      */
294     maxY: 0,
295
296     <div id="prop-Ext.dd.DragDrop-maintainOffset"></div>/**
297      * Maintain offsets when we resetconstraints.  Set to true when you want
298      * the position of the element relative to its parent to stay the same
299      * when the page changes
300      *
301      * @property maintainOffset
302      * @type boolean
303      */
304     maintainOffset: false,
305
306     <div id="prop-Ext.dd.DragDrop-xTicks"></div>/**
307      * Array of pixel locations the element will snap to if we specified a
308      * horizontal graduation/interval.  This array is generated automatically
309      * when you define a tick interval.
310      * @property xTicks
311      * @type int[]
312      */
313     xTicks: null,
314
315     <div id="prop-Ext.dd.DragDrop-yTicks"></div>/**
316      * Array of pixel locations the element will snap to if we specified a
317      * vertical graduation/interval.  This array is generated automatically
318      * when you define a tick interval.
319      * @property yTicks
320      * @type int[]
321      */
322     yTicks: null,
323
324     <div id="prop-Ext.dd.DragDrop-primaryButtonOnly"></div>/**
325      * By default the drag and drop instance will only respond to the primary
326      * button click (left button for a right-handed mouse).  Set to true to
327      * allow drag and drop to start with any mouse click that is propogated
328      * by the browser
329      * @property primaryButtonOnly
330      * @type boolean
331      */
332     primaryButtonOnly: true,
333
334     <div id="prop-Ext.dd.DragDrop-available"></div>/**
335      * The available property is false until the linked dom element is accessible.
336      * @property available
337      * @type boolean
338      */
339     available: false,
340
341     <div id="prop-Ext.dd.DragDrop-hasOuterHandles"></div>/**
342      * By default, drags can only be initiated if the mousedown occurs in the
343      * region the linked element is.  This is done in part to work around a
344      * bug in some browsers that mis-report the mousedown if the previous
345      * mouseup happened outside of the window.  This property is set to true
346      * if outer handles are defined.
347      *
348      * @property hasOuterHandles
349      * @type boolean
350      * @default false
351      */
352     hasOuterHandles: false,
353
354     /**
355      * Code that executes immediately before the startDrag event
356      * @method b4StartDrag
357      * @private
358      */
359     b4StartDrag: function(x, y) { },
360
361     <div id="method-Ext.dd.DragDrop-startDrag"></div>/**
362      * Abstract method called after a drag/drop object is clicked
363      * and the drag or mousedown time thresholds have beeen met.
364      * @method startDrag
365      * @param {int} X click location
366      * @param {int} Y click location
367      */
368     startDrag: function(x, y) { /* override this */ },
369
370     /**
371      * Code that executes immediately before the onDrag event
372      * @method b4Drag
373      * @private
374      */
375     b4Drag: function(e) { },
376
377     <div id="method-Ext.dd.DragDrop-onDrag"></div>/**
378      * Abstract method called during the onMouseMove event while dragging an
379      * object.
380      * @method onDrag
381      * @param {Event} e the mousemove event
382      */
383     onDrag: function(e) { /* override this */ },
384
385     <div id="method-Ext.dd.DragDrop-onDragEnter"></div>/**
386      * Abstract method called when this element fist begins hovering over
387      * another DragDrop obj
388      * @method onDragEnter
389      * @param {Event} e the mousemove event
390      * @param {String|DragDrop[]} id In POINT mode, the element
391      * id this is hovering over.  In INTERSECT mode, an array of one or more
392      * dragdrop items being hovered over.
393      */
394     onDragEnter: function(e, id) { /* override this */ },
395
396     /**
397      * Code that executes immediately before the onDragOver event
398      * @method b4DragOver
399      * @private
400      */
401     b4DragOver: function(e) { },
402
403     <div id="method-Ext.dd.DragDrop-onDragOver"></div>/**
404      * Abstract method called when this element is hovering over another
405      * DragDrop obj
406      * @method onDragOver
407      * @param {Event} e the mousemove event
408      * @param {String|DragDrop[]} id In POINT mode, the element
409      * id this is hovering over.  In INTERSECT mode, an array of dd items
410      * being hovered over.
411      */
412     onDragOver: function(e, id) { /* override this */ },
413
414     /**
415      * Code that executes immediately before the onDragOut event
416      * @method b4DragOut
417      * @private
418      */
419     b4DragOut: function(e) { },
420
421     <div id="method-Ext.dd.DragDrop-onDragOut"></div>/**
422      * Abstract method called when we are no longer hovering over an element
423      * @method onDragOut
424      * @param {Event} e the mousemove event
425      * @param {String|DragDrop[]} id In POINT mode, the element
426      * id this was hovering over.  In INTERSECT mode, an array of dd items
427      * that the mouse is no longer over.
428      */
429     onDragOut: function(e, id) { /* override this */ },
430
431     /**
432      * Code that executes immediately before the onDragDrop event
433      * @method b4DragDrop
434      * @private
435      */
436     b4DragDrop: function(e) { },
437
438     <div id="method-Ext.dd.DragDrop-onDragDrop"></div>/**
439      * Abstract method called when this item is dropped on another DragDrop
440      * obj
441      * @method onDragDrop
442      * @param {Event} e the mouseup event
443      * @param {String|DragDrop[]} id In POINT mode, the element
444      * id this was dropped on.  In INTERSECT mode, an array of dd items this
445      * was dropped on.
446      */
447     onDragDrop: function(e, id) { /* override this */ },
448
449     <div id="method-Ext.dd.DragDrop-onInvalidDrop"></div>/**
450      * Abstract method called when this item is dropped on an area with no
451      * drop target
452      * @method onInvalidDrop
453      * @param {Event} e the mouseup event
454      */
455     onInvalidDrop: function(e) { /* override this */ },
456
457     /**
458      * Code that executes immediately before the endDrag event
459      * @method b4EndDrag
460      * @private
461      */
462     b4EndDrag: function(e) { },
463
464     <div id="method-Ext.dd.DragDrop-endDrag"></div>/**
465      * Fired when we are done dragging the object
466      * @method endDrag
467      * @param {Event} e the mouseup event
468      */
469     endDrag: function(e) { /* override this */ },
470
471     /**
472      * Code executed immediately before the onMouseDown event
473      * @method b4MouseDown
474      * @param {Event} e the mousedown event
475      * @private
476      */
477     b4MouseDown: function(e) {  },
478
479     <div id="method-Ext.dd.DragDrop-onMouseDown"></div>/**
480      * Event handler that fires when a drag/drop obj gets a mousedown
481      * @method onMouseDown
482      * @param {Event} e the mousedown event
483      */
484     onMouseDown: function(e) { /* override this */ },
485
486     <div id="method-Ext.dd.DragDrop-onMouseUp"></div>/**
487      * Event handler that fires when a drag/drop obj gets a mouseup
488      * @method onMouseUp
489      * @param {Event} e the mouseup event
490      */
491     onMouseUp: function(e) { /* override this */ },
492
493     <div id="method-Ext.dd.DragDrop-onAvailable"></div>/**
494      * Override the onAvailable method to do what is needed after the initial
495      * position was determined.
496      * @method onAvailable
497      */
498     onAvailable: function () {
499     },
500
501     <div id="prop-Ext.dd.DragDrop-defaultPadding"></div>/**
502      * Provides default constraint padding to "constrainTo" elements (defaults to {left: 0, right:0, top:0, bottom:0}).
503      * @type Object
504      */
505     defaultPadding : {left:0, right:0, top:0, bottom:0},
506
507     <div id="method-Ext.dd.DragDrop-constrainTo"></div>/**
508      * Initializes the drag drop object's constraints to restrict movement to a certain element.
509  *
510  * Usage:
511  <pre><code>
512  var dd = new Ext.dd.DDProxy("dragDiv1", "proxytest",
513                 { dragElId: "existingProxyDiv" });
514  dd.startDrag = function(){
515      this.constrainTo("parent-id");
516  };
517  </code></pre>
518  * Or you can initalize it using the {@link Ext.Element} object:
519  <pre><code>
520  Ext.get("dragDiv1").initDDProxy("proxytest", {dragElId: "existingProxyDiv"}, {
521      startDrag : function(){
522          this.constrainTo("parent-id");
523      }
524  });
525  </code></pre>
526      * @param {Mixed} constrainTo The element to constrain to.
527      * @param {Object/Number} pad (optional) Pad provides a way to specify "padding" of the constraints,
528      * and can be either a number for symmetrical padding (4 would be equal to {left:4, right:4, top:4, bottom:4}) or
529      * an object containing the sides to pad. For example: {right:10, bottom:10}
530      * @param {Boolean} inContent (optional) Constrain the draggable in the content box of the element (inside padding and borders)
531      */
532     constrainTo : function(constrainTo, pad, inContent){
533         if(Ext.isNumber(pad)){
534             pad = {left: pad, right:pad, top:pad, bottom:pad};
535         }
536         pad = pad || this.defaultPadding;
537         var b = Ext.get(this.getEl()).getBox(),
538             ce = Ext.get(constrainTo),
539             s = ce.getScroll(),
540             c, 
541             cd = ce.dom;
542         if(cd == document.body){
543             c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
544         }else{
545             var xy = ce.getXY();
546             c = {x : xy[0], y: xy[1], width: cd.clientWidth, height: cd.clientHeight};
547         }
548
549
550         var topSpace = b.y - c.y,
551             leftSpace = b.x - c.x;
552
553         this.resetConstraints();
554         this.setXConstraint(leftSpace - (pad.left||0), // left
555                 c.width - leftSpace - b.width - (pad.right||0), //right
556                                 this.xTickSize
557         );
558         this.setYConstraint(topSpace - (pad.top||0), //top
559                 c.height - topSpace - b.height - (pad.bottom||0), //bottom
560                                 this.yTickSize
561         );
562     },
563
564     <div id="method-Ext.dd.DragDrop-getEl"></div>/**
565      * Returns a reference to the linked element
566      * @method getEl
567      * @return {HTMLElement} the html element
568      */
569     getEl: function() {
570         if (!this._domRef) {
571             this._domRef = Ext.getDom(this.id);
572         }
573
574         return this._domRef;
575     },
576
577     <div id="method-Ext.dd.DragDrop-getDragEl"></div>/**
578      * Returns a reference to the actual element to drag.  By default this is
579      * the same as the html element, but it can be assigned to another
580      * element. An example of this can be found in Ext.dd.DDProxy
581      * @method getDragEl
582      * @return {HTMLElement} the html element
583      */
584     getDragEl: function() {
585         return Ext.getDom(this.dragElId);
586     },
587
588     <div id="method-Ext.dd.DragDrop-init"></div>/**
589      * Sets up the DragDrop object.  Must be called in the constructor of any
590      * Ext.dd.DragDrop subclass
591      * @method init
592      * @param id the id of the linked element
593      * @param {String} sGroup the group of related items
594      * @param {object} config configuration attributes
595      */
596     init: function(id, sGroup, config) {
597         this.initTarget(id, sGroup, config);
598         Event.on(this.id, "mousedown", this.handleMouseDown, this);
599         // Event.on(this.id, "selectstart", Event.preventDefault);
600     },
601
602     <div id="method-Ext.dd.DragDrop-initTarget"></div>/**
603      * Initializes Targeting functionality only... the object does not
604      * get a mousedown handler.
605      * @method initTarget
606      * @param id the id of the linked element
607      * @param {String} sGroup the group of related items
608      * @param {object} config configuration attributes
609      */
610     initTarget: function(id, sGroup, config) {
611
612         // configuration attributes
613         this.config = config || {};
614
615         // create a local reference to the drag and drop manager
616         this.DDM = Ext.dd.DDM;
617         // initialize the groups array
618         this.groups = {};
619
620         // assume that we have an element reference instead of an id if the
621         // parameter is not a string
622         if (typeof id !== "string") {
623             id = Ext.id(id);
624         }
625
626         // set the id
627         this.id = id;
628
629         // add to an interaction group
630         this.addToGroup((sGroup) ? sGroup : "default");
631
632         // We don't want to register this as the handle with the manager
633         // so we just set the id rather than calling the setter.
634         this.handleElId = id;
635
636         // the linked element is the element that gets dragged by default
637         this.setDragElId(id);
638
639         // by default, clicked anchors will not start drag operations.
640         this.invalidHandleTypes = { A: "A" };
641         this.invalidHandleIds = {};
642         this.invalidHandleClasses = [];
643
644         this.applyConfig();
645
646         this.handleOnAvailable();
647     },
648
649     <div id="method-Ext.dd.DragDrop-applyConfig"></div>/**
650      * Applies the configuration parameters that were passed into the constructor.
651      * This is supposed to happen at each level through the inheritance chain.  So
652      * a DDProxy implentation will execute apply config on DDProxy, DD, and
653      * DragDrop in order to get all of the parameters that are available in
654      * each object.
655      * @method applyConfig
656      */
657     applyConfig: function() {
658
659         // configurable properties:
660         //    padding, isTarget, maintainOffset, primaryButtonOnly
661         this.padding           = this.config.padding || [0, 0, 0, 0];
662         this.isTarget          = (this.config.isTarget !== false);
663         this.maintainOffset    = (this.config.maintainOffset);
664         this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
665
666     },
667
668     /**
669      * Executed when the linked element is available
670      * @method handleOnAvailable
671      * @private
672      */
673     handleOnAvailable: function() {
674         this.available = true;
675         this.resetConstraints();
676         this.onAvailable();
677     },
678
679      <div id="method-Ext.dd.DragDrop-setPadding"></div>/**
680      * Configures the padding for the target zone in px.  Effectively expands
681      * (or reduces) the virtual object size for targeting calculations.
682      * Supports css-style shorthand; if only one parameter is passed, all sides
683      * will have that padding, and if only two are passed, the top and bottom
684      * will have the first param, the left and right the second.
685      * @method setPadding
686      * @param {int} iTop    Top pad
687      * @param {int} iRight  Right pad
688      * @param {int} iBot    Bot pad
689      * @param {int} iLeft   Left pad
690      */
691     setPadding: function(iTop, iRight, iBot, iLeft) {
692         // this.padding = [iLeft, iRight, iTop, iBot];
693         if (!iRight && 0 !== iRight) {
694             this.padding = [iTop, iTop, iTop, iTop];
695         } else if (!iBot && 0 !== iBot) {
696             this.padding = [iTop, iRight, iTop, iRight];
697         } else {
698             this.padding = [iTop, iRight, iBot, iLeft];
699         }
700     },
701
702     <div id="method-Ext.dd.DragDrop-setInitPosition"></div>/**
703      * Stores the initial placement of the linked element.
704      * @method setInitPosition
705      * @param {int} diffX   the X offset, default 0
706      * @param {int} diffY   the Y offset, default 0
707      */
708     setInitPosition: function(diffX, diffY) {
709         var el = this.getEl();
710
711         if (!this.DDM.verifyEl(el)) {
712             return;
713         }
714
715         var dx = diffX || 0;
716         var dy = diffY || 0;
717
718         var p = Dom.getXY( el );
719
720         this.initPageX = p[0] - dx;
721         this.initPageY = p[1] - dy;
722
723         this.lastPageX = p[0];
724         this.lastPageY = p[1];
725
726         this.setStartPosition(p);
727     },
728
729     /**
730      * Sets the start position of the element.  This is set when the obj
731      * is initialized, the reset when a drag is started.
732      * @method setStartPosition
733      * @param pos current position (from previous lookup)
734      * @private
735      */
736     setStartPosition: function(pos) {
737         var p = pos || Dom.getXY( this.getEl() );
738         this.deltaSetXY = null;
739
740         this.startPageX = p[0];
741         this.startPageY = p[1];
742     },
743
744     <div id="method-Ext.dd.DragDrop-addToGroup"></div>/**
745      * Add this instance to a group of related drag/drop objects.  All
746      * instances belong to at least one group, and can belong to as many
747      * groups as needed.
748      * @method addToGroup
749      * @param sGroup {string} the name of the group
750      */
751     addToGroup: function(sGroup) {
752         this.groups[sGroup] = true;
753         this.DDM.regDragDrop(this, sGroup);
754     },
755
756     <div id="method-Ext.dd.DragDrop-removeFromGroup"></div>/**
757      * Remove's this instance from the supplied interaction group
758      * @method removeFromGroup
759      * @param {string}  sGroup  The group to drop
760      */
761     removeFromGroup: function(sGroup) {
762         if (this.groups[sGroup]) {
763             delete this.groups[sGroup];
764         }
765
766         this.DDM.removeDDFromGroup(this, sGroup);
767     },
768
769     <div id="method-Ext.dd.DragDrop-setDragElId"></div>/**
770      * Allows you to specify that an element other than the linked element
771      * will be moved with the cursor during a drag
772      * @method setDragElId
773      * @param id {string} the id of the element that will be used to initiate the drag
774      */
775     setDragElId: function(id) {
776         this.dragElId = id;
777     },
778
779     <div id="method-Ext.dd.DragDrop-setHandleElId"></div>/**
780      * Allows you to specify a child of the linked element that should be
781      * used to initiate the drag operation.  An example of this would be if
782      * you have a content div with text and links.  Clicking anywhere in the
783      * content area would normally start the drag operation.  Use this method
784      * to specify that an element inside of the content div is the element
785      * that starts the drag operation.
786      * @method setHandleElId
787      * @param id {string} the id of the element that will be used to
788      * initiate the drag.
789      */
790     setHandleElId: function(id) {
791         if (typeof id !== "string") {
792             id = Ext.id(id);
793         }
794         this.handleElId = id;
795         this.DDM.regHandle(this.id, id);
796     },
797
798     <div id="method-Ext.dd.DragDrop-setOuterHandleElId"></div>/**
799      * Allows you to set an element outside of the linked element as a drag
800      * handle
801      * @method setOuterHandleElId
802      * @param id the id of the element that will be used to initiate the drag
803      */
804     setOuterHandleElId: function(id) {
805         if (typeof id !== "string") {
806             id = Ext.id(id);
807         }
808         Event.on(id, "mousedown",
809                 this.handleMouseDown, this);
810         this.setHandleElId(id);
811
812         this.hasOuterHandles = true;
813     },
814
815     <div id="method-Ext.dd.DragDrop-unreg"></div>/**
816      * Remove all drag and drop hooks for this element
817      * @method unreg
818      */
819     unreg: function() {
820         Event.un(this.id, "mousedown",
821                 this.handleMouseDown);
822         this._domRef = null;
823         this.DDM._remove(this);
824     },
825
826     destroy : function(){
827         this.unreg();
828     },
829
830     <div id="method-Ext.dd.DragDrop-isLocked"></div>/**
831      * Returns true if this instance is locked, or the drag drop mgr is locked
832      * (meaning that all drag/drop is disabled on the page.)
833      * @method isLocked
834      * @return {boolean} true if this obj or all drag/drop is locked, else
835      * false
836      */
837     isLocked: function() {
838         return (this.DDM.isLocked() || this.locked);
839     },
840
841     /**
842      * Fired when this object is clicked
843      * @method handleMouseDown
844      * @param {Event} e
845      * @param {Ext.dd.DragDrop} oDD the clicked dd object (this dd obj)
846      * @private
847      */
848     handleMouseDown: function(e, oDD){
849         if (this.primaryButtonOnly && e.button != 0) {
850             return;
851         }
852
853         if (this.isLocked()) {
854             return;
855         }
856
857         this.DDM.refreshCache(this.groups);
858
859         var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));
860         if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
861         } else {
862             if (this.clickValidator(e)) {
863
864                 // set the initial element position
865                 this.setStartPosition();
866
867                 this.b4MouseDown(e);
868                 this.onMouseDown(e);
869
870                 this.DDM.handleMouseDown(e, this);
871
872                 this.DDM.stopEvent(e);
873             } else {
874
875
876             }
877         }
878     },
879
880     clickValidator: function(e) {
881         var target = e.getTarget();
882         return ( this.isValidHandleChild(target) &&
883                     (this.id == this.handleElId ||
884                         this.DDM.handleWasClicked(target, this.id)) );
885     },
886
887     <div id="method-Ext.dd.DragDrop-addInvalidHandleType"></div>/**
888      * Allows you to specify a tag name that should not start a drag operation
889      * when clicked.  This is designed to facilitate embedding links within a
890      * drag handle that do something other than start the drag.
891      * @method addInvalidHandleType
892      * @param {string} tagName the type of element to exclude
893      */
894     addInvalidHandleType: function(tagName) {
895         var type = tagName.toUpperCase();
896         this.invalidHandleTypes[type] = type;
897     },
898
899     <div id="method-Ext.dd.DragDrop-addInvalidHandleId"></div>/**
900      * Lets you to specify an element id for a child of a drag handle
901      * that should not initiate a drag
902      * @method addInvalidHandleId
903      * @param {string} id the element id of the element you wish to ignore
904      */
905     addInvalidHandleId: function(id) {
906         if (typeof id !== "string") {
907             id = Ext.id(id);
908         }
909         this.invalidHandleIds[id] = id;
910     },
911
912     <div id="method-Ext.dd.DragDrop-addInvalidHandleClass"></div>/**
913      * Lets you specify a css class of elements that will not initiate a drag
914      * @method addInvalidHandleClass
915      * @param {string} cssClass the class of the elements you wish to ignore
916      */
917     addInvalidHandleClass: function(cssClass) {
918         this.invalidHandleClasses.push(cssClass);
919     },
920
921     <div id="method-Ext.dd.DragDrop-removeInvalidHandleType"></div>/**
922      * Unsets an excluded tag name set by addInvalidHandleType
923      * @method removeInvalidHandleType
924      * @param {string} tagName the type of element to unexclude
925      */
926     removeInvalidHandleType: function(tagName) {
927         var type = tagName.toUpperCase();
928         // this.invalidHandleTypes[type] = null;
929         delete this.invalidHandleTypes[type];
930     },
931
932     <div id="method-Ext.dd.DragDrop-removeInvalidHandleId"></div>/**
933      * Unsets an invalid handle id
934      * @method removeInvalidHandleId
935      * @param {string} id the id of the element to re-enable
936      */
937     removeInvalidHandleId: function(id) {
938         if (typeof id !== "string") {
939             id = Ext.id(id);
940         }
941         delete this.invalidHandleIds[id];
942     },
943
944     <div id="method-Ext.dd.DragDrop-removeInvalidHandleClass"></div>/**
945      * Unsets an invalid css class
946      * @method removeInvalidHandleClass
947      * @param {string} cssClass the class of the element(s) you wish to
948      * re-enable
949      */
950     removeInvalidHandleClass: function(cssClass) {
951         for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
952             if (this.invalidHandleClasses[i] == cssClass) {
953                 delete this.invalidHandleClasses[i];
954             }
955         }
956     },
957
958     <div id="method-Ext.dd.DragDrop-isValidHandleChild"></div>/**
959      * Checks the tag exclusion list to see if this click should be ignored
960      * @method isValidHandleChild
961      * @param {HTMLElement} node the HTMLElement to evaluate
962      * @return {boolean} true if this is a valid tag type, false if not
963      */
964     isValidHandleChild: function(node) {
965
966         var valid = true;
967         // var n = (node.nodeName == "#text") ? node.parentNode : node;
968         var nodeName;
969         try {
970             nodeName = node.nodeName.toUpperCase();
971         } catch(e) {
972             nodeName = node.nodeName;
973         }
974         valid = valid && !this.invalidHandleTypes[nodeName];
975         valid = valid && !this.invalidHandleIds[node.id];
976
977         for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
978             valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);
979         }
980
981
982         return valid;
983
984     },
985
986     /**
987      * Create the array of horizontal tick marks if an interval was specified
988      * in setXConstraint().
989      * @method setXTicks
990      * @private
991      */
992     setXTicks: function(iStartX, iTickSize) {
993         this.xTicks = [];
994         this.xTickSize = iTickSize;
995
996         var tickMap = {};
997
998         for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
999             if (!tickMap[i]) {
1000                 this.xTicks[this.xTicks.length] = i;
1001                 tickMap[i] = true;
1002             }
1003         }
1004
1005         for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
1006             if (!tickMap[i]) {
1007                 this.xTicks[this.xTicks.length] = i;
1008                 tickMap[i] = true;
1009             }
1010         }
1011
1012         this.xTicks.sort(this.DDM.numericSort) ;
1013     },
1014
1015     /**
1016      * Create the array of vertical tick marks if an interval was specified in
1017      * setYConstraint().
1018      * @method setYTicks
1019      * @private
1020      */
1021     setYTicks: function(iStartY, iTickSize) {
1022         this.yTicks = [];
1023         this.yTickSize = iTickSize;
1024
1025         var tickMap = {};
1026
1027         for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
1028             if (!tickMap[i]) {
1029                 this.yTicks[this.yTicks.length] = i;
1030                 tickMap[i] = true;
1031             }
1032         }
1033
1034         for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
1035             if (!tickMap[i]) {
1036                 this.yTicks[this.yTicks.length] = i;
1037                 tickMap[i] = true;
1038             }
1039         }
1040
1041         this.yTicks.sort(this.DDM.numericSort) ;
1042     },
1043
1044     <div id="method-Ext.dd.DragDrop-setXConstraint"></div>/**
1045      * By default, the element can be dragged any place on the screen.  Use
1046      * this method to limit the horizontal travel of the element.  Pass in
1047      * 0,0 for the parameters if you want to lock the drag to the y axis.
1048      * @method setXConstraint
1049      * @param {int} iLeft the number of pixels the element can move to the left
1050      * @param {int} iRight the number of pixels the element can move to the
1051      * right
1052      * @param {int} iTickSize optional parameter for specifying that the
1053      * element
1054      * should move iTickSize pixels at a time.
1055      */
1056     setXConstraint: function(iLeft, iRight, iTickSize) {
1057         this.leftConstraint = iLeft;
1058         this.rightConstraint = iRight;
1059
1060         this.minX = this.initPageX - iLeft;
1061         this.maxX = this.initPageX + iRight;
1062         if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
1063
1064         this.constrainX = true;
1065     },
1066
1067     <div id="method-Ext.dd.DragDrop-clearConstraints"></div>/**
1068      * Clears any constraints applied to this instance.  Also clears ticks
1069      * since they can't exist independent of a constraint at this time.
1070      * @method clearConstraints
1071      */
1072     clearConstraints: function() {
1073         this.constrainX = false;
1074         this.constrainY = false;
1075         this.clearTicks();
1076     },
1077
1078     <div id="method-Ext.dd.DragDrop-clearTicks"></div>/**
1079      * Clears any tick interval defined for this instance
1080      * @method clearTicks
1081      */
1082     clearTicks: function() {
1083         this.xTicks = null;
1084         this.yTicks = null;
1085         this.xTickSize = 0;
1086         this.yTickSize = 0;
1087     },
1088
1089     <div id="method-Ext.dd.DragDrop-setYConstraint"></div>/**
1090      * By default, the element can be dragged any place on the screen.  Set
1091      * this to limit the vertical travel of the element.  Pass in 0,0 for the
1092      * parameters if you want to lock the drag to the x axis.
1093      * @method setYConstraint
1094      * @param {int} iUp the number of pixels the element can move up
1095      * @param {int} iDown the number of pixels the element can move down
1096      * @param {int} iTickSize optional parameter for specifying that the
1097      * element should move iTickSize pixels at a time.
1098      */
1099     setYConstraint: function(iUp, iDown, iTickSize) {
1100         this.topConstraint = iUp;
1101         this.bottomConstraint = iDown;
1102
1103         this.minY = this.initPageY - iUp;
1104         this.maxY = this.initPageY + iDown;
1105         if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
1106
1107         this.constrainY = true;
1108
1109     },
1110
1111     <div id="method-Ext.dd.DragDrop-resetConstraints"></div>/**
1112      * resetConstraints must be called if you manually reposition a dd element.
1113      * @method resetConstraints
1114      * @param {boolean} maintainOffset
1115      */
1116     resetConstraints: function() {
1117         // Maintain offsets if necessary
1118         if (this.initPageX || this.initPageX === 0) {
1119             // figure out how much this thing has moved
1120             var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
1121             var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
1122
1123             this.setInitPosition(dx, dy);
1124
1125         // This is the first time we have detected the element's position
1126         } else {
1127             this.setInitPosition();
1128         }
1129
1130         if (this.constrainX) {
1131             this.setXConstraint( this.leftConstraint,
1132                                  this.rightConstraint,
1133                                  this.xTickSize        );
1134         }
1135
1136         if (this.constrainY) {
1137             this.setYConstraint( this.topConstraint,
1138                                  this.bottomConstraint,
1139                                  this.yTickSize         );
1140         }
1141     },
1142
1143     /**
1144      * Normally the drag element is moved pixel by pixel, but we can specify
1145      * that it move a number of pixels at a time.  This method resolves the
1146      * location when we have it set up like this.
1147      * @method getTick
1148      * @param {int} val where we want to place the object
1149      * @param {int[]} tickArray sorted array of valid points
1150      * @return {int} the closest tick
1151      * @private
1152      */
1153     getTick: function(val, tickArray) {
1154         if (!tickArray) {
1155             // If tick interval is not defined, it is effectively 1 pixel,
1156             // so we return the value passed to us.
1157             return val;
1158         } else if (tickArray[0] >= val) {
1159             // The value is lower than the first tick, so we return the first
1160             // tick.
1161             return tickArray[0];
1162         } else {
1163             for (var i=0, len=tickArray.length; i<len; ++i) {
1164                 var next = i + 1;
1165                 if (tickArray[next] && tickArray[next] >= val) {
1166                     var diff1 = val - tickArray[i];
1167                     var diff2 = tickArray[next] - val;
1168                     return (diff2 > diff1) ? tickArray[i] : tickArray[next];
1169                 }
1170             }
1171
1172             // The value is larger than the last tick, so we return the last
1173             // tick.
1174             return tickArray[tickArray.length - 1];
1175         }
1176     },
1177
1178     <div id="method-Ext.dd.DragDrop-toString"></div>/**
1179      * toString method
1180      * @method toString
1181      * @return {string} string representation of the dd obj
1182      */
1183     toString: function() {
1184         return ("DragDrop " + this.id);
1185     }
1186
1187 };
1188
1189 })();
1190 /*
1191  * The drag and drop utility provides a framework for building drag and drop
1192  * applications.  In addition to enabling drag and drop for specific elements,
1193  * the drag and drop elements are tracked by the manager class, and the
1194  * interactions between the various elements are tracked during the drag and
1195  * the implementing code is notified about these important moments.
1196  */
1197
1198 // Only load the library once.  Rewriting the manager class would orphan
1199 // existing drag and drop instances.
1200 if (!Ext.dd.DragDropMgr) {
1201
1202 <div id="cls-Ext.dd.DragDropMgr"></div>/**
1203  * @class Ext.dd.DragDropMgr
1204  * DragDropMgr is a singleton that tracks the element interaction for
1205  * all DragDrop items in the window.  Generally, you will not call
1206  * this class directly, but it does have helper methods that could
1207  * be useful in your DragDrop implementations.
1208  * @singleton
1209  */
1210 Ext.dd.DragDropMgr = function() {
1211
1212     var Event = Ext.EventManager;
1213
1214     return {
1215
1216         /**
1217          * Two dimensional Array of registered DragDrop objects.  The first
1218          * dimension is the DragDrop item group, the second the DragDrop
1219          * object.
1220          * @property ids
1221          * @type String[]
1222          * @private
1223          * @static
1224          */
1225         ids: {},
1226
1227         /**
1228          * Array of element ids defined as drag handles.  Used to determine
1229          * if the element that generated the mousedown event is actually the
1230          * handle and not the html element itself.
1231          * @property handleIds
1232          * @type String[]
1233          * @private
1234          * @static
1235          */
1236         handleIds: {},
1237
1238         /**
1239          * the DragDrop object that is currently being dragged
1240          * @property dragCurrent
1241          * @type DragDrop
1242          * @private
1243          * @static
1244          **/
1245         dragCurrent: null,
1246
1247         /**
1248          * the DragDrop object(s) that are being hovered over
1249          * @property dragOvers
1250          * @type Array
1251          * @private
1252          * @static
1253          */
1254         dragOvers: {},
1255
1256         /**
1257          * the X distance between the cursor and the object being dragged
1258          * @property deltaX
1259          * @type int
1260          * @private
1261          * @static
1262          */
1263         deltaX: 0,
1264
1265         /**
1266          * the Y distance between the cursor and the object being dragged
1267          * @property deltaY
1268          * @type int
1269          * @private
1270          * @static
1271          */
1272         deltaY: 0,
1273
1274         <div id="prop-Ext.dd.DragDropMgr-preventDefault"></div>/**
1275          * Flag to determine if we should prevent the default behavior of the
1276          * events we define. By default this is true, but this can be set to
1277          * false if you need the default behavior (not recommended)
1278          * @property preventDefault
1279          * @type boolean
1280          * @static
1281          */
1282         preventDefault: true,
1283
1284         <div id="prop-Ext.dd.DragDropMgr-stopPropagation"></div>/**
1285          * Flag to determine if we should stop the propagation of the events
1286          * we generate. This is true by default but you may want to set it to
1287          * false if the html element contains other features that require the
1288          * mouse click.
1289          * @property stopPropagation
1290          * @type boolean
1291          * @static
1292          */
1293         stopPropagation: true,
1294
1295         /**
1296          * Internal flag that is set to true when drag and drop has been
1297          * intialized
1298          * @property initialized
1299          * @private
1300          * @static
1301          */
1302         initialized: false,
1303
1304         /**
1305          * All drag and drop can be disabled.
1306          * @property locked
1307          * @private
1308          * @static
1309          */
1310         locked: false,
1311
1312         /**
1313          * Called the first time an element is registered.
1314          * @method init
1315          * @private
1316          * @static
1317          */
1318         init: function() {
1319             this.initialized = true;
1320         },
1321
1322         <div id="prop-Ext.dd.DragDropMgr-POINT"></div>/**
1323          * In point mode, drag and drop interaction is defined by the
1324          * location of the cursor during the drag/drop
1325          * @property POINT
1326          * @type int
1327          * @static
1328          */
1329         POINT: 0,
1330
1331         <div id="prop-Ext.dd.DragDropMgr-INTERSECT"></div>/**
1332          * In intersect mode, drag and drop interaction is defined by the
1333          * overlap of two or more drag and drop objects.
1334          * @property INTERSECT
1335          * @type int
1336          * @static
1337          */
1338         INTERSECT: 1,
1339
1340         <div id="prop-Ext.dd.DragDropMgr-mode"></div>/**
1341          * The current drag and drop mode.  Default: POINT
1342          * @property mode
1343          * @type int
1344          * @static
1345          */
1346         mode: 0,
1347
1348         /**
1349          * Runs method on all drag and drop objects
1350          * @method _execOnAll
1351          * @private
1352          * @static
1353          */
1354         _execOnAll: function(sMethod, args) {
1355             for (var i in this.ids) {
1356                 for (var j in this.ids[i]) {
1357                     var oDD = this.ids[i][j];
1358                     if (! this.isTypeOfDD(oDD)) {
1359                         continue;
1360                     }
1361                     oDD[sMethod].apply(oDD, args);
1362                 }
1363             }
1364         },
1365
1366         /**
1367          * Drag and drop initialization.  Sets up the global event handlers
1368          * @method _onLoad
1369          * @private
1370          * @static
1371          */
1372         _onLoad: function() {
1373
1374             this.init();
1375
1376
1377             Event.on(document, "mouseup",   this.handleMouseUp, this, true);
1378             Event.on(document, "mousemove", this.handleMouseMove, this, true);
1379             Event.on(window,   "unload",    this._onUnload, this, true);
1380             Event.on(window,   "resize",    this._onResize, this, true);
1381             // Event.on(window,   "mouseout",    this._test);
1382
1383         },
1384
1385         /**
1386          * Reset constraints on all drag and drop objs
1387          * @method _onResize
1388          * @private
1389          * @static
1390          */
1391         _onResize: function(e) {
1392             this._execOnAll("resetConstraints", []);
1393         },
1394
1395         <div id="method-Ext.dd.DragDropMgr-lock"></div>/**
1396          * Lock all drag and drop functionality
1397          * @method lock
1398          * @static
1399          */
1400         lock: function() { this.locked = true; },
1401
1402         <div id="method-Ext.dd.DragDropMgr-unlock"></div>/**
1403          * Unlock all drag and drop functionality
1404          * @method unlock
1405          * @static
1406          */
1407         unlock: function() { this.locked = false; },
1408
1409         <div id="method-Ext.dd.DragDropMgr-isLocked"></div>/**
1410          * Is drag and drop locked?
1411          * @method isLocked
1412          * @return {boolean} True if drag and drop is locked, false otherwise.
1413          * @static
1414          */
1415         isLocked: function() { return this.locked; },
1416
1417         /**
1418          * Location cache that is set for all drag drop objects when a drag is
1419          * initiated, cleared when the drag is finished.
1420          * @property locationCache
1421          * @private
1422          * @static
1423          */
1424         locationCache: {},
1425
1426         <div id="prop-Ext.dd.DragDropMgr-useCache"></div>/**
1427          * Set useCache to false if you want to force object the lookup of each
1428          * drag and drop linked element constantly during a drag.
1429          * @property useCache
1430          * @type boolean
1431          * @static
1432          */
1433         useCache: true,
1434
1435         <div id="prop-Ext.dd.DragDropMgr-clickPixelThresh"></div>/**
1436          * The number of pixels that the mouse needs to move after the
1437          * mousedown before the drag is initiated.  Default=3;
1438          * @property clickPixelThresh
1439          * @type int
1440          * @static
1441          */
1442         clickPixelThresh: 3,
1443
1444         <div id="prop-Ext.dd.DragDropMgr-clickTimeThresh"></div>/**
1445          * The number of milliseconds after the mousedown event to initiate the
1446          * drag if we don't get a mouseup event. Default=350
1447          * @property clickTimeThresh
1448          * @type int
1449          * @static
1450          */
1451         clickTimeThresh: 350,
1452
1453         /**
1454          * Flag that indicates that either the drag pixel threshold or the
1455          * mousdown time threshold has been met
1456          * @property dragThreshMet
1457          * @type boolean
1458          * @private
1459          * @static
1460          */
1461         dragThreshMet: false,
1462
1463         /**
1464          * Timeout used for the click time threshold
1465          * @property clickTimeout
1466          * @type Object
1467          * @private
1468          * @static
1469          */
1470         clickTimeout: null,
1471
1472         /**
1473          * The X position of the mousedown event stored for later use when a
1474          * drag threshold is met.
1475          * @property startX
1476          * @type int
1477          * @private
1478          * @static
1479          */
1480         startX: 0,
1481
1482         /**
1483          * The Y position of the mousedown event stored for later use when a
1484          * drag threshold is met.
1485          * @property startY
1486          * @type int
1487          * @private
1488          * @static
1489          */
1490         startY: 0,
1491
1492         <div id="method-Ext.dd.DragDropMgr-regDragDrop"></div>/**
1493          * Each DragDrop instance must be registered with the DragDropMgr.
1494          * This is executed in DragDrop.init()
1495          * @method regDragDrop
1496          * @param {DragDrop} oDD the DragDrop object to register
1497          * @param {String} sGroup the name of the group this element belongs to
1498          * @static
1499          */
1500         regDragDrop: function(oDD, sGroup) {
1501             if (!this.initialized) { this.init(); }
1502
1503             if (!this.ids[sGroup]) {
1504                 this.ids[sGroup] = {};
1505             }
1506             this.ids[sGroup][oDD.id] = oDD;
1507         },
1508
1509         /**
1510          * Removes the supplied dd instance from the supplied group. Executed
1511          * by DragDrop.removeFromGroup, so don't call this function directly.
1512          * @method removeDDFromGroup
1513          * @private
1514          * @static
1515          */
1516         removeDDFromGroup: function(oDD, sGroup) {
1517             if (!this.ids[sGroup]) {
1518                 this.ids[sGroup] = {};
1519             }
1520
1521             var obj = this.ids[sGroup];
1522             if (obj && obj[oDD.id]) {
1523                 delete obj[oDD.id];
1524             }
1525         },
1526
1527         /**
1528          * Unregisters a drag and drop item.  This is executed in
1529          * DragDrop.unreg, use that method instead of calling this directly.
1530          * @method _remove
1531          * @private
1532          * @static
1533          */
1534         _remove: function(oDD) {
1535             for (var g in oDD.groups) {
1536                 if (g && this.ids[g] && this.ids[g][oDD.id]) {
1537                     delete this.ids[g][oDD.id];
1538                 }
1539             }
1540             delete this.handleIds[oDD.id];
1541         },
1542
1543         <div id="method-Ext.dd.DragDropMgr-regHandle"></div>/**
1544          * Each DragDrop handle element must be registered.  This is done
1545          * automatically when executing DragDrop.setHandleElId()
1546          * @method regHandle
1547          * @param {String} sDDId the DragDrop id this element is a handle for
1548          * @param {String} sHandleId the id of the element that is the drag
1549          * handle
1550          * @static
1551          */
1552         regHandle: function(sDDId, sHandleId) {
1553             if (!this.handleIds[sDDId]) {
1554                 this.handleIds[sDDId] = {};
1555             }
1556             this.handleIds[sDDId][sHandleId] = sHandleId;
1557         },
1558
1559         <div id="method-Ext.dd.DragDropMgr-isDragDrop"></div>/**
1560          * Utility function to determine if a given element has been
1561          * registered as a drag drop item.
1562          * @method isDragDrop
1563          * @param {String} id the element id to check
1564          * @return {boolean} true if this element is a DragDrop item,
1565          * false otherwise
1566          * @static
1567          */
1568         isDragDrop: function(id) {
1569             return ( this.getDDById(id) ) ? true : false;
1570         },
1571
1572         <div id="method-Ext.dd.DragDropMgr-getRelated"></div>/**
1573          * Returns the drag and drop instances that are in all groups the
1574          * passed in instance belongs to.
1575          * @method getRelated
1576          * @param {DragDrop} p_oDD the obj to get related data for
1577          * @param {boolean} bTargetsOnly if true, only return targetable objs
1578          * @return {DragDrop[]} the related instances
1579          * @static
1580          */
1581         getRelated: function(p_oDD, bTargetsOnly) {
1582             var oDDs = [];
1583             for (var i in p_oDD.groups) {
1584                 for (var j in this.ids[i]) {
1585                     var dd = this.ids[i][j];
1586                     if (! this.isTypeOfDD(dd)) {
1587                         continue;
1588                     }
1589                     if (!bTargetsOnly || dd.isTarget) {
1590                         oDDs[oDDs.length] = dd;
1591                     }
1592                 }
1593             }
1594
1595             return oDDs;
1596         },
1597
1598         <div id="method-Ext.dd.DragDropMgr-isLegalTarget"></div>/**
1599          * Returns true if the specified dd target is a legal target for
1600          * the specifice drag obj
1601          * @method isLegalTarget
1602          * @param {DragDrop} oDD the drag obj
1603          * @param {DragDrop} oTargetDD the target
1604          * @return {boolean} true if the target is a legal target for the
1605          * dd obj
1606          * @static
1607          */
1608         isLegalTarget: function (oDD, oTargetDD) {
1609             var targets = this.getRelated(oDD, true);
1610             for (var i=0, len=targets.length;i<len;++i) {
1611                 if (targets[i].id == oTargetDD.id) {
1612                     return true;
1613                 }
1614             }
1615
1616             return false;
1617         },
1618
1619         <div id="method-Ext.dd.DragDropMgr-isTypeOfDD"></div>/**
1620          * My goal is to be able to transparently determine if an object is
1621          * typeof DragDrop, and the exact subclass of DragDrop.  typeof
1622          * returns "object", oDD.constructor.toString() always returns
1623          * "DragDrop" and not the name of the subclass.  So for now it just
1624          * evaluates a well-known variable in DragDrop.
1625          * @method isTypeOfDD
1626          * @param {Object} the object to evaluate
1627          * @return {boolean} true if typeof oDD = DragDrop
1628          * @static
1629          */
1630         isTypeOfDD: function (oDD) {
1631             return (oDD && oDD.__ygDragDrop);
1632         },
1633
1634         <div id="method-Ext.dd.DragDropMgr-isHandle"></div>/**
1635          * Utility function to determine if a given element has been
1636          * registered as a drag drop handle for the given Drag Drop object.
1637          * @method isHandle
1638          * @param {String} id the element id to check
1639          * @return {boolean} true if this element is a DragDrop handle, false
1640          * otherwise
1641          * @static
1642          */
1643         isHandle: function(sDDId, sHandleId) {
1644             return ( this.handleIds[sDDId] &&
1645                             this.handleIds[sDDId][sHandleId] );
1646         },
1647
1648         <div id="method-Ext.dd.DragDropMgr-getDDById"></div>/**
1649          * Returns the DragDrop instance for a given id
1650          * @method getDDById
1651          * @param {String} id the id of the DragDrop object
1652          * @return {DragDrop} the drag drop object, null if it is not found
1653          * @static
1654          */
1655         getDDById: function(id) {
1656             for (var i in this.ids) {
1657                 if (this.ids[i][id]) {
1658                     return this.ids[i][id];
1659                 }
1660             }
1661             return null;
1662         },
1663
1664         /**
1665          * Fired after a registered DragDrop object gets the mousedown event.
1666          * Sets up the events required to track the object being dragged
1667          * @method handleMouseDown
1668          * @param {Event} e the event
1669          * @param oDD the DragDrop object being dragged
1670          * @private
1671          * @static
1672          */
1673         handleMouseDown: function(e, oDD) {
1674             if(Ext.QuickTips){
1675                 Ext.QuickTips.disable();
1676             }
1677             if(this.dragCurrent){
1678                 // the original browser mouseup wasn't handled (e.g. outside FF browser window)
1679                 // so clean up first to avoid breaking the next drag
1680                 this.handleMouseUp(e);
1681             }
1682             
1683             this.currentTarget = e.getTarget();
1684             this.dragCurrent = oDD;
1685
1686             var el = oDD.getEl();
1687
1688             // track start position
1689             this.startX = e.getPageX();
1690             this.startY = e.getPageY();
1691
1692             this.deltaX = this.startX - el.offsetLeft;
1693             this.deltaY = this.startY - el.offsetTop;
1694
1695             this.dragThreshMet = false;
1696
1697             this.clickTimeout = setTimeout(
1698                     function() {
1699                         var DDM = Ext.dd.DDM;
1700                         DDM.startDrag(DDM.startX, DDM.startY);
1701                     },
1702                     this.clickTimeThresh );
1703         },
1704
1705         <div id="method-Ext.dd.DragDropMgr-startDrag"></div>/**
1706          * Fired when either the drag pixel threshol or the mousedown hold
1707          * time threshold has been met.
1708          * @method startDrag
1709          * @param x {int} the X position of the original mousedown
1710          * @param y {int} the Y position of the original mousedown
1711          * @static
1712          */
1713         startDrag: function(x, y) {
1714             clearTimeout(this.clickTimeout);
1715             if (this.dragCurrent) {
1716                 this.dragCurrent.b4StartDrag(x, y);
1717                 this.dragCurrent.startDrag(x, y);
1718             }
1719             this.dragThreshMet = true;
1720         },
1721
1722         /**
1723          * Internal function to handle the mouseup event.  Will be invoked
1724          * from the context of the document.
1725          * @method handleMouseUp
1726          * @param {Event} e the event
1727          * @private
1728          * @static
1729          */
1730         handleMouseUp: function(e) {
1731
1732             if(Ext.QuickTips){
1733                 Ext.QuickTips.enable();
1734             }
1735             if (! this.dragCurrent) {
1736                 return;
1737             }
1738
1739             clearTimeout(this.clickTimeout);
1740
1741             if (this.dragThreshMet) {
1742                 this.fireEvents(e, true);
1743             } else {
1744             }
1745
1746             this.stopDrag(e);
1747
1748             this.stopEvent(e);
1749         },
1750
1751         <div id="method-Ext.dd.DragDropMgr-stopEvent"></div>/**
1752          * Utility to stop event propagation and event default, if these
1753          * features are turned on.
1754          * @method stopEvent
1755          * @param {Event} e the event as returned by this.getEvent()
1756          * @static
1757          */
1758         stopEvent: function(e){
1759             if(this.stopPropagation) {
1760                 e.stopPropagation();
1761             }
1762
1763             if (this.preventDefault) {
1764                 e.preventDefault();
1765             }
1766         },
1767
1768         /**
1769          * Internal function to clean up event handlers after the drag
1770          * operation is complete
1771          * @method stopDrag
1772          * @param {Event} e the event
1773          * @private
1774          * @static
1775          */
1776         stopDrag: function(e) {
1777             // Fire the drag end event for the item that was dragged
1778             if (this.dragCurrent) {
1779                 if (this.dragThreshMet) {
1780                     this.dragCurrent.b4EndDrag(e);
1781                     this.dragCurrent.endDrag(e);
1782                 }
1783
1784                 this.dragCurrent.onMouseUp(e);
1785             }
1786
1787             this.dragCurrent = null;
1788             this.dragOvers = {};
1789         },
1790
1791         /**
1792          * Internal function to handle the mousemove event.  Will be invoked
1793          * from the context of the html element.
1794          *
1795          * @TODO figure out what we can do about mouse events lost when the
1796          * user drags objects beyond the window boundary.  Currently we can
1797          * detect this in internet explorer by verifying that the mouse is
1798          * down during the mousemove event.  Firefox doesn't give us the
1799          * button state on the mousemove event.
1800          * @method handleMouseMove
1801          * @param {Event} e the event
1802          * @private
1803          * @static
1804          */
1805         handleMouseMove: function(e) {
1806             if (! this.dragCurrent) {
1807                 return true;
1808             }
1809             // var button = e.which || e.button;
1810
1811             // check for IE mouseup outside of page boundary
1812             if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {
1813                 this.stopEvent(e);
1814                 return this.handleMouseUp(e);
1815             }
1816
1817             if (!this.dragThreshMet) {
1818                 var diffX = Math.abs(this.startX - e.getPageX());
1819                 var diffY = Math.abs(this.startY - e.getPageY());
1820                 if (diffX > this.clickPixelThresh ||
1821                             diffY > this.clickPixelThresh) {
1822                     this.startDrag(this.startX, this.startY);
1823                 }
1824             }
1825
1826             if (this.dragThreshMet) {
1827                 this.dragCurrent.b4Drag(e);
1828                 this.dragCurrent.onDrag(e);
1829                 if(!this.dragCurrent.moveOnly){
1830                     this.fireEvents(e, false);
1831                 }
1832             }
1833
1834             this.stopEvent(e);
1835
1836             return true;
1837         },
1838
1839         /**
1840          * Iterates over all of the DragDrop elements to find ones we are
1841          * hovering over or dropping on
1842          * @method fireEvents
1843          * @param {Event} e the event
1844          * @param {boolean} isDrop is this a drop op or a mouseover op?
1845          * @private
1846          * @static
1847          */
1848         fireEvents: function(e, isDrop) {
1849             var dc = this.dragCurrent;
1850
1851             // If the user did the mouse up outside of the window, we could
1852             // get here even though we have ended the drag.
1853             if (!dc || dc.isLocked()) {
1854                 return;
1855             }
1856
1857             var pt = e.getPoint();
1858
1859             // cache the previous dragOver array
1860             var oldOvers = [];
1861
1862             var outEvts   = [];
1863             var overEvts  = [];
1864             var dropEvts  = [];
1865             var enterEvts = [];
1866
1867             // Check to see if the object(s) we were hovering over is no longer
1868             // being hovered over so we can fire the onDragOut event
1869             for (var i in this.dragOvers) {
1870
1871                 var ddo = this.dragOvers[i];
1872
1873                 if (! this.isTypeOfDD(ddo)) {
1874                     continue;
1875                 }
1876
1877                 if (! this.isOverTarget(pt, ddo, this.mode)) {
1878                     outEvts.push( ddo );
1879                 }
1880
1881                 oldOvers[i] = true;
1882                 delete this.dragOvers[i];
1883             }
1884
1885             for (var sGroup in dc.groups) {
1886
1887                 if ("string" != typeof sGroup) {
1888                     continue;
1889                 }
1890
1891                 for (i in this.ids[sGroup]) {
1892                     var oDD = this.ids[sGroup][i];
1893                     if (! this.isTypeOfDD(oDD)) {
1894                         continue;
1895                     }
1896
1897                     if (oDD.isTarget && !oDD.isLocked() && ((oDD != dc) || (dc.ignoreSelf === false))) {
1898                         if (this.isOverTarget(pt, oDD, this.mode)) {
1899                             // look for drop interactions
1900                             if (isDrop) {
1901                                 dropEvts.push( oDD );
1902                             // look for drag enter and drag over interactions
1903                             } else {
1904
1905                                 // initial drag over: dragEnter fires
1906                                 if (!oldOvers[oDD.id]) {
1907                                     enterEvts.push( oDD );
1908                                 // subsequent drag overs: dragOver fires
1909                                 } else {
1910                                     overEvts.push( oDD );
1911                                 }
1912
1913                                 this.dragOvers[oDD.id] = oDD;
1914                             }
1915                         }
1916                     }
1917                 }
1918             }
1919
1920             if (this.mode) {
1921                 if (outEvts.length) {
1922                     dc.b4DragOut(e, outEvts);
1923                     dc.onDragOut(e, outEvts);
1924                 }
1925
1926                 if (enterEvts.length) {
1927                     dc.onDragEnter(e, enterEvts);
1928                 }
1929
1930                 if (overEvts.length) {
1931                     dc.b4DragOver(e, overEvts);
1932                     dc.onDragOver(e, overEvts);
1933                 }
1934
1935                 if (dropEvts.length) {
1936                     dc.b4DragDrop(e, dropEvts);
1937                     dc.onDragDrop(e, dropEvts);
1938                 }
1939
1940             } else {
1941                 // fire dragout events
1942                 var len = 0;
1943                 for (i=0, len=outEvts.length; i<len; ++i) {
1944                     dc.b4DragOut(e, outEvts[i].id);
1945                     dc.onDragOut(e, outEvts[i].id);
1946                 }
1947
1948                 // fire enter events
1949                 for (i=0,len=enterEvts.length; i<len; ++i) {
1950                     // dc.b4DragEnter(e, oDD.id);
1951                     dc.onDragEnter(e, enterEvts[i].id);
1952                 }
1953
1954                 // fire over events
1955                 for (i=0,len=overEvts.length; i<len; ++i) {
1956                     dc.b4DragOver(e, overEvts[i].id);
1957                     dc.onDragOver(e, overEvts[i].id);
1958                 }
1959
1960                 // fire drop events
1961                 for (i=0, len=dropEvts.length; i<len; ++i) {
1962                     dc.b4DragDrop(e, dropEvts[i].id);
1963                     dc.onDragDrop(e, dropEvts[i].id);
1964                 }
1965
1966             }
1967
1968             // notify about a drop that did not find a target
1969             if (isDrop && !dropEvts.length) {
1970                 dc.onInvalidDrop(e);
1971             }
1972
1973         },
1974
1975         <div id="method-Ext.dd.DragDropMgr-getBestMatch"></div>/**
1976          * Helper function for getting the best match from the list of drag
1977          * and drop objects returned by the drag and drop events when we are
1978          * in INTERSECT mode.  It returns either the first object that the
1979          * cursor is over, or the object that has the greatest overlap with
1980          * the dragged element.
1981          * @method getBestMatch
1982          * @param  {DragDrop[]} dds The array of drag and drop objects
1983          * targeted
1984          * @return {DragDrop}       The best single match
1985          * @static
1986          */
1987         getBestMatch: function(dds) {
1988             var winner = null;
1989             // Return null if the input is not what we expect
1990             //if (!dds || !dds.length || dds.length == 0) {
1991                // winner = null;
1992             // If there is only one item, it wins
1993             //} else if (dds.length == 1) {
1994
1995             var len = dds.length;
1996
1997             if (len == 1) {
1998                 winner = dds[0];
1999             } else {
2000                 // Loop through the targeted items
2001                 for (var i=0; i<len; ++i) {
2002                     var dd = dds[i];
2003                     // If the cursor is over the object, it wins.  If the
2004                     // cursor is over multiple matches, the first one we come
2005                     // to wins.
2006                     if (dd.cursorIsOver) {
2007                         winner = dd;
2008                         break;
2009                     // Otherwise the object with the most overlap wins
2010                     } else {
2011                         if (!winner ||
2012                             winner.overlap.getArea() < dd.overlap.getArea()) {
2013                             winner = dd;
2014                         }
2015                     }
2016                 }
2017             }
2018
2019             return winner;
2020         },
2021
2022         <div id="method-Ext.dd.DragDropMgr-refreshCache"></div>/**
2023          * Refreshes the cache of the top-left and bottom-right points of the
2024          * drag and drop objects in the specified group(s).  This is in the
2025          * format that is stored in the drag and drop instance, so typical
2026          * usage is:
2027          * <code>
2028          * Ext.dd.DragDropMgr.refreshCache(ddinstance.groups);
2029          * </code>
2030          * Alternatively:
2031          * <code>
2032          * Ext.dd.DragDropMgr.refreshCache({group1:true, group2:true});
2033          * </code>
2034          * @TODO this really should be an indexed array.  Alternatively this
2035          * method could accept both.
2036          * @method refreshCache
2037          * @param {Object} groups an associative array of groups to refresh
2038          * @static
2039          */
2040         refreshCache: function(groups) {
2041             for (var sGroup in groups) {
2042                 if ("string" != typeof sGroup) {
2043                     continue;
2044                 }
2045                 for (var i in this.ids[sGroup]) {
2046                     var oDD = this.ids[sGroup][i];
2047
2048                     if (this.isTypeOfDD(oDD)) {
2049                     // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
2050                         var loc = this.getLocation(oDD);
2051                         if (loc) {
2052                             this.locationCache[oDD.id] = loc;
2053                         } else {
2054                             delete this.locationCache[oDD.id];
2055                             // this will unregister the drag and drop object if
2056                             // the element is not in a usable state
2057                             // oDD.unreg();
2058                         }
2059                     }
2060                 }
2061             }
2062         },
2063
2064         <div id="method-Ext.dd.DragDropMgr-verifyEl"></div>/**
2065          * This checks to make sure an element exists and is in the DOM.  The
2066          * main purpose is to handle cases where innerHTML is used to remove
2067          * drag and drop objects from the DOM.  IE provides an 'unspecified
2068          * error' when trying to access the offsetParent of such an element
2069          * @method verifyEl
2070          * @param {HTMLElement} el the element to check
2071          * @return {boolean} true if the element looks usable
2072          * @static
2073          */
2074         verifyEl: function(el) {
2075             if (el) {
2076                 var parent;
2077                 if(Ext.isIE){
2078                     try{
2079                         parent = el.offsetParent;
2080                     }catch(e){}
2081                 }else{
2082                     parent = el.offsetParent;
2083                 }
2084                 if (parent) {
2085                     return true;
2086                 }
2087             }
2088
2089             return false;
2090         },
2091
2092         <div id="method-Ext.dd.DragDropMgr-getLocation"></div>/**
2093          * Returns a Region object containing the drag and drop element's position
2094          * and size, including the padding configured for it
2095          * @method getLocation
2096          * @param {DragDrop} oDD the drag and drop object to get the
2097          *                       location for
2098          * @return {Ext.lib.Region} a Region object representing the total area
2099          *                             the element occupies, including any padding
2100          *                             the instance is configured for.
2101          * @static
2102          */
2103         getLocation: function(oDD) {
2104             if (! this.isTypeOfDD(oDD)) {
2105                 return null;
2106             }
2107
2108             var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
2109
2110             try {
2111                 pos= Ext.lib.Dom.getXY(el);
2112             } catch (e) { }
2113
2114             if (!pos) {
2115                 return null;
2116             }
2117
2118             x1 = pos[0];
2119             x2 = x1 + el.offsetWidth;
2120             y1 = pos[1];
2121             y2 = y1 + el.offsetHeight;
2122
2123             t = y1 - oDD.padding[0];
2124             r = x2 + oDD.padding[1];
2125             b = y2 + oDD.padding[2];
2126             l = x1 - oDD.padding[3];
2127
2128             return new Ext.lib.Region( t, r, b, l );
2129         },
2130
2131         /**
2132          * Checks the cursor location to see if it over the target
2133          * @method isOverTarget
2134          * @param {Ext.lib.Point} pt The point to evaluate
2135          * @param {DragDrop} oTarget the DragDrop object we are inspecting
2136          * @return {boolean} true if the mouse is over the target
2137          * @private
2138          * @static
2139          */
2140         isOverTarget: function(pt, oTarget, intersect) {
2141             // use cache if available
2142             var loc = this.locationCache[oTarget.id];
2143             if (!loc || !this.useCache) {
2144                 loc = this.getLocation(oTarget);
2145                 this.locationCache[oTarget.id] = loc;
2146
2147             }
2148
2149             if (!loc) {
2150                 return false;
2151             }
2152
2153             oTarget.cursorIsOver = loc.contains( pt );
2154
2155             // DragDrop is using this as a sanity check for the initial mousedown
2156             // in this case we are done.  In POINT mode, if the drag obj has no
2157             // contraints, we are also done. Otherwise we need to evaluate the
2158             // location of the target as related to the actual location of the
2159             // dragged element.
2160             var dc = this.dragCurrent;
2161             if (!dc || !dc.getTargetCoord ||
2162                     (!intersect && !dc.constrainX && !dc.constrainY)) {
2163                 return oTarget.cursorIsOver;
2164             }
2165
2166             oTarget.overlap = null;
2167
2168             // Get the current location of the drag element, this is the
2169             // location of the mouse event less the delta that represents
2170             // where the original mousedown happened on the element.  We
2171             // need to consider constraints and ticks as well.
2172             var pos = dc.getTargetCoord(pt.x, pt.y);
2173
2174             var el = dc.getDragEl();
2175             var curRegion = new Ext.lib.Region( pos.y,
2176                                                    pos.x + el.offsetWidth,
2177                                                    pos.y + el.offsetHeight,
2178                                                    pos.x );
2179
2180             var overlap = curRegion.intersect(loc);
2181
2182             if (overlap) {
2183                 oTarget.overlap = overlap;
2184                 return (intersect) ? true : oTarget.cursorIsOver;
2185             } else {
2186                 return false;
2187             }
2188         },
2189
2190         /**
2191          * unload event handler
2192          * @method _onUnload
2193          * @private
2194          * @static
2195          */
2196         _onUnload: function(e, me) {
2197             Ext.dd.DragDropMgr.unregAll();
2198         },
2199
2200         /**
2201          * Cleans up the drag and drop events and objects.
2202          * @method unregAll
2203          * @private
2204          * @static
2205          */
2206         unregAll: function() {
2207
2208             if (this.dragCurrent) {
2209                 this.stopDrag();
2210                 this.dragCurrent = null;
2211             }
2212
2213             this._execOnAll("unreg", []);
2214
2215             for (var i in this.elementCache) {
2216                 delete this.elementCache[i];
2217             }
2218
2219             this.elementCache = {};
2220             this.ids = {};
2221         },
2222
2223         /**
2224          * A cache of DOM elements
2225          * @property elementCache
2226          * @private
2227          * @static
2228          */
2229         elementCache: {},
2230
2231         /**
2232          * Get the wrapper for the DOM element specified
2233          * @method getElWrapper
2234          * @param {String} id the id of the element to get
2235          * @return {Ext.dd.DDM.ElementWrapper} the wrapped element
2236          * @private
2237          * @deprecated This wrapper isn't that useful
2238          * @static
2239          */
2240         getElWrapper: function(id) {
2241             var oWrapper = this.elementCache[id];
2242             if (!oWrapper || !oWrapper.el) {
2243                 oWrapper = this.elementCache[id] =
2244                     new this.ElementWrapper(Ext.getDom(id));
2245             }
2246             return oWrapper;
2247         },
2248
2249         <div id="method-Ext.dd.DragDropMgr-getElement"></div>/**
2250          * Returns the actual DOM element
2251          * @method getElement
2252          * @param {String} id the id of the elment to get
2253          * @return {Object} The element
2254          * @deprecated use Ext.lib.Ext.getDom instead
2255          * @static
2256          */
2257         getElement: function(id) {
2258             return Ext.getDom(id);
2259         },
2260
2261         <div id="method-Ext.dd.DragDropMgr-getCss"></div>/**
2262          * Returns the style property for the DOM element (i.e.,
2263          * document.getElById(id).style)
2264          * @method getCss
2265          * @param {String} id the id of the elment to get
2266          * @return {Object} The style property of the element
2267          * @deprecated use Ext.lib.Dom instead
2268          * @static
2269          */
2270         getCss: function(id) {
2271             var el = Ext.getDom(id);
2272             return (el) ? el.style : null;
2273         },
2274
2275         <div id="cls-Ext.dd.DragDropMgr.ElementWrapper"></div>/**
2276          * Inner class for cached elements
2277          * @class Ext.dd.DragDropMgr.ElementWrapper
2278          * @for DragDropMgr
2279          * @private
2280          * @deprecated
2281          */
2282         ElementWrapper: function(el) {
2283                 <div id="prop-Ext.dd.DragDropMgr.ElementWrapper-el"></div>/**
2284                  * The element
2285                  * @property el
2286                  */
2287                 this.el = el || null;
2288                 <div id="prop-Ext.dd.DragDropMgr.ElementWrapper-id"></div>/**
2289                  * The element id
2290                  * @property id
2291                  */
2292                 this.id = this.el && el.id;
2293                 <div id="prop-Ext.dd.DragDropMgr.ElementWrapper-css"></div>/**
2294                  * A reference to the style property
2295                  * @property css
2296                  */
2297                 this.css = this.el && el.style;
2298             },
2299
2300         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-getPosX"></div>/**
2301          * Returns the X position of an html element
2302          * @method getPosX
2303          * @param el the element for which to get the position
2304          * @return {int} the X coordinate
2305          * @for DragDropMgr
2306          * @deprecated use Ext.lib.Dom.getX instead
2307          * @static
2308          */
2309         getPosX: function(el) {
2310             return Ext.lib.Dom.getX(el);
2311         },
2312
2313         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-getPosY"></div>/**
2314          * Returns the Y position of an html element
2315          * @method getPosY
2316          * @param el the element for which to get the position
2317          * @return {int} the Y coordinate
2318          * @deprecated use Ext.lib.Dom.getY instead
2319          * @static
2320          */
2321         getPosY: function(el) {
2322             return Ext.lib.Dom.getY(el);
2323         },
2324
2325         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-swapNode"></div>/**
2326          * Swap two nodes.  In IE, we use the native method, for others we
2327          * emulate the IE behavior
2328          * @method swapNode
2329          * @param n1 the first node to swap
2330          * @param n2 the other node to swap
2331          * @static
2332          */
2333         swapNode: function(n1, n2) {
2334             if (n1.swapNode) {
2335                 n1.swapNode(n2);
2336             } else {
2337                 var p = n2.parentNode;
2338                 var s = n2.nextSibling;
2339
2340                 if (s == n1) {
2341                     p.insertBefore(n1, n2);
2342                 } else if (n2 == n1.nextSibling) {
2343                     p.insertBefore(n2, n1);
2344                 } else {
2345                     n1.parentNode.replaceChild(n2, n1);
2346                     p.insertBefore(n1, s);
2347                 }
2348             }
2349         },
2350
2351         /**
2352          * Returns the current scroll position
2353          * @method getScroll
2354          * @private
2355          * @static
2356          */
2357         getScroll: function () {
2358             var t, l, dde=document.documentElement, db=document.body;
2359             if (dde && (dde.scrollTop || dde.scrollLeft)) {
2360                 t = dde.scrollTop;
2361                 l = dde.scrollLeft;
2362             } else if (db) {
2363                 t = db.scrollTop;
2364                 l = db.scrollLeft;
2365             } else {
2366
2367             }
2368             return { top: t, left: l };
2369         },
2370
2371         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-getStyle"></div>/**
2372          * Returns the specified element style property
2373          * @method getStyle
2374          * @param {HTMLElement} el          the element
2375          * @param {string}      styleProp   the style property
2376          * @return {string} The value of the style property
2377          * @deprecated use Ext.lib.Dom.getStyle
2378          * @static
2379          */
2380         getStyle: function(el, styleProp) {
2381             return Ext.fly(el).getStyle(styleProp);
2382         },
2383
2384         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-getScrollTop"></div>/**
2385          * Gets the scrollTop
2386          * @method getScrollTop
2387          * @return {int} the document's scrollTop
2388          * @static
2389          */
2390         getScrollTop: function () {
2391             return this.getScroll().top;
2392         },
2393
2394         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-getScrollLeft"></div>/**
2395          * Gets the scrollLeft
2396          * @method getScrollLeft
2397          * @return {int} the document's scrollTop
2398          * @static
2399          */
2400         getScrollLeft: function () {
2401             return this.getScroll().left;
2402         },
2403
2404         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-moveToEl"></div>/**
2405          * Sets the x/y position of an element to the location of the
2406          * target element.
2407          * @method moveToEl
2408          * @param {HTMLElement} moveEl      The element to move
2409          * @param {HTMLElement} targetEl    The position reference element
2410          * @static
2411          */
2412         moveToEl: function (moveEl, targetEl) {
2413             var aCoord = Ext.lib.Dom.getXY(targetEl);
2414             Ext.lib.Dom.setXY(moveEl, aCoord);
2415         },
2416
2417         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-numericSort"></div>/**
2418          * Numeric array sort function
2419          * @method numericSort
2420          * @static
2421          */
2422         numericSort: function(a, b) {
2423             return (a - b);
2424         },
2425
2426         /**
2427          * Internal counter
2428          * @property _timeoutCount
2429          * @private
2430          * @static
2431          */
2432         _timeoutCount: 0,
2433
2434         /**
2435          * Trying to make the load order less important.  Without this we get
2436          * an error if this file is loaded before the Event Utility.
2437          * @method _addListeners
2438          * @private
2439          * @static
2440          */
2441         _addListeners: function() {
2442             var DDM = Ext.dd.DDM;
2443             if ( Ext.lib.Event && document ) {
2444                 DDM._onLoad();
2445             } else {
2446                 if (DDM._timeoutCount > 2000) {
2447                 } else {
2448                     setTimeout(DDM._addListeners, 10);
2449                     if (document && document.body) {
2450                         DDM._timeoutCount += 1;
2451                     }
2452                 }
2453             }
2454         },
2455
2456         <div id="method-Ext.dd.DragDropMgr.ElementWrapper-handleWasClicked"></div>/**
2457          * Recursively searches the immediate parent and all child nodes for
2458          * the handle element in order to determine wheter or not it was
2459          * clicked.
2460          * @method handleWasClicked
2461          * @param node the html element to inspect
2462          * @static
2463          */
2464         handleWasClicked: function(node, id) {
2465             if (this.isHandle(id, node.id)) {
2466                 return true;
2467             } else {
2468                 // check to see if this is a text node child of the one we want
2469                 var p = node.parentNode;
2470
2471                 while (p) {
2472                     if (this.isHandle(id, p.id)) {
2473                         return true;
2474                     } else {
2475                         p = p.parentNode;
2476                     }
2477                 }
2478             }
2479
2480             return false;
2481         }
2482
2483     };
2484
2485 }();
2486
2487 // shorter alias, save a few bytes
2488 Ext.dd.DDM = Ext.dd.DragDropMgr;
2489 Ext.dd.DDM._addListeners();
2490
2491 }
2492
2493 <div id="cls-Ext.dd.DD"></div>/**
2494  * @class Ext.dd.DD
2495  * A DragDrop implementation where the linked element follows the
2496  * mouse cursor during a drag.
2497  * @extends Ext.dd.DragDrop
2498  * @constructor
2499  * @param {String} id the id of the linked element
2500  * @param {String} sGroup the group of related DragDrop items
2501  * @param {object} config an object containing configurable attributes
2502  *                Valid properties for DD:
2503  *                    scroll
2504  */
2505 Ext.dd.DD = function(id, sGroup, config) {
2506     if (id) {
2507         this.init(id, sGroup, config);
2508     }
2509 };
2510
2511 Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {
2512
2513     <div id="prop-Ext.dd.DD-scroll"></div>/**
2514      * When set to true, the utility automatically tries to scroll the browser
2515      * window when a drag and drop element is dragged near the viewport boundary.
2516      * Defaults to true.
2517      * @property scroll
2518      * @type boolean
2519      */
2520     scroll: true,
2521
2522     <div id="method-Ext.dd.DD-autoOffset"></div>/**
2523      * Sets the pointer offset to the distance between the linked element's top
2524      * left corner and the location the element was clicked
2525      * @method autoOffset
2526      * @param {int} iPageX the X coordinate of the click
2527      * @param {int} iPageY the Y coordinate of the click
2528      */
2529     autoOffset: function(iPageX, iPageY) {
2530         var x = iPageX - this.startPageX;
2531         var y = iPageY - this.startPageY;
2532         this.setDelta(x, y);
2533     },
2534
2535     <div id="method-Ext.dd.DD-setDelta"></div>/**
2536      * Sets the pointer offset.  You can call this directly to force the
2537      * offset to be in a particular location (e.g., pass in 0,0 to set it
2538      * to the center of the object)
2539      * @method setDelta
2540      * @param {int} iDeltaX the distance from the left
2541      * @param {int} iDeltaY the distance from the top
2542      */
2543     setDelta: function(iDeltaX, iDeltaY) {
2544         this.deltaX = iDeltaX;
2545         this.deltaY = iDeltaY;
2546     },
2547
2548     <div id="method-Ext.dd.DD-setDragElPos"></div>/**
2549      * Sets the drag element to the location of the mousedown or click event,
2550      * maintaining the cursor location relative to the location on the element
2551      * that was clicked.  Override this if you want to place the element in a
2552      * location other than where the cursor is.
2553      * @method setDragElPos
2554      * @param {int} iPageX the X coordinate of the mousedown or drag event
2555      * @param {int} iPageY the Y coordinate of the mousedown or drag event
2556      */
2557     setDragElPos: function(iPageX, iPageY) {
2558         // the first time we do this, we are going to check to make sure
2559         // the element has css positioning
2560
2561         var el = this.getDragEl();
2562         this.alignElWithMouse(el, iPageX, iPageY);
2563     },
2564
2565     <div id="method-Ext.dd.DD-alignElWithMouse"></div>/**
2566      * Sets the element to the location of the mousedown or click event,
2567      * maintaining the cursor location relative to the location on the element
2568      * that was clicked.  Override this if you want to place the element in a
2569      * location other than where the cursor is.
2570      * @method alignElWithMouse
2571      * @param {HTMLElement} el the element to move
2572      * @param {int} iPageX the X coordinate of the mousedown or drag event
2573      * @param {int} iPageY the Y coordinate of the mousedown or drag event
2574      */
2575     alignElWithMouse: function(el, iPageX, iPageY) {
2576         var oCoord = this.getTargetCoord(iPageX, iPageY);
2577         var fly = el.dom ? el : Ext.fly(el, '_dd');
2578         if (!this.deltaSetXY) {
2579             var aCoord = [oCoord.x, oCoord.y];
2580             fly.setXY(aCoord);
2581             var newLeft = fly.getLeft(true);
2582             var newTop  = fly.getTop(true);
2583             this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
2584         } else {
2585             fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);
2586         }
2587
2588         this.cachePosition(oCoord.x, oCoord.y);
2589         this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
2590         return oCoord;
2591     },
2592
2593     <div id="method-Ext.dd.DD-cachePosition"></div>/**
2594      * Saves the most recent position so that we can reset the constraints and
2595      * tick marks on-demand.  We need to know this so that we can calculate the
2596      * number of pixels the element is offset from its original position.
2597      * @method cachePosition
2598      * @param iPageX the current x position (optional, this just makes it so we
2599      * don't have to look it up again)
2600      * @param iPageY the current y position (optional, this just makes it so we
2601      * don't have to look it up again)
2602      */
2603     cachePosition: function(iPageX, iPageY) {
2604         if (iPageX) {
2605             this.lastPageX = iPageX;
2606             this.lastPageY = iPageY;
2607         } else {
2608             var aCoord = Ext.lib.Dom.getXY(this.getEl());
2609             this.lastPageX = aCoord[0];
2610             this.lastPageY = aCoord[1];
2611         }
2612     },
2613
2614     /**
2615      * Auto-scroll the window if the dragged object has been moved beyond the
2616      * visible window boundary.
2617      * @method autoScroll
2618      * @param {int} x the drag element's x position
2619      * @param {int} y the drag element's y position
2620      * @param {int} h the height of the drag element
2621      * @param {int} w the width of the drag element
2622      * @private
2623      */
2624     autoScroll: function(x, y, h, w) {
2625
2626         if (this.scroll) {
2627             // The client height
2628             var clientH = Ext.lib.Dom.getViewHeight();
2629
2630             // The client width
2631             var clientW = Ext.lib.Dom.getViewWidth();
2632
2633             // The amt scrolled down
2634             var st = this.DDM.getScrollTop();
2635
2636             // The amt scrolled right
2637             var sl = this.DDM.getScrollLeft();
2638
2639             // Location of the bottom of the element
2640             var bot = h + y;
2641
2642             // Location of the right of the element
2643             var right = w + x;
2644
2645             // The distance from the cursor to the bottom of the visible area,
2646             // adjusted so that we don't scroll if the cursor is beyond the
2647             // element drag constraints
2648             var toBot = (clientH + st - y - this.deltaY);
2649
2650             // The distance from the cursor to the right of the visible area
2651             var toRight = (clientW + sl - x - this.deltaX);
2652
2653
2654             // How close to the edge the cursor must be before we scroll
2655             // var thresh = (document.all) ? 100 : 40;
2656             var thresh = 40;
2657
2658             // How many pixels to scroll per autoscroll op.  This helps to reduce
2659             // clunky scrolling. IE is more sensitive about this ... it needs this
2660             // value to be higher.
2661             var scrAmt = (document.all) ? 80 : 30;
2662
2663             // Scroll down if we are near the bottom of the visible page and the
2664             // obj extends below the crease
2665             if ( bot > clientH && toBot < thresh ) {
2666                 window.scrollTo(sl, st + scrAmt);
2667             }
2668
2669             // Scroll up if the window is scrolled down and the top of the object
2670             // goes above the top border
2671             if ( y < st && st > 0 && y - st < thresh ) {
2672                 window.scrollTo(sl, st - scrAmt);
2673             }
2674
2675             // Scroll right if the obj is beyond the right border and the cursor is
2676             // near the border.
2677             if ( right > clientW && toRight < thresh ) {
2678                 window.scrollTo(sl + scrAmt, st);
2679             }
2680
2681             // Scroll left if the window has been scrolled to the right and the obj
2682             // extends past the left border
2683             if ( x < sl && sl > 0 && x - sl < thresh ) {
2684                 window.scrollTo(sl - scrAmt, st);
2685             }
2686         }
2687     },
2688
2689     /**
2690      * Finds the location the element should be placed if we want to move
2691      * it to where the mouse location less the click offset would place us.
2692      * @method getTargetCoord
2693      * @param {int} iPageX the X coordinate of the click
2694      * @param {int} iPageY the Y coordinate of the click
2695      * @return an object that contains the coordinates (Object.x and Object.y)
2696      * @private
2697      */
2698     getTargetCoord: function(iPageX, iPageY) {
2699         var x = iPageX - this.deltaX;
2700         var y = iPageY - this.deltaY;
2701
2702         if (this.constrainX) {
2703             if (x < this.minX) { x = this.minX; }
2704             if (x > this.maxX) { x = this.maxX; }
2705         }
2706
2707         if (this.constrainY) {
2708             if (y < this.minY) { y = this.minY; }
2709             if (y > this.maxY) { y = this.maxY; }
2710         }
2711
2712         x = this.getTick(x, this.xTicks);
2713         y = this.getTick(y, this.yTicks);
2714
2715
2716         return {x:x, y:y};
2717     },
2718
2719     <div id="method-Ext.dd.DD-applyConfig"></div>/**
2720      * Sets up config options specific to this class. Overrides
2721      * Ext.dd.DragDrop, but all versions of this method through the
2722      * inheritance chain are called
2723      */
2724     applyConfig: function() {
2725         Ext.dd.DD.superclass.applyConfig.call(this);
2726         this.scroll = (this.config.scroll !== false);
2727     },
2728
2729     <div id="method-Ext.dd.DD-b4MouseDown"></div>/**
2730      * Event that fires prior to the onMouseDown event.  Overrides
2731      * Ext.dd.DragDrop.
2732      */
2733     b4MouseDown: function(e) {
2734         // this.resetConstraints();
2735         this.autoOffset(e.getPageX(),
2736                             e.getPageY());
2737     },
2738
2739     <div id="method-Ext.dd.DD-b4Drag"></div>/**
2740      * Event that fires prior to the onDrag event.  Overrides
2741      * Ext.dd.DragDrop.
2742      */
2743     b4Drag: function(e) {
2744         this.setDragElPos(e.getPageX(),
2745                             e.getPageY());
2746     },
2747
2748     toString: function() {
2749         return ("DD " + this.id);
2750     }
2751
2752     //////////////////////////////////////////////////////////////////////////
2753     // Debugging ygDragDrop events that can be overridden
2754     //////////////////////////////////////////////////////////////////////////
2755     /*
2756     startDrag: function(x, y) {
2757     },
2758
2759     onDrag: function(e) {
2760     },
2761
2762     onDragEnter: function(e, id) {
2763     },
2764
2765     onDragOver: function(e, id) {
2766     },
2767
2768     onDragOut: function(e, id) {
2769     },
2770
2771     onDragDrop: function(e, id) {
2772     },
2773
2774     endDrag: function(e) {
2775     }
2776
2777     */
2778
2779 });
2780 <div id="cls-Ext.dd.DDProxy"></div>/**
2781  * @class Ext.dd.DDProxy
2782  * A DragDrop implementation that inserts an empty, bordered div into
2783  * the document that follows the cursor during drag operations.  At the time of
2784  * the click, the frame div is resized to the dimensions of the linked html
2785  * element, and moved to the exact location of the linked element.
2786  *
2787  * References to the "frame" element refer to the single proxy element that
2788  * was created to be dragged in place of all DDProxy elements on the
2789  * page.
2790  *
2791  * @extends Ext.dd.DD
2792  * @constructor
2793  * @param {String} id the id of the linked html element
2794  * @param {String} sGroup the group of related DragDrop objects
2795  * @param {object} config an object containing configurable attributes
2796  *                Valid properties for DDProxy in addition to those in DragDrop:
2797  *                   resizeFrame, centerFrame, dragElId
2798  */
2799 Ext.dd.DDProxy = function(id, sGroup, config) {
2800     if (id) {
2801         this.init(id, sGroup, config);
2802         this.initFrame();
2803     }
2804 };
2805
2806 <div id="prop-Ext.dd.DDProxy-Ext.dd.DDProxy.dragElId"></div>/**
2807  * The default drag frame div id
2808  * @property Ext.dd.DDProxy.dragElId
2809  * @type String
2810  * @static
2811  */
2812 Ext.dd.DDProxy.dragElId = "ygddfdiv";
2813
2814 Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {
2815
2816     <div id="prop-Ext.dd.DDProxy-resizeFrame"></div>/**
2817      * By default we resize the drag frame to be the same size as the element
2818      * we want to drag (this is to get the frame effect).  We can turn it off
2819      * if we want a different behavior.
2820      * @property resizeFrame
2821      * @type boolean
2822      */
2823     resizeFrame: true,
2824
2825     <div id="prop-Ext.dd.DDProxy-centerFrame"></div>/**
2826      * By default the frame is positioned exactly where the drag element is, so
2827      * we use the cursor offset provided by Ext.dd.DD.  Another option that works only if
2828      * you do not have constraints on the obj is to have the drag frame centered
2829      * around the cursor.  Set centerFrame to true for this effect.
2830      * @property centerFrame
2831      * @type boolean
2832      */
2833     centerFrame: false,
2834
2835     <div id="method-Ext.dd.DDProxy-createFrame"></div>/**
2836      * Creates the proxy element if it does not yet exist
2837      * @method createFrame
2838      */
2839     createFrame: function() {
2840         var self = this;
2841         var body = document.body;
2842
2843         if (!body || !body.firstChild) {
2844             setTimeout( function() { self.createFrame(); }, 50 );
2845             return;
2846         }
2847
2848         var div = this.getDragEl();
2849
2850         if (!div) {
2851             div    = document.createElement("div");
2852             div.id = this.dragElId;
2853             var s  = div.style;
2854
2855             s.position   = "absolute";
2856             s.visibility = "hidden";
2857             s.cursor     = "move";
2858             s.border     = "2px solid #aaa";
2859             s.zIndex     = 999;
2860
2861             // appendChild can blow up IE if invoked prior to the window load event
2862             // while rendering a table.  It is possible there are other scenarios
2863             // that would cause this to happen as well.
2864             body.insertBefore(div, body.firstChild);
2865         }
2866     },
2867
2868     <div id="method-Ext.dd.DDProxy-initFrame"></div>/**
2869      * Initialization for the drag frame element.  Must be called in the
2870      * constructor of all subclasses
2871      * @method initFrame
2872      */
2873     initFrame: function() {
2874         this.createFrame();
2875     },
2876
2877     applyConfig: function() {
2878         Ext.dd.DDProxy.superclass.applyConfig.call(this);
2879
2880         this.resizeFrame = (this.config.resizeFrame !== false);
2881         this.centerFrame = (this.config.centerFrame);
2882         this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);
2883     },
2884
2885     /**
2886      * Resizes the drag frame to the dimensions of the clicked object, positions
2887      * it over the object, and finally displays it
2888      * @method showFrame
2889      * @param {int} iPageX X click position
2890      * @param {int} iPageY Y click position
2891      * @private
2892      */
2893     showFrame: function(iPageX, iPageY) {
2894         var el = this.getEl();
2895         var dragEl = this.getDragEl();
2896         var s = dragEl.style;
2897
2898         this._resizeProxy();
2899
2900         if (this.centerFrame) {
2901             this.setDelta( Math.round(parseInt(s.width,  10)/2),
2902                            Math.round(parseInt(s.height, 10)/2) );
2903         }
2904
2905         this.setDragElPos(iPageX, iPageY);
2906
2907         Ext.fly(dragEl).show();
2908     },
2909
2910     /**
2911      * The proxy is automatically resized to the dimensions of the linked
2912      * element when a drag is initiated, unless resizeFrame is set to false
2913      * @method _resizeProxy
2914      * @private
2915      */
2916     _resizeProxy: function() {
2917         if (this.resizeFrame) {
2918             var el = this.getEl();
2919             Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);
2920         }
2921     },
2922
2923     // overrides Ext.dd.DragDrop
2924     b4MouseDown: function(e) {
2925         var x = e.getPageX();
2926         var y = e.getPageY();
2927         this.autoOffset(x, y);
2928         this.setDragElPos(x, y);
2929     },
2930
2931     // overrides Ext.dd.DragDrop
2932     b4StartDrag: function(x, y) {
2933         // show the drag frame
2934         this.showFrame(x, y);
2935     },
2936
2937     // overrides Ext.dd.DragDrop
2938     b4EndDrag: function(e) {
2939         Ext.fly(this.getDragEl()).hide();
2940     },
2941
2942     // overrides Ext.dd.DragDrop
2943     // By default we try to move the element to the last location of the frame.
2944     // This is so that the default behavior mirrors that of Ext.dd.DD.
2945     endDrag: function(e) {
2946
2947         var lel = this.getEl();
2948         var del = this.getDragEl();
2949
2950         // Show the drag frame briefly so we can get its position
2951         del.style.visibility = "";
2952
2953         this.beforeMove();
2954         // Hide the linked element before the move to get around a Safari
2955         // rendering bug.
2956         lel.style.visibility = "hidden";
2957         Ext.dd.DDM.moveToEl(lel, del);
2958         del.style.visibility = "hidden";
2959         lel.style.visibility = "";
2960
2961         this.afterDrag();
2962     },
2963
2964     beforeMove : function(){
2965
2966     },
2967
2968     afterDrag : function(){
2969
2970     },
2971
2972     toString: function() {
2973         return ("DDProxy " + this.id);
2974     }
2975
2976 });
2977 <div id="cls-Ext.dd.DDTarget"></div>/**
2978  * @class Ext.dd.DDTarget
2979  * A DragDrop implementation that does not move, but can be a drop
2980  * target.  You would get the same result by simply omitting implementation
2981  * for the event callbacks, but this way we reduce the processing cost of the
2982  * event listener and the callbacks.
2983  * @extends Ext.dd.DragDrop
2984  * @constructor
2985  * @param {String} id the id of the element that is a drop target
2986  * @param {String} sGroup the group of related DragDrop objects
2987  * @param {object} config an object containing configurable attributes
2988  *                 Valid properties for DDTarget in addition to those in
2989  *                 DragDrop:
2990  *                    none
2991  */
2992 Ext.dd.DDTarget = function(id, sGroup, config) {
2993     if (id) {
2994         this.initTarget(id, sGroup, config);
2995     }
2996 };
2997
2998 // Ext.dd.DDTarget.prototype = new Ext.dd.DragDrop();
2999 Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {
3000     <div id="method-Ext.dd.DDTarget-getDragEl"></div>/**
3001      * @hide
3002      * Overridden and disabled. A DDTarget does not support being dragged.
3003      * @method
3004      */
3005     getDragEl: Ext.emptyFn,
3006     <div id="method-Ext.dd.DDTarget-isValidHandleChild"></div>/**
3007      * @hide
3008      * Overridden and disabled. A DDTarget does not support being dragged.
3009      * @method
3010      */
3011     isValidHandleChild: Ext.emptyFn,
3012     <div id="method-Ext.dd.DDTarget-startDrag"></div>/**
3013      * @hide
3014      * Overridden and disabled. A DDTarget does not support being dragged.
3015      * @method
3016      */
3017     startDrag: Ext.emptyFn,
3018     <div id="method-Ext.dd.DDTarget-endDrag"></div>/**
3019      * @hide
3020      * Overridden and disabled. A DDTarget does not support being dragged.
3021      * @method
3022      */
3023     endDrag: Ext.emptyFn,
3024     <div id="method-Ext.dd.DDTarget-onDrag"></div>/**
3025      * @hide
3026      * Overridden and disabled. A DDTarget does not support being dragged.
3027      * @method
3028      */
3029     onDrag: Ext.emptyFn,
3030     <div id="method-Ext.dd.DDTarget-onDragDrop"></div>/**
3031      * @hide
3032      * Overridden and disabled. A DDTarget does not support being dragged.
3033      * @method
3034      */
3035     onDragDrop: Ext.emptyFn,
3036     <div id="method-Ext.dd.DDTarget-onDragEnter"></div>/**
3037      * @hide
3038      * Overridden and disabled. A DDTarget does not support being dragged.
3039      * @method
3040      */
3041     onDragEnter: Ext.emptyFn,
3042     <div id="method-Ext.dd.DDTarget-onDragOut"></div>/**
3043      * @hide
3044      * Overridden and disabled. A DDTarget does not support being dragged.
3045      * @method
3046      */
3047     onDragOut: Ext.emptyFn,
3048     <div id="method-Ext.dd.DDTarget-onDragOver"></div>/**
3049      * @hide
3050      * Overridden and disabled. A DDTarget does not support being dragged.
3051      * @method
3052      */
3053     onDragOver: Ext.emptyFn,
3054     <div id="method-Ext.dd.DDTarget-onInvalidDrop"></div>/**
3055      * @hide
3056      * Overridden and disabled. A DDTarget does not support being dragged.
3057      * @method
3058      */
3059     onInvalidDrop: Ext.emptyFn,
3060     <div id="method-Ext.dd.DDTarget-onMouseDown"></div>/**
3061      * @hide
3062      * Overridden and disabled. A DDTarget does not support being dragged.
3063      * @method
3064      */
3065     onMouseDown: Ext.emptyFn,
3066     <div id="method-Ext.dd.DDTarget-onMouseUp"></div>/**
3067      * @hide
3068      * Overridden and disabled. A DDTarget does not support being dragged.
3069      * @method
3070      */
3071     onMouseUp: Ext.emptyFn,
3072     <div id="method-Ext.dd.DDTarget-setXConstraint"></div>/**
3073      * @hide
3074      * Overridden and disabled. A DDTarget does not support being dragged.
3075      * @method
3076      */
3077     setXConstraint: Ext.emptyFn,
3078     <div id="method-Ext.dd.DDTarget-setYConstraint"></div>/**
3079      * @hide
3080      * Overridden and disabled. A DDTarget does not support being dragged.
3081      * @method
3082      */
3083     setYConstraint: Ext.emptyFn,
3084     <div id="method-Ext.dd.DDTarget-resetConstraints"></div>/**
3085      * @hide
3086      * Overridden and disabled. A DDTarget does not support being dragged.
3087      * @method
3088      */
3089     resetConstraints: Ext.emptyFn,
3090     <div id="method-Ext.dd.DDTarget-clearConstraints"></div>/**
3091      * @hide
3092      * Overridden and disabled. A DDTarget does not support being dragged.
3093      * @method
3094      */
3095     clearConstraints: Ext.emptyFn,
3096     <div id="method-Ext.dd.DDTarget-clearTicks"></div>/**
3097      * @hide
3098      * Overridden and disabled. A DDTarget does not support being dragged.
3099      * @method
3100      */
3101     clearTicks: Ext.emptyFn,
3102     <div id="method-Ext.dd.DDTarget-setInitPosition"></div>/**
3103      * @hide
3104      * Overridden and disabled. A DDTarget does not support being dragged.
3105      * @method
3106      */
3107     setInitPosition: Ext.emptyFn,
3108     <div id="method-Ext.dd.DDTarget-setDragElId"></div>/**
3109      * @hide
3110      * Overridden and disabled. A DDTarget does not support being dragged.
3111      * @method
3112      */
3113     setDragElId: Ext.emptyFn,
3114     <div id="method-Ext.dd.DDTarget-setHandleElId"></div>/**
3115      * @hide
3116      * Overridden and disabled. A DDTarget does not support being dragged.
3117      * @method
3118      */
3119     setHandleElId: Ext.emptyFn,
3120     <div id="method-Ext.dd.DDTarget-setOuterHandleElId"></div>/**
3121      * @hide
3122      * Overridden and disabled. A DDTarget does not support being dragged.
3123      * @method
3124      */
3125     setOuterHandleElId: Ext.emptyFn,
3126     <div id="method-Ext.dd.DDTarget-addInvalidHandleClass"></div>/**
3127      * @hide
3128      * Overridden and disabled. A DDTarget does not support being dragged.
3129      * @method
3130      */
3131     addInvalidHandleClass: Ext.emptyFn,
3132     <div id="method-Ext.dd.DDTarget-addInvalidHandleId"></div>/**
3133      * @hide
3134      * Overridden and disabled. A DDTarget does not support being dragged.
3135      * @method
3136      */
3137     addInvalidHandleId: Ext.emptyFn,
3138     <div id="method-Ext.dd.DDTarget-addInvalidHandleType"></div>/**
3139      * @hide
3140      * Overridden and disabled. A DDTarget does not support being dragged.
3141      * @method
3142      */
3143     addInvalidHandleType: Ext.emptyFn,
3144     <div id="method-Ext.dd.DDTarget-removeInvalidHandleClass"></div>/**
3145      * @hide
3146      * Overridden and disabled. A DDTarget does not support being dragged.
3147      * @method
3148      */
3149     removeInvalidHandleClass: Ext.emptyFn,
3150     <div id="method-Ext.dd.DDTarget-removeInvalidHandleId"></div>/**
3151      * @hide
3152      * Overridden and disabled. A DDTarget does not support being dragged.
3153      * @method
3154      */
3155     removeInvalidHandleId: Ext.emptyFn,
3156     <div id="method-Ext.dd.DDTarget-removeInvalidHandleType"></div>/**
3157      * @hide
3158      * Overridden and disabled. A DDTarget does not support being dragged.
3159      * @method
3160      */
3161     removeInvalidHandleType: Ext.emptyFn,
3162
3163     toString: function() {
3164         return ("DDTarget " + this.id);
3165     }
3166 });</pre>    
3167 </body>
3168 </html>