Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / pkgs / window-debug.js
1 /*!
2  * Ext JS Library 3.1.1
3  * Copyright(c) 2006-2010 Ext JS, LLC
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 /**
8  * @class Ext.Window
9  * @extends Ext.Panel
10  * <p>A specialized panel intended for use as an application window.  Windows are floated, {@link #resizable}, and
11  * {@link #draggable} by default.  Windows can be {@link #maximizable maximized} to fill the viewport,
12  * restored to their prior size, and can be {@link #minimize}d.</p>
13  * <p>Windows can also be linked to a {@link Ext.WindowGroup} or managed by the {@link Ext.WindowMgr} to provide
14  * grouping, activation, to front, to back and other application-specific behavior.</p>
15  * <p>By default, Windows will be rendered to document.body. To {@link #constrain} a Window to another element
16  * specify {@link Ext.Component#renderTo renderTo}.</p>
17  * <p><b>Note:</b> By default, the <code>{@link #closable close}</code> header tool <i>destroys</i> the Window resulting in
18  * destruction of any child Components. This makes the Window object, and all its descendants <b>unusable</b>. To enable
19  * re-use of a Window, use <b><code>{@link #closeAction closeAction: 'hide'}</code></b>.</p>
20  * @constructor
21  * @param {Object} config The config object
22  * @xtype window
23  */
24 Ext.Window = Ext.extend(Ext.Panel, {
25     /**
26      * @cfg {Number} x
27      * The X position of the left edge of the window on initial showing. Defaults to centering the Window within
28      * the width of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
29      */
30     /**
31      * @cfg {Number} y
32      * The Y position of the top edge of the window on initial showing. Defaults to centering the Window within
33      * the height of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
34      */
35     /**
36      * @cfg {Boolean} modal
37      * True to make the window modal and mask everything behind it when displayed, false to display it without
38      * restricting access to other UI elements (defaults to false).
39      */
40     /**
41      * @cfg {String/Element} animateTarget
42      * Id or element from which the window should animate while opening (defaults to null with no animation).
43      */
44     /**
45      * @cfg {String} resizeHandles
46      * A valid {@link Ext.Resizable} handles config string (defaults to 'all').  Only applies when resizable = true.
47      */
48     /**
49      * @cfg {Ext.WindowGroup} manager
50      * A reference to the WindowGroup that should manage this window (defaults to {@link Ext.WindowMgr}).
51      */
52     /**
53     * @cfg {String/Number/Component} defaultButton
54     * <p>Specifies a Component to receive focus when this Window is focussed.</p>
55     * <p>This may be one of:</p><div class="mdetail-params"><ul>
56     * <li>The index of a footer Button.</li>
57     * <li>The id of a Component.</li>
58     * <li>A Component.</li>
59     * </ul></div>
60     */
61     /**
62     * @cfg {Function} onEsc
63     * Allows override of the built-in processing for the escape key. Default action
64     * is to close the Window (performing whatever action is specified in {@link #closeAction}.
65     * To prevent the Window closing when the escape key is pressed, specify this as
66     * Ext.emptyFn (See {@link Ext#emptyFn}).
67     */
68     /**
69      * @cfg {Boolean} collapsed
70      * True to render the window collapsed, false to render it expanded (defaults to false). Note that if
71      * {@link #expandOnShow} is true (the default) it will override the <tt>collapsed</tt> config and the window
72      * will always be expanded when shown.
73      */
74     /**
75      * @cfg {Boolean} maximized
76      * True to initially display the window in a maximized state. (Defaults to false).
77      */
78
79     /**
80     * @cfg {String} baseCls
81     * The base CSS class to apply to this panel's element (defaults to 'x-window').
82     */
83     baseCls : 'x-window',
84     /**
85      * @cfg {Boolean} resizable
86      * True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to true).
87      */
88     resizable : true,
89     /**
90      * @cfg {Boolean} draggable
91      * True to allow the window to be dragged by the header bar, false to disable dragging (defaults to true).  Note
92      * that by default the window will be centered in the viewport, so if dragging is disabled the window may need
93      * to be positioned programmatically after render (e.g., myWindow.setPosition(100, 100);).
94      */
95     draggable : true,
96     /**
97      * @cfg {Boolean} closable
98      * <p>True to display the 'close' tool button and allow the user to close the window, false to
99      * hide the button and disallow closing the window (defaults to true).</p>
100      * <p>By default, when close is requested by either clicking the close button in the header
101      * or pressing ESC when the Window has focus, the {@link #close} method will be called. This
102      * will <i>{@link Ext.Component#destroy destroy}</i> the Window and its content meaning that
103      * it may not be reused.</p>
104      * <p>To make closing a Window <i>hide</i> the Window so that it may be reused, set
105      * {@link #closeAction} to 'hide'.
106      */
107     closable : true,
108     /**
109      * @cfg {String} closeAction
110      * <p>The action to take when the close header tool is clicked:
111      * <div class="mdetail-params"><ul>
112      * <li><b><code>'{@link #close}'</code></b> : <b>Default</b><div class="sub-desc">
113      * {@link #close remove} the window from the DOM and {@link Ext.Component#destroy destroy}
114      * it and all descendant Components. The window will <b>not</b> be available to be
115      * redisplayed via the {@link #show} method.
116      * </div></li>
117      * <li><b><code>'{@link #hide}'</code></b> : <div class="sub-desc">
118      * {@link #hide} the window by setting visibility to hidden and applying negative offsets.
119      * The window will be available to be redisplayed via the {@link #show} method.
120      * </div></li>
121      * </ul></div>
122      * <p><b>Note:</b> This setting does not affect the {@link #close} method
123      * which will always {@link Ext.Component#destroy destroy} the window. To
124      * programatically <i>hide</i> a window, call {@link #hide}.</p>
125      */
126     closeAction : 'close',
127     /**
128      * @cfg {Boolean} constrain
129      * True to constrain the window within its containing element, false to allow it to fall outside of its
130      * containing element. By default the window will be rendered to document.body.  To render and constrain the
131      * window within another element specify {@link #renderTo}.
132      * (defaults to false).  Optionally the header only can be constrained using {@link #constrainHeader}.
133      */
134     constrain : false,
135     /**
136      * @cfg {Boolean} constrainHeader
137      * True to constrain the window header within its containing element (allowing the window body to fall outside
138      * of its containing element) or false to allow the header to fall outside its containing element (defaults to
139      * false). Optionally the entire window can be constrained using {@link #constrain}.
140      */
141     constrainHeader : false,
142     /**
143      * @cfg {Boolean} plain
144      * True to render the window body with a transparent background so that it will blend into the framing
145      * elements, false to add a lighter background color to visually highlight the body element and separate it
146      * more distinctly from the surrounding frame (defaults to false).
147      */
148     plain : false,
149     /**
150      * @cfg {Boolean} minimizable
151      * True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button
152      * and disallow minimizing the window (defaults to false).  Note that this button provides no implementation --
153      * the behavior of minimizing a window is implementation-specific, so the minimize event must be handled and a
154      * custom minimize behavior implemented for this option to be useful.
155      */
156     minimizable : false,
157     /**
158      * @cfg {Boolean} maximizable
159      * True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button
160      * and disallow maximizing the window (defaults to false).  Note that when a window is maximized, the tool button
161      * will automatically change to a 'restore' button with the appropriate behavior already built-in that will
162      * restore the window to its previous size.
163      */
164     maximizable : false,
165     /**
166      * @cfg {Number} minHeight
167      * The minimum height in pixels allowed for this window (defaults to 100).  Only applies when resizable = true.
168      */
169     minHeight : 100,
170     /**
171      * @cfg {Number} minWidth
172      * The minimum width in pixels allowed for this window (defaults to 200).  Only applies when resizable = true.
173      */
174     minWidth : 200,
175     /**
176      * @cfg {Boolean} expandOnShow
177      * True to always expand the window when it is displayed, false to keep it in its current state (which may be
178      * {@link #collapsed}) when displayed (defaults to true).
179      */
180     expandOnShow : true,
181
182     // inherited docs, same default
183     collapsible : false,
184
185     /**
186      * @cfg {Boolean} initHidden
187      * True to hide the window until show() is explicitly called (defaults to true).
188      * @deprecated
189      */
190     initHidden : undefined,
191
192     /**
193      * @cfg {Boolean} hidden
194      * Render this component hidden (default is <tt>true</tt>). If <tt>true</tt>, the
195      * {@link #hide} method will be called internally.
196      */
197     hidden : true,
198
199     // The following configs are set to provide the basic functionality of a window.
200     // Changing them would require additional code to handle correctly and should
201     // usually only be done in subclasses that can provide custom behavior.  Changing them
202     // may have unexpected or undesirable results.
203     /** @cfg {String} elements @hide */
204     elements : 'header,body',
205     /** @cfg {Boolean} frame @hide */
206     frame : true,
207     /** @cfg {Boolean} floating @hide */
208     floating : true,
209
210     // private
211     initComponent : function(){
212         this.initTools();
213         Ext.Window.superclass.initComponent.call(this);
214         this.addEvents(
215             /**
216              * @event activate
217              * Fires after the window has been visually activated via {@link #setActive}.
218              * @param {Ext.Window} this
219              */
220             /**
221              * @event deactivate
222              * Fires after the window has been visually deactivated via {@link #setActive}.
223              * @param {Ext.Window} this
224              */
225             /**
226              * @event resize
227              * Fires after the window has been resized.
228              * @param {Ext.Window} this
229              * @param {Number} width The window's new width
230              * @param {Number} height The window's new height
231              */
232             'resize',
233             /**
234              * @event maximize
235              * Fires after the window has been maximized.
236              * @param {Ext.Window} this
237              */
238             'maximize',
239             /**
240              * @event minimize
241              * Fires after the window has been minimized.
242              * @param {Ext.Window} this
243              */
244             'minimize',
245             /**
246              * @event restore
247              * Fires after the window has been restored to its original size after being maximized.
248              * @param {Ext.Window} this
249              */
250             'restore'
251         );
252         // for backwards compat, this should be removed at some point
253         if(Ext.isDefined(this.initHidden)){
254             this.hidden = this.initHidden;
255         }
256         if(this.hidden === false){
257             this.hidden = true;
258             this.show();
259         }
260     },
261
262     // private
263     getState : function(){
264         return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox(true));
265     },
266
267     // private
268     onRender : function(ct, position){
269         Ext.Window.superclass.onRender.call(this, ct, position);
270
271         if(this.plain){
272             this.el.addClass('x-window-plain');
273         }
274
275         // this element allows the Window to be focused for keyboard events
276         this.focusEl = this.el.createChild({
277                     tag: 'a', href:'#', cls:'x-dlg-focus',
278                     tabIndex:'-1', html: '&#160;'});
279         this.focusEl.swallowEvent('click', true);
280
281         this.proxy = this.el.createProxy('x-window-proxy');
282         this.proxy.enableDisplayMode('block');
283
284         if(this.modal){
285             this.mask = this.container.createChild({cls:'ext-el-mask'}, this.el.dom);
286             this.mask.enableDisplayMode('block');
287             this.mask.hide();
288             this.mon(this.mask, 'click', this.focus, this);
289         }
290         if(this.maximizable){
291             this.mon(this.header, 'dblclick', this.toggleMaximize, this);
292         }
293     },
294
295     // private
296     initEvents : function(){
297         Ext.Window.superclass.initEvents.call(this);
298         if(this.animateTarget){
299             this.setAnimateTarget(this.animateTarget);
300         }
301
302         if(this.resizable){
303             this.resizer = new Ext.Resizable(this.el, {
304                 minWidth: this.minWidth,
305                 minHeight:this.minHeight,
306                 handles: this.resizeHandles || 'all',
307                 pinned: true,
308                 resizeElement : this.resizerAction,
309                 handleCls: 'x-window-handle'
310             });
311             this.resizer.window = this;
312             this.mon(this.resizer, 'beforeresize', this.beforeResize, this);
313         }
314
315         if(this.draggable){
316             this.header.addClass('x-window-draggable');
317         }
318         this.mon(this.el, 'mousedown', this.toFront, this);
319         this.manager = this.manager || Ext.WindowMgr;
320         this.manager.register(this);
321         if(this.maximized){
322             this.maximized = false;
323             this.maximize();
324         }
325         if(this.closable){
326             var km = this.getKeyMap();
327             km.on(27, this.onEsc, this);
328             km.disable();
329         }
330     },
331
332     initDraggable : function(){
333         /**
334          * If this Window is configured {@link #draggable}, this property will contain
335          * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.
336          * @type Ext.dd.DD
337          * @property dd
338          */
339         this.dd = new Ext.Window.DD(this);
340     },
341
342    // private
343     onEsc : function(k, e){
344         e.stopEvent();
345         this[this.closeAction]();
346     },
347
348     // private
349     beforeDestroy : function(){
350         if (this.rendered){
351             this.hide();
352           if(this.doAnchor){
353                 Ext.EventManager.removeResizeListener(this.doAnchor, this);
354               Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
355             }
356             Ext.destroy(
357                 this.focusEl,
358                 this.resizer,
359                 this.dd,
360                 this.proxy,
361                 this.mask
362             );
363         }
364         Ext.Window.superclass.beforeDestroy.call(this);
365     },
366
367     // private
368     onDestroy : function(){
369         if(this.manager){
370             this.manager.unregister(this);
371         }
372         Ext.Window.superclass.onDestroy.call(this);
373     },
374
375     // private
376     initTools : function(){
377         if(this.minimizable){
378             this.addTool({
379                 id: 'minimize',
380                 handler: this.minimize.createDelegate(this, [])
381             });
382         }
383         if(this.maximizable){
384             this.addTool({
385                 id: 'maximize',
386                 handler: this.maximize.createDelegate(this, [])
387             });
388             this.addTool({
389                 id: 'restore',
390                 handler: this.restore.createDelegate(this, []),
391                 hidden:true
392             });
393         }
394         if(this.closable){
395             this.addTool({
396                 id: 'close',
397                 handler: this[this.closeAction].createDelegate(this, [])
398             });
399         }
400     },
401
402     // private
403     resizerAction : function(){
404         var box = this.proxy.getBox();
405         this.proxy.hide();
406         this.window.handleResize(box);
407         return box;
408     },
409
410     // private
411     beforeResize : function(){
412         this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); // 40 is a magic minimum content size?
413         this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);
414         this.resizeBox = this.el.getBox();
415     },
416
417     // private
418     updateHandles : function(){
419         if(Ext.isIE && this.resizer){
420             this.resizer.syncHandleHeight();
421             this.el.repaint();
422         }
423     },
424
425     // private
426     handleResize : function(box){
427         var rz = this.resizeBox;
428         if(rz.x != box.x || rz.y != box.y){
429             this.updateBox(box);
430         }else{
431             this.setSize(box);
432         }
433         this.focus();
434         this.updateHandles();
435         this.saveState();
436         this.doLayout();
437     },
438
439     /**
440      * Focuses the window.  If a defaultButton is set, it will receive focus, otherwise the
441      * window itself will receive focus.
442      */
443     focus : function(){
444         var f = this.focusEl, db = this.defaultButton, t = typeof db;
445         if(Ext.isDefined(db)){
446             if(Ext.isNumber(db) && this.fbar){
447                 f = this.fbar.items.get(db);
448             }else if(Ext.isString(db)){
449                 f = Ext.getCmp(db);
450             }else{
451                 f = db;
452             }
453         }
454         f = f || this.focusEl;
455         f.focus.defer(10, f);
456     },
457
458     /**
459      * Sets the target element from which the window should animate while opening.
460      * @param {String/Element} el The target element or id
461      */
462     setAnimateTarget : function(el){
463         el = Ext.get(el);
464         this.animateTarget = el;
465     },
466
467     // private
468     beforeShow : function(){
469         delete this.el.lastXY;
470         delete this.el.lastLT;
471         if(this.x === undefined || this.y === undefined){
472             var xy = this.el.getAlignToXY(this.container, 'c-c');
473             var pos = this.el.translatePoints(xy[0], xy[1]);
474             this.x = this.x === undefined? pos.left : this.x;
475             this.y = this.y === undefined? pos.top : this.y;
476         }
477         this.el.setLeftTop(this.x, this.y);
478
479         if(this.expandOnShow){
480             this.expand(false);
481         }
482
483         if(this.modal){
484             Ext.getBody().addClass('x-body-masked');
485             this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
486             this.mask.show();
487         }
488     },
489
490     /**
491      * Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.
492      * @param {String/Element} animateTarget (optional) The target element or id from which the window should
493      * animate while opening (defaults to null with no animation)
494      * @param {Function} callback (optional) A callback function to call after the window is displayed
495      * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to this Window.
496      * @return {Ext.Window} this
497      */
498     show : function(animateTarget, cb, scope){
499         if(!this.rendered){
500             this.render(Ext.getBody());
501         }
502         if(this.hidden === false){
503             this.toFront();
504             return this;
505         }
506         if(this.fireEvent('beforeshow', this) === false){
507             return this;
508         }
509         if(cb){
510             this.on('show', cb, scope, {single:true});
511         }
512         this.hidden = false;
513         if(Ext.isDefined(animateTarget)){
514             this.setAnimateTarget(animateTarget);
515         }
516         this.beforeShow();
517         if(this.animateTarget){
518             this.animShow();
519         }else{
520             this.afterShow();
521         }
522         return this;
523     },
524
525     // private
526     afterShow : function(isAnim){
527         if (this.isDestroyed){
528             return false;
529         }
530         this.proxy.hide();
531         this.el.setStyle('display', 'block');
532         this.el.show();
533         if(this.maximized){
534             this.fitContainer();
535         }
536         if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
537             this.cascade(this.setAutoScroll);
538         }
539
540         if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
541             Ext.EventManager.onWindowResize(this.onWindowResize, this);
542         }
543         this.doConstrain();
544         this.doLayout();
545         if(this.keyMap){
546             this.keyMap.enable();
547         }
548         this.toFront();
549         this.updateHandles();
550         if(isAnim && (Ext.isIE || Ext.isWebKit)){
551             var sz = this.getSize();
552             this.onResize(sz.width, sz.height);
553         }
554         this.onShow();
555         this.fireEvent('show', this);
556     },
557
558     // private
559     animShow : function(){
560         this.proxy.show();
561         this.proxy.setBox(this.animateTarget.getBox());
562         this.proxy.setOpacity(0);
563         var b = this.getBox();
564         this.el.setStyle('display', 'none');
565         this.proxy.shift(Ext.apply(b, {
566             callback: this.afterShow.createDelegate(this, [true], false),
567             scope: this,
568             easing: 'easeNone',
569             duration: 0.25,
570             opacity: 0.5
571         }));
572     },
573
574     /**
575      * Hides the window, setting it to invisible and applying negative offsets.
576      * @param {String/Element} animateTarget (optional) The target element or id to which the window should
577      * animate while hiding (defaults to null with no animation)
578      * @param {Function} callback (optional) A callback function to call after the window is hidden
579      * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to this Window.
580      * @return {Ext.Window} this
581      */
582     hide : function(animateTarget, cb, scope){
583         if(this.hidden || this.fireEvent('beforehide', this) === false){
584             return this;
585         }
586         if(cb){
587             this.on('hide', cb, scope, {single:true});
588         }
589         this.hidden = true;
590         if(animateTarget !== undefined){
591             this.setAnimateTarget(animateTarget);
592         }
593         if(this.modal){
594             this.mask.hide();
595             Ext.getBody().removeClass('x-body-masked');
596         }
597         if(this.animateTarget){
598             this.animHide();
599         }else{
600             this.el.hide();
601             this.afterHide();
602         }
603         return this;
604     },
605
606     // private
607     afterHide : function(){
608         this.proxy.hide();
609         if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
610             Ext.EventManager.removeResizeListener(this.onWindowResize, this);
611         }
612         if(this.keyMap){
613             this.keyMap.disable();
614         }
615         this.onHide();
616         this.fireEvent('hide', this);
617     },
618
619     // private
620     animHide : function(){
621         this.proxy.setOpacity(0.5);
622         this.proxy.show();
623         var tb = this.getBox(false);
624         this.proxy.setBox(tb);
625         this.el.hide();
626         this.proxy.shift(Ext.apply(this.animateTarget.getBox(), {
627             callback: this.afterHide,
628             scope: this,
629             duration: 0.25,
630             easing: 'easeNone',
631             opacity: 0
632         }));
633     },
634
635     /**
636      * Method that is called immediately before the <code>show</code> event is fired.
637      * Defaults to <code>Ext.emptyFn</code>.
638      */
639     onShow : Ext.emptyFn,
640
641     /**
642      * Method that is called immediately before the <code>hide</code> event is fired.
643      * Defaults to <code>Ext.emptyFn</code>.
644      */
645     onHide : Ext.emptyFn,
646
647     // private
648     onWindowResize : function(){
649         if(this.maximized){
650             this.fitContainer();
651         }
652         if(this.modal){
653             this.mask.setSize('100%', '100%');
654             var force = this.mask.dom.offsetHeight;
655             this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
656         }
657         this.doConstrain();
658     },
659
660     // private
661     doConstrain : function(){
662         if(this.constrain || this.constrainHeader){
663             var offsets;
664             if(this.constrain){
665                 offsets = {
666                     right:this.el.shadowOffset,
667                     left:this.el.shadowOffset,
668                     bottom:this.el.shadowOffset
669                 };
670             }else {
671                 var s = this.getSize();
672                 offsets = {
673                     right:-(s.width - 100),
674                     bottom:-(s.height - 25)
675                 };
676             }
677
678             var xy = this.el.getConstrainToXY(this.container, true, offsets);
679             if(xy){
680                 this.setPosition(xy[0], xy[1]);
681             }
682         }
683     },
684
685     // private - used for dragging
686     ghost : function(cls){
687         var ghost = this.createGhost(cls);
688         var box = this.getBox(true);
689         ghost.setLeftTop(box.x, box.y);
690         ghost.setWidth(box.width);
691         this.el.hide();
692         this.activeGhost = ghost;
693         return ghost;
694     },
695
696     // private
697     unghost : function(show, matchPosition){
698         if(!this.activeGhost) {
699             return;
700         }
701         if(show !== false){
702             this.el.show();
703             this.focus();
704             if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug
705                 this.cascade(this.setAutoScroll);
706             }
707         }
708         if(matchPosition !== false){
709             this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));
710         }
711         this.activeGhost.hide();
712         this.activeGhost.remove();
713         delete this.activeGhost;
714     },
715
716     /**
717      * Placeholder method for minimizing the window.  By default, this method simply fires the {@link #minimize} event
718      * since the behavior of minimizing a window is application-specific.  To implement custom minimize behavior,
719      * either the minimize event can be handled or this method can be overridden.
720      * @return {Ext.Window} this
721      */
722     minimize : function(){
723         this.fireEvent('minimize', this);
724         return this;
725     },
726
727     /**
728      * <p>Closes the Window, removes it from the DOM, {@link Ext.Component#destroy destroy}s
729      * the Window object and all its descendant Components. The {@link Ext.Panel#beforeclose beforeclose}
730      * event is fired before the close happens and will cancel the close action if it returns false.<p>
731      * <p><b>Note:</b> This method is not affected by the {@link #closeAction} setting which
732      * only affects the action triggered when clicking the {@link #closable 'close' tool in the header}.
733      * To hide the Window without destroying it, call {@link #hide}.</p>
734      */
735     close : function(){
736         if(this.fireEvent('beforeclose', this) !== false){
737             if(this.hidden){
738                 this.doClose();
739             }else{
740                 this.hide(null, this.doClose, this);
741             }
742         }
743     },
744
745     // private
746     doClose : function(){
747         this.fireEvent('close', this);
748         this.destroy();
749     },
750
751     /**
752      * Fits the window within its current container and automatically replaces
753      * the {@link #maximizable 'maximize' tool button} with the 'restore' tool button.
754      * Also see {@link #toggleMaximize}.
755      * @return {Ext.Window} this
756      */
757     maximize : function(){
758         if(!this.maximized){
759             this.expand(false);
760             this.restoreSize = this.getSize();
761             this.restorePos = this.getPosition(true);
762             if (this.maximizable){
763                 this.tools.maximize.hide();
764                 this.tools.restore.show();
765             }
766             this.maximized = true;
767             this.el.disableShadow();
768
769             if(this.dd){
770                 this.dd.lock();
771             }
772             if(this.collapsible){
773                 this.tools.toggle.hide();
774             }
775             this.el.addClass('x-window-maximized');
776             this.container.addClass('x-window-maximized-ct');
777
778             this.setPosition(0, 0);
779             this.fitContainer();
780             this.fireEvent('maximize', this);
781         }
782         return this;
783     },
784
785     /**
786      * Restores a {@link #maximizable maximized}  window back to its original
787      * size and position prior to being maximized and also replaces
788      * the 'restore' tool button with the 'maximize' tool button.
789      * Also see {@link #toggleMaximize}.
790      * @return {Ext.Window} this
791      */
792     restore : function(){
793         if(this.maximized){
794             var t = this.tools;
795             this.el.removeClass('x-window-maximized');
796             if(t.restore){
797                 t.restore.hide();
798             }
799             if(t.maximize){
800                 t.maximize.show();
801             }
802             this.setPosition(this.restorePos[0], this.restorePos[1]);
803             this.setSize(this.restoreSize.width, this.restoreSize.height);
804             delete this.restorePos;
805             delete this.restoreSize;
806             this.maximized = false;
807             this.el.enableShadow(true);
808
809             if(this.dd){
810                 this.dd.unlock();
811             }
812             if(this.collapsible && t.toggle){
813                 t.toggle.show();
814             }
815             this.container.removeClass('x-window-maximized-ct');
816
817             this.doConstrain();
818             this.fireEvent('restore', this);
819         }
820         return this;
821     },
822
823     /**
824      * A shortcut method for toggling between {@link #maximize} and {@link #restore} based on the current maximized
825      * state of the window.
826      * @return {Ext.Window} this
827      */
828     toggleMaximize : function(){
829         return this[this.maximized ? 'restore' : 'maximize']();
830     },
831
832     // private
833     fitContainer : function(){
834         var vs = this.container.getViewSize(false);
835         this.setSize(vs.width, vs.height);
836     },
837
838     // private
839     // z-index is managed by the WindowManager and may be overwritten at any time
840     setZIndex : function(index){
841         if(this.modal){
842             this.mask.setStyle('z-index', index);
843         }
844         this.el.setZIndex(++index);
845         index += 5;
846
847         if(this.resizer){
848             this.resizer.proxy.setStyle('z-index', ++index);
849         }
850
851         this.lastZIndex = index;
852     },
853
854     /**
855      * Aligns the window to the specified element
856      * @param {Mixed} element The element to align to.
857      * @param {String} position (optional, defaults to "tl-bl?") The position to align to (see {@link Ext.Element#alignTo} for more details).
858      * @param {Array} offsets (optional) Offset the positioning by [x, y]
859      * @return {Ext.Window} this
860      */
861     alignTo : function(element, position, offsets){
862         var xy = this.el.getAlignToXY(element, position, offsets);
863         this.setPagePosition(xy[0], xy[1]);
864         return this;
865     },
866
867     /**
868      * Anchors this window to another element and realigns it when the window is resized or scrolled.
869      * @param {Mixed} element The element to align to.
870      * @param {String} position The position to align to (see {@link Ext.Element#alignTo} for more details)
871      * @param {Array} offsets (optional) Offset the positioning by [x, y]
872      * @param {Boolean/Number} monitorScroll (optional) true to monitor body scroll and reposition. If this parameter
873      * is a number, it is used as the buffer delay (defaults to 50ms).
874      * @return {Ext.Window} this
875      */
876     anchorTo : function(el, alignment, offsets, monitorScroll){
877       if(this.doAnchor){
878           Ext.EventManager.removeResizeListener(this.doAnchor, this);
879           Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
880       }
881       this.doAnchor = function(){
882           this.alignTo(el, alignment, offsets);
883       };
884       Ext.EventManager.onWindowResize(this.doAnchor, this);
885
886       var tm = typeof monitorScroll;
887       if(tm != 'undefined'){
888           Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
889               {buffer: tm == 'number' ? monitorScroll : 50});
890       }
891       return this;
892     },
893
894     /**
895      * Brings this window to the front of any other visible windows
896      * @param {Boolean} e (optional) Specify <tt>false</tt> to prevent the window from being focused.
897      * @return {Ext.Window} this
898      */
899     toFront : function(e){
900         if(this.manager.bringToFront(this)){
901             if(!e || !e.getTarget().focus){
902                 this.focus();
903             }
904         }
905         return this;
906     },
907
908     /**
909      * Makes this the active window by showing its shadow, or deactivates it by hiding its shadow.  This method also
910      * fires the {@link #activate} or {@link #deactivate} event depending on which action occurred. This method is
911      * called internally by {@link Ext.WindowMgr}.
912      * @param {Boolean} active True to activate the window, false to deactivate it (defaults to false)
913      */
914     setActive : function(active){
915         if(active){
916             if(!this.maximized){
917                 this.el.enableShadow(true);
918             }
919             this.fireEvent('activate', this);
920         }else{
921             this.el.disableShadow();
922             this.fireEvent('deactivate', this);
923         }
924     },
925
926     /**
927      * Sends this window to the back of (lower z-index than) any other visible windows
928      * @return {Ext.Window} this
929      */
930     toBack : function(){
931         this.manager.sendToBack(this);
932         return this;
933     },
934
935     /**
936      * Centers this window in the viewport
937      * @return {Ext.Window} this
938      */
939     center : function(){
940         var xy = this.el.getAlignToXY(this.container, 'c-c');
941         this.setPagePosition(xy[0], xy[1]);
942         return this;
943     }
944
945     /**
946      * @cfg {Boolean} autoWidth @hide
947      **/
948 });
949 Ext.reg('window', Ext.Window);
950
951 // private - custom Window DD implementation
952 Ext.Window.DD = function(win){
953     this.win = win;
954     Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
955     this.setHandleElId(win.header.id);
956     this.scroll = false;
957 };
958
959 Ext.extend(Ext.Window.DD, Ext.dd.DD, {
960     moveOnly:true,
961     headerOffsets:[100, 25],
962     startDrag : function(){
963         var w = this.win;
964         this.proxy = w.ghost();
965         if(w.constrain !== false){
966             var so = w.el.shadowOffset;
967             this.constrainTo(w.container, {right: so, left: so, bottom: so});
968         }else if(w.constrainHeader !== false){
969             var s = this.proxy.getSize();
970             this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});
971         }
972     },
973     b4Drag : Ext.emptyFn,
974
975     onDrag : function(e){
976         this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());
977     },
978
979     endDrag : function(e){
980         this.win.unghost();
981         this.win.saveState();
982     }
983 });
984 /**
985  * @class Ext.WindowGroup
986  * An object that manages a group of {@link Ext.Window} instances and provides z-order management
987  * and window activation behavior.
988  * @constructor
989  */
990 Ext.WindowGroup = function(){
991     var list = {};
992     var accessList = [];
993     var front = null;
994
995     // private
996     var sortWindows = function(d1, d2){
997         return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
998     };
999
1000     // private
1001     var orderWindows = function(){
1002         var a = accessList, len = a.length;
1003         if(len > 0){
1004             a.sort(sortWindows);
1005             var seed = a[0].manager.zseed;
1006             for(var i = 0; i < len; i++){
1007                 var win = a[i];
1008                 if(win && !win.hidden){
1009                     win.setZIndex(seed + (i*10));
1010                 }
1011             }
1012         }
1013         activateLast();
1014     };
1015
1016     // private
1017     var setActiveWin = function(win){
1018         if(win != front){
1019             if(front){
1020                 front.setActive(false);
1021             }
1022             front = win;
1023             if(win){
1024                 win.setActive(true);
1025             }
1026         }
1027     };
1028
1029     // private
1030     var activateLast = function(){
1031         for(var i = accessList.length-1; i >=0; --i) {
1032             if(!accessList[i].hidden){
1033                 setActiveWin(accessList[i]);
1034                 return;
1035             }
1036         }
1037         // none to activate
1038         setActiveWin(null);
1039     };
1040
1041     return {
1042         /**
1043          * The starting z-index for windows in this WindowGroup (defaults to 9000)
1044          * @type Number The z-index value
1045          */
1046         zseed : 9000,
1047
1048         /**
1049          * <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
1050          * need to be called under normal circumstances. Windows are automatically registered
1051          * with a {@link Ext.Window#manager manager} at construction time.</p>
1052          * <p>Where this may be useful is moving Windows between two WindowManagers. For example,
1053          * to bring the Ext.MessageBox dialog under the same manager as the Desktop's
1054          * WindowManager in the desktop sample app:</p><code><pre>
1055 var msgWin = Ext.MessageBox.getDialog();
1056 MyDesktop.getDesktop().getManager().register(msgWin);
1057 </pre></code>
1058          * @param {Window} win The Window to register.
1059          */
1060         register : function(win){
1061             if(win.manager){
1062                 win.manager.unregister(win);
1063             }
1064             win.manager = this;
1065
1066             list[win.id] = win;
1067             accessList.push(win);
1068             win.on('hide', activateLast);
1069         },
1070
1071         /**
1072          * <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
1073          * need to be called. Windows are automatically unregistered upon destruction.
1074          * See {@link #register}.</p>
1075          * @param {Window} win The Window to unregister.
1076          */
1077         unregister : function(win){
1078             delete win.manager;
1079             delete list[win.id];
1080             win.un('hide', activateLast);
1081             accessList.remove(win);
1082         },
1083
1084         /**
1085          * Gets a registered window by id.
1086          * @param {String/Object} id The id of the window or a {@link Ext.Window} instance
1087          * @return {Ext.Window}
1088          */
1089         get : function(id){
1090             return typeof id == "object" ? id : list[id];
1091         },
1092
1093         /**
1094          * Brings the specified window to the front of any other active windows in this WindowGroup.
1095          * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
1096          * @return {Boolean} True if the dialog was brought to the front, else false
1097          * if it was already in front
1098          */
1099         bringToFront : function(win){
1100             win = this.get(win);
1101             if(win != front){
1102                 win._lastAccess = new Date().getTime();
1103                 orderWindows();
1104                 return true;
1105             }
1106             return false;
1107         },
1108
1109         /**
1110          * Sends the specified window to the back of other active windows in this WindowGroup.
1111          * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
1112          * @return {Ext.Window} The window
1113          */
1114         sendToBack : function(win){
1115             win = this.get(win);
1116             win._lastAccess = -(new Date().getTime());
1117             orderWindows();
1118             return win;
1119         },
1120
1121         /**
1122          * Hides all windows in this WindowGroup.
1123          */
1124         hideAll : function(){
1125             for(var id in list){
1126                 if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
1127                     list[id].hide();
1128                 }
1129             }
1130         },
1131
1132         /**
1133          * Gets the currently-active window in this WindowGroup.
1134          * @return {Ext.Window} The active window
1135          */
1136         getActive : function(){
1137             return front;
1138         },
1139
1140         /**
1141          * Returns zero or more windows in this WindowGroup using the custom search function passed to this method.
1142          * The function should accept a single {@link Ext.Window} reference as its only argument and should
1143          * return true if the window matches the search criteria, otherwise it should return false.
1144          * @param {Function} fn The search function
1145          * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Window being tested.
1146          * that gets passed to the function if not specified)
1147          * @return {Array} An array of zero or more matching windows
1148          */
1149         getBy : function(fn, scope){
1150             var r = [];
1151             for(var i = accessList.length-1; i >=0; --i) {
1152                 var win = accessList[i];
1153                 if(fn.call(scope||win, win) !== false){
1154                     r.push(win);
1155                 }
1156             }
1157             return r;
1158         },
1159
1160         /**
1161          * Executes the specified function once for every window in this WindowGroup, passing each
1162          * window as the only parameter. Returning false from the function will stop the iteration.
1163          * @param {Function} fn The function to execute for each item
1164          * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Window in the iteration.
1165          */
1166         each : function(fn, scope){
1167             for(var id in list){
1168                 if(list[id] && typeof list[id] != "function"){
1169                     if(fn.call(scope || list[id], list[id]) === false){
1170                         return;
1171                     }
1172                 }
1173             }
1174         }
1175     };
1176 };
1177
1178
1179 /**
1180  * @class Ext.WindowMgr
1181  * @extends Ext.WindowGroup
1182  * The default global window group that is available automatically.  To have more than one group of windows
1183  * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
1184  * @singleton
1185  */
1186 Ext.WindowMgr = new Ext.WindowGroup();/**\r
1187  * @class Ext.MessageBox\r
1188  * <p>Utility class for generating different styles of message boxes.  The alias Ext.Msg can also be used.<p/>\r
1189  * <p>Note that the MessageBox is asynchronous.  Unlike a regular JavaScript <code>alert</code> (which will halt\r
1190  * browser execution), showing a MessageBox will not cause the code to stop.  For this reason, if you have code\r
1191  * that should only run <em>after</em> some user feedback from the MessageBox, you must use a callback function\r
1192  * (see the <code>function</code> parameter for {@link #show} for more details).</p>\r
1193  * <p>Example usage:</p>\r
1194  *<pre><code>\r
1195 // Basic alert:\r
1196 Ext.Msg.alert('Status', 'Changes saved successfully.');\r
1197 \r
1198 // Prompt for user data and process the result using a callback:\r
1199 Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){\r
1200     if (btn == 'ok'){\r
1201         // process text value and close...\r
1202     }\r
1203 });\r
1204 \r
1205 // Show a dialog using config options:\r
1206 Ext.Msg.show({\r
1207    title:'Save Changes?',\r
1208    msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',\r
1209    buttons: Ext.Msg.YESNOCANCEL,\r
1210    fn: processResult,\r
1211    animEl: 'elId',\r
1212    icon: Ext.MessageBox.QUESTION\r
1213 });\r
1214 </code></pre>\r
1215  * @singleton\r
1216  */\r
1217 Ext.MessageBox = function(){\r
1218     var dlg, opt, mask, waitTimer,\r
1219         bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl,\r
1220         buttons, activeTextEl, bwidth, bufferIcon = '', iconCls = '',\r
1221         buttonNames = ['ok', 'yes', 'no', 'cancel'];\r
1222 \r
1223     // private\r
1224     var handleButton = function(button){\r
1225         buttons[button].blur();\r
1226         if(dlg.isVisible()){\r
1227             dlg.hide();\r
1228             handleHide();\r
1229             Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1);\r
1230         }\r
1231     };\r
1232 \r
1233     // private\r
1234     var handleHide = function(){\r
1235         if(opt && opt.cls){\r
1236             dlg.el.removeClass(opt.cls);\r
1237         }\r
1238         progressBar.reset();        \r
1239     };\r
1240 \r
1241     // private\r
1242     var handleEsc = function(d, k, e){\r
1243         if(opt && opt.closable !== false){\r
1244             dlg.hide();\r
1245             handleHide();\r
1246         }\r
1247         if(e){\r
1248             e.stopEvent();\r
1249         }\r
1250     };\r
1251 \r
1252     // private\r
1253     var updateButtons = function(b){\r
1254         var width = 0,\r
1255             cfg;\r
1256         if(!b){\r
1257             Ext.each(buttonNames, function(name){\r
1258                 buttons[name].hide();\r
1259             });\r
1260             return width;\r
1261         }\r
1262         dlg.footer.dom.style.display = '';\r
1263         Ext.iterate(buttons, function(name, btn){\r
1264             cfg = b[name];\r
1265             if(cfg){\r
1266                 btn.show();\r
1267                 btn.setText(Ext.isString(cfg) ? cfg : Ext.MessageBox.buttonText[name]);\r
1268                 width += btn.getEl().getWidth() + 15;\r
1269             }else{\r
1270                 btn.hide();\r
1271             }\r
1272         });\r
1273         return width;\r
1274     };\r
1275 \r
1276     return {\r
1277         /**\r
1278          * Returns a reference to the underlying {@link Ext.Window} element\r
1279          * @return {Ext.Window} The window\r
1280          */\r
1281         getDialog : function(titleText){\r
1282            if(!dlg){\r
1283                 var btns = [];\r
1284                 \r
1285                 buttons = {};\r
1286                 Ext.each(buttonNames, function(name){\r
1287                     btns.push(buttons[name] = new Ext.Button({\r
1288                         text: this.buttonText[name],\r
1289                         handler: handleButton.createCallback(name),\r
1290                         hideMode: 'offsets'\r
1291                     }));\r
1292                 }, this);\r
1293                 dlg = new Ext.Window({\r
1294                     autoCreate : true,\r
1295                     title:titleText,\r
1296                     resizable:false,\r
1297                     constrain:true,\r
1298                     constrainHeader:true,\r
1299                     minimizable : false,\r
1300                     maximizable : false,\r
1301                     stateful: false,\r
1302                     modal: true,\r
1303                     shim:true,\r
1304                     buttonAlign:"center",\r
1305                     width:400,\r
1306                     height:100,\r
1307                     minHeight: 80,\r
1308                     plain:true,\r
1309                     footer:true,\r
1310                     closable:true,\r
1311                     close : function(){\r
1312                         if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){\r
1313                             handleButton("no");\r
1314                         }else{\r
1315                             handleButton("cancel");\r
1316                         }\r
1317                     },\r
1318                     fbar: new Ext.Toolbar({\r
1319                         items: btns,\r
1320                         enableOverflow: false\r
1321                     })\r
1322                 });\r
1323                 dlg.render(document.body);\r
1324                 dlg.getEl().addClass('x-window-dlg');\r
1325                 mask = dlg.mask;\r
1326                 bodyEl = dlg.body.createChild({\r
1327                     html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'\r
1328                 });\r
1329                 iconEl = Ext.get(bodyEl.dom.firstChild);\r
1330                 var contentEl = bodyEl.dom.childNodes[1];\r
1331                 msgEl = Ext.get(contentEl.firstChild);\r
1332                 textboxEl = Ext.get(contentEl.childNodes[2].firstChild);\r
1333                 textboxEl.enableDisplayMode();\r
1334                 textboxEl.addKeyListener([10,13], function(){\r
1335                     if(dlg.isVisible() && opt && opt.buttons){\r
1336                         if(opt.buttons.ok){\r
1337                             handleButton("ok");\r
1338                         }else if(opt.buttons.yes){\r
1339                             handleButton("yes");\r
1340                         }\r
1341                     }\r
1342                 });\r
1343                 textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);\r
1344                 textareaEl.enableDisplayMode();\r
1345                 progressBar = new Ext.ProgressBar({\r
1346                     renderTo:bodyEl\r
1347                 });\r
1348                bodyEl.createChild({cls:'x-clear'});\r
1349             }\r
1350             return dlg;\r
1351         },\r
1352 \r
1353         /**\r
1354          * Updates the message box body text\r
1355          * @param {String} text (optional) Replaces the message box element's innerHTML with the specified string (defaults to\r
1356          * the XHTML-compliant non-breaking space character '&amp;#160;')\r
1357          * @return {Ext.MessageBox} this\r
1358          */\r
1359         updateText : function(text){\r
1360             if(!dlg.isVisible() && !opt.width){\r
1361                 dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows\r
1362             }\r
1363             msgEl.update(text || '&#160;');\r
1364 \r
1365             var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0,\r
1366                 mw = msgEl.getWidth() + msgEl.getMargins('lr'),\r
1367                 fw = dlg.getFrameWidth('lr'),\r
1368                 bw = dlg.body.getFrameWidth('lr'),\r
1369                 w;\r
1370                 \r
1371             if (Ext.isIE && iw > 0){\r
1372                 //3 pixels get subtracted in the icon CSS for an IE margin issue,\r
1373                 //so we have to add it back here for the overall width to be consistent\r
1374                 iw += 3;\r
1375             }\r
1376             w = Math.max(Math.min(opt.width || iw+mw+fw+bw, opt.maxWidth || this.maxWidth),\r
1377                     Math.max(opt.minWidth || this.minWidth, bwidth || 0));\r
1378 \r
1379             if(opt.prompt === true){\r
1380                 activeTextEl.setWidth(w-iw-fw-bw);\r
1381             }\r
1382             if(opt.progress === true || opt.wait === true){\r
1383                 progressBar.setSize(w-iw-fw-bw);\r
1384             }\r
1385             if(Ext.isIE && w == bwidth){\r
1386                 w += 4; //Add offset when the content width is smaller than the buttons.    \r
1387             }\r
1388             dlg.setSize(w, 'auto').center();\r
1389             return this;\r
1390         },\r
1391 \r
1392         /**\r
1393          * Updates a progress-style message box's text and progress bar. Only relevant on message boxes\r
1394          * initiated via {@link Ext.MessageBox#progress} or {@link Ext.MessageBox#wait},\r
1395          * or by calling {@link Ext.MessageBox#show} with progress: true.\r
1396          * @param {Number} value Any number between 0 and 1 (e.g., .5, defaults to 0)\r
1397          * @param {String} progressText The progress text to display inside the progress bar (defaults to '')\r
1398          * @param {String} msg The message box's body text is replaced with the specified string (defaults to undefined\r
1399          * so that any existing body text will not get overwritten by default unless a new value is passed in)\r
1400          * @return {Ext.MessageBox} this\r
1401          */\r
1402         updateProgress : function(value, progressText, msg){\r
1403             progressBar.updateProgress(value, progressText);\r
1404             if(msg){\r
1405                 this.updateText(msg);\r
1406             }\r
1407             return this;\r
1408         },\r
1409 \r
1410         /**\r
1411          * Returns true if the message box is currently displayed\r
1412          * @return {Boolean} True if the message box is visible, else false\r
1413          */\r
1414         isVisible : function(){\r
1415             return dlg && dlg.isVisible();\r
1416         },\r
1417 \r
1418         /**\r
1419          * Hides the message box if it is displayed\r
1420          * @return {Ext.MessageBox} this\r
1421          */\r
1422         hide : function(){\r
1423             var proxy = dlg ? dlg.activeGhost : null;\r
1424             if(this.isVisible() || proxy){\r
1425                 dlg.hide();\r
1426                 handleHide();\r
1427                 if (proxy){\r
1428                     // unghost is a private function, but i saw no better solution\r
1429                     // to fix the locking problem when dragging while it closes\r
1430                     dlg.unghost(false, false);\r
1431                 } \r
1432             }\r
1433             return this;\r
1434         },\r
1435 \r
1436         /**\r
1437          * Displays a new message box, or reinitializes an existing message box, based on the config options\r
1438          * passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,\r
1439          * although those calls are basic shortcuts and do not support all of the config options allowed here.\r
1440          * @param {Object} config The following config options are supported: <ul>\r
1441          * <li><b>animEl</b> : String/Element<div class="sub-desc">An id or Element from which the message box should animate as it\r
1442          * opens and closes (defaults to undefined)</div></li>\r
1443          * <li><b>buttons</b> : Object/Boolean<div class="sub-desc">A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',\r
1444          * cancel:'Bar'}), or false to not show any buttons (defaults to false)</div></li>\r
1445          * <li><b>closable</b> : Boolean<div class="sub-desc">False to hide the top-right close button (defaults to true). Note that\r
1446          * progress and wait dialogs will ignore this property and always hide the close button as they can only\r
1447          * be closed programmatically.</div></li>\r
1448          * <li><b>cls</b> : String<div class="sub-desc">A custom CSS class to apply to the message box's container element</div></li>\r
1449          * <li><b>defaultTextHeight</b> : Number<div class="sub-desc">The default height in pixels of the message box's multiline textarea\r
1450          * if displayed (defaults to 75)</div></li>\r
1451          * <li><b>fn</b> : Function<div class="sub-desc">A callback function which is called when the dialog is dismissed either\r
1452          * by clicking on the configured buttons, or on the dialog close button, or by pressing\r
1453          * the return button to enter input.\r
1454          * <p>Progress and wait dialogs will ignore this option since they do not respond to user\r
1455          * actions and can only be closed programmatically, so any required function should be called\r
1456          * by the same code after it closes the dialog. Parameters passed:<ul>\r
1457          * <li><b>buttonId</b> : String<div class="sub-desc">The ID of the button pressed, one of:<div class="sub-desc"><ul>\r
1458          * <li><tt>ok</tt></li>\r
1459          * <li><tt>yes</tt></li>\r
1460          * <li><tt>no</tt></li>\r
1461          * <li><tt>cancel</tt></li>\r
1462          * </ul></div></div></li>\r
1463          * <li><b>text</b> : String<div class="sub-desc">Value of the input field if either <tt><a href="#show-option-prompt" ext:member="show-option-prompt" ext:cls="Ext.MessageBox">prompt</a></tt>\r
1464          * or <tt><a href="#show-option-multiline" ext:member="show-option-multiline" ext:cls="Ext.MessageBox">multiline</a></tt> is true</div></li>\r
1465          * <li><b>opt</b> : Object<div class="sub-desc">The config object passed to show.</div></li>\r
1466          * </ul></p></div></li>\r
1467          * <li><b>scope</b> : Object<div class="sub-desc">The scope of the callback function</div></li>\r
1468          * <li><b>icon</b> : String<div class="sub-desc">A CSS class that provides a background image to be used as the body icon for the\r
1469          * dialog (e.g. Ext.MessageBox.WARNING or 'custom-class') (defaults to '')</div></li>\r
1470          * <li><b>iconCls</b> : String<div class="sub-desc">The standard {@link Ext.Window#iconCls} to\r
1471          * add an optional header icon (defaults to '')</div></li>\r
1472          * <li><b>maxWidth</b> : Number<div class="sub-desc">The maximum width in pixels of the message box (defaults to 600)</div></li>\r
1473          * <li><b>minWidth</b> : Number<div class="sub-desc">The minimum width in pixels of the message box (defaults to 100)</div></li>\r
1474          * <li><b>modal</b> : Boolean<div class="sub-desc">False to allow user interaction with the page while the message box is\r
1475          * displayed (defaults to true)</div></li>\r
1476          * <li><b>msg</b> : String<div class="sub-desc">A string that will replace the existing message box body text (defaults to the\r
1477          * XHTML-compliant non-breaking space character '&amp;#160;')</div></li>\r
1478          * <li><a id="show-option-multiline"></a><b>multiline</b> : Boolean<div class="sub-desc">\r
1479          * True to prompt the user to enter multi-line text (defaults to false)</div></li>\r
1480          * <li><b>progress</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>\r
1481          * <li><b>progressText</b> : String<div class="sub-desc">The text to display inside the progress bar if progress = true (defaults to '')</div></li>\r
1482          * <li><a id="show-option-prompt"></a><b>prompt</b> : Boolean<div class="sub-desc">True to prompt the user to enter single-line text (defaults to false)</div></li>\r
1483          * <li><b>proxyDrag</b> : Boolean<div class="sub-desc">True to display a lightweight proxy while dragging (defaults to false)</div></li>\r
1484          * <li><b>title</b> : String<div class="sub-desc">The title text</div></li>\r
1485          * <li><b>value</b> : String<div class="sub-desc">The string value to set into the active textbox element if displayed</div></li>\r
1486          * <li><b>wait</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>\r
1487          * <li><b>waitConfig</b> : Object<div class="sub-desc">A {@link Ext.ProgressBar#waitConfig} object (applies only if wait = true)</div></li>\r
1488          * <li><b>width</b> : Number<div class="sub-desc">The width of the dialog in pixels</div></li>\r
1489          * </ul>\r
1490          * Example usage:\r
1491          * <pre><code>\r
1492 Ext.Msg.show({\r
1493    title: 'Address',\r
1494    msg: 'Please enter your address:',\r
1495    width: 300,\r
1496    buttons: Ext.MessageBox.OKCANCEL,\r
1497    multiline: true,\r
1498    fn: saveAddress,\r
1499    animEl: 'addAddressBtn',\r
1500    icon: Ext.MessageBox.INFO\r
1501 });\r
1502 </code></pre>\r
1503          * @return {Ext.MessageBox} this\r
1504          */\r
1505         show : function(options){\r
1506             if(this.isVisible()){\r
1507                 this.hide();\r
1508             }\r
1509             opt = options;\r
1510             var d = this.getDialog(opt.title || "&#160;");\r
1511 \r
1512             d.setTitle(opt.title || "&#160;");\r
1513             var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);\r
1514             d.tools.close.setDisplayed(allowClose);\r
1515             activeTextEl = textboxEl;\r
1516             opt.prompt = opt.prompt || (opt.multiline ? true : false);\r
1517             if(opt.prompt){\r
1518                 if(opt.multiline){\r
1519                     textboxEl.hide();\r
1520                     textareaEl.show();\r
1521                     textareaEl.setHeight(Ext.isNumber(opt.multiline) ? opt.multiline : this.defaultTextHeight);\r
1522                     activeTextEl = textareaEl;\r
1523                 }else{\r
1524                     textboxEl.show();\r
1525                     textareaEl.hide();\r
1526                 }\r
1527             }else{\r
1528                 textboxEl.hide();\r
1529                 textareaEl.hide();\r
1530             }\r
1531             activeTextEl.dom.value = opt.value || "";\r
1532             if(opt.prompt){\r
1533                 d.focusEl = activeTextEl;\r
1534             }else{\r
1535                 var bs = opt.buttons;\r
1536                 var db = null;\r
1537                 if(bs && bs.ok){\r
1538                     db = buttons["ok"];\r
1539                 }else if(bs && bs.yes){\r
1540                     db = buttons["yes"];\r
1541                 }\r
1542                 if (db){\r
1543                     d.focusEl = db;\r
1544                 }\r
1545             }\r
1546             if(opt.iconCls){\r
1547               d.setIconClass(opt.iconCls);\r
1548             }\r
1549             this.setIcon(Ext.isDefined(opt.icon) ? opt.icon : bufferIcon);\r
1550             bwidth = updateButtons(opt.buttons);\r
1551             progressBar.setVisible(opt.progress === true || opt.wait === true);\r
1552             this.updateProgress(0, opt.progressText);\r
1553             this.updateText(opt.msg);\r
1554             if(opt.cls){\r
1555                 d.el.addClass(opt.cls);\r
1556             }\r
1557             d.proxyDrag = opt.proxyDrag === true;\r
1558             d.modal = opt.modal !== false;\r
1559             d.mask = opt.modal !== false ? mask : false;\r
1560             if(!d.isVisible()){\r
1561                 // force it to the end of the z-index stack so it gets a cursor in FF\r
1562                 document.body.appendChild(dlg.el.dom);\r
1563                 d.setAnimateTarget(opt.animEl);\r
1564                 //workaround for window internally enabling keymap in afterShow\r
1565                 d.on('show', function(){\r
1566                     if(allowClose === true){\r
1567                         d.keyMap.enable();\r
1568                     }else{\r
1569                         d.keyMap.disable();\r
1570                     }\r
1571                 }, this, {single:true});\r
1572                 d.show(opt.animEl);\r
1573             }\r
1574             if(opt.wait === true){\r
1575                 progressBar.wait(opt.waitConfig);\r
1576             }\r
1577             return this;\r
1578         },\r
1579 \r
1580         /**\r
1581          * Adds the specified icon to the dialog.  By default, the class 'ext-mb-icon' is applied for default\r
1582          * styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')\r
1583          * to clear any existing icon. This method must be called before the MessageBox is shown.\r
1584          * The following built-in icon classes are supported, but you can also pass in a custom class name:\r
1585          * <pre>\r
1586 Ext.MessageBox.INFO\r
1587 Ext.MessageBox.WARNING\r
1588 Ext.MessageBox.QUESTION\r
1589 Ext.MessageBox.ERROR\r
1590          *</pre>\r
1591          * @param {String} icon A CSS classname specifying the icon's background image url, or empty string to clear the icon\r
1592          * @return {Ext.MessageBox} this\r
1593          */\r
1594         setIcon : function(icon){\r
1595             if(!dlg){\r
1596                 bufferIcon = icon;\r
1597                 return;\r
1598             }\r
1599             bufferIcon = undefined;\r
1600             if(icon && icon != ''){\r
1601                 iconEl.removeClass('x-hidden');\r
1602                 iconEl.replaceClass(iconCls, icon);\r
1603                 bodyEl.addClass('x-dlg-icon');\r
1604                 iconCls = icon;\r
1605             }else{\r
1606                 iconEl.replaceClass(iconCls, 'x-hidden');\r
1607                 bodyEl.removeClass('x-dlg-icon');\r
1608                 iconCls = '';\r
1609             }\r
1610             return this;\r
1611         },\r
1612 \r
1613         /**\r
1614          * Displays a message box with a progress bar.  This message box has no buttons and is not closeable by\r
1615          * the user.  You are responsible for updating the progress bar as needed via {@link Ext.MessageBox#updateProgress}\r
1616          * and closing the message box when the process is complete.\r
1617          * @param {String} title The title bar text\r
1618          * @param {String} msg The message box body text\r
1619          * @param {String} progressText (optional) The text to display inside the progress bar (defaults to '')\r
1620          * @return {Ext.MessageBox} this\r
1621          */\r
1622         progress : function(title, msg, progressText){\r
1623             this.show({\r
1624                 title : title,\r
1625                 msg : msg,\r
1626                 buttons: false,\r
1627                 progress:true,\r
1628                 closable:false,\r
1629                 minWidth: this.minProgressWidth,\r
1630                 progressText: progressText\r
1631             });\r
1632             return this;\r
1633         },\r
1634 \r
1635         /**\r
1636          * Displays a message box with an infinitely auto-updating progress bar.  This can be used to block user\r
1637          * interaction while waiting for a long-running process to complete that does not have defined intervals.\r
1638          * You are responsible for closing the message box when the process is complete.\r
1639          * @param {String} msg The message box body text\r
1640          * @param {String} title (optional) The title bar text\r
1641          * @param {Object} config (optional) A {@link Ext.ProgressBar#waitConfig} object\r
1642          * @return {Ext.MessageBox} this\r
1643          */\r
1644         wait : function(msg, title, config){\r
1645             this.show({\r
1646                 title : title,\r
1647                 msg : msg,\r
1648                 buttons: false,\r
1649                 closable:false,\r
1650                 wait:true,\r
1651                 modal:true,\r
1652                 minWidth: this.minProgressWidth,\r
1653                 waitConfig: config\r
1654             });\r
1655             return this;\r
1656         },\r
1657 \r
1658         /**\r
1659          * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).\r
1660          * If a callback function is passed it will be called after the user clicks the button, and the\r
1661          * id of the button that was clicked will be passed as the only parameter to the callback\r
1662          * (could also be the top-right close button).\r
1663          * @param {String} title The title bar text\r
1664          * @param {String} msg The message box body text\r
1665          * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
1666          * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.\r
1667          * @return {Ext.MessageBox} this\r
1668          */\r
1669         alert : function(title, msg, fn, scope){\r
1670             this.show({\r
1671                 title : title,\r
1672                 msg : msg,\r
1673                 buttons: this.OK,\r
1674                 fn: fn,\r
1675                 scope : scope,\r
1676                 minWidth: this.minWidth\r
1677             });\r
1678             return this;\r
1679         },\r
1680 \r
1681         /**\r
1682          * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).\r
1683          * If a callback function is passed it will be called after the user clicks either button,\r
1684          * and the id of the button that was clicked will be passed as the only parameter to the callback\r
1685          * (could also be the top-right close button).\r
1686          * @param {String} title The title bar text\r
1687          * @param {String} msg The message box body text\r
1688          * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
1689          * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.\r
1690          * @return {Ext.MessageBox} this\r
1691          */\r
1692         confirm : function(title, msg, fn, scope){\r
1693             this.show({\r
1694                 title : title,\r
1695                 msg : msg,\r
1696                 buttons: this.YESNO,\r
1697                 fn: fn,\r
1698                 scope : scope,\r
1699                 icon: this.QUESTION,\r
1700                 minWidth: this.minWidth\r
1701             });\r
1702             return this;\r
1703         },\r
1704 \r
1705         /**\r
1706          * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).\r
1707          * The prompt can be a single-line or multi-line textbox.  If a callback function is passed it will be called after the user\r
1708          * clicks either button, and the id of the button that was clicked (could also be the top-right\r
1709          * close button) and the text that was entered will be passed as the two parameters to the callback.\r
1710          * @param {String} title The title bar text\r
1711          * @param {String} msg The message box body text\r
1712          * @param {Function} fn (optional) The callback function invoked after the message box is closed\r
1713          * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to the browser wnidow.\r
1714          * @param {Boolean/Number} multiline (optional) True to create a multiline textbox using the defaultTextHeight\r
1715          * property, or the height in pixels to create the textbox (defaults to false / single-line)\r
1716          * @param {String} value (optional) Default value of the text input element (defaults to '')\r
1717          * @return {Ext.MessageBox} this\r
1718          */\r
1719         prompt : function(title, msg, fn, scope, multiline, value){\r
1720             this.show({\r
1721                 title : title,\r
1722                 msg : msg,\r
1723                 buttons: this.OKCANCEL,\r
1724                 fn: fn,\r
1725                 minWidth: this.minPromptWidth,\r
1726                 scope : scope,\r
1727                 prompt:true,\r
1728                 multiline: multiline,\r
1729                 value: value\r
1730             });\r
1731             return this;\r
1732         },\r
1733 \r
1734         /**\r
1735          * Button config that displays a single OK button\r
1736          * @type Object\r
1737          */\r
1738         OK : {ok:true},\r
1739         /**\r
1740          * Button config that displays a single Cancel button\r
1741          * @type Object\r
1742          */\r
1743         CANCEL : {cancel:true},\r
1744         /**\r
1745          * Button config that displays OK and Cancel buttons\r
1746          * @type Object\r
1747          */\r
1748         OKCANCEL : {ok:true, cancel:true},\r
1749         /**\r
1750          * Button config that displays Yes and No buttons\r
1751          * @type Object\r
1752          */\r
1753         YESNO : {yes:true, no:true},\r
1754         /**\r
1755          * Button config that displays Yes, No and Cancel buttons\r
1756          * @type Object\r
1757          */\r
1758         YESNOCANCEL : {yes:true, no:true, cancel:true},\r
1759         /**\r
1760          * The CSS class that provides the INFO icon image\r
1761          * @type String\r
1762          */\r
1763         INFO : 'ext-mb-info',\r
1764         /**\r
1765          * The CSS class that provides the WARNING icon image\r
1766          * @type String\r
1767          */\r
1768         WARNING : 'ext-mb-warning',\r
1769         /**\r
1770          * The CSS class that provides the QUESTION icon image\r
1771          * @type String\r
1772          */\r
1773         QUESTION : 'ext-mb-question',\r
1774         /**\r
1775          * The CSS class that provides the ERROR icon image\r
1776          * @type String\r
1777          */\r
1778         ERROR : 'ext-mb-error',\r
1779 \r
1780         /**\r
1781          * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)\r
1782          * @type Number\r
1783          */\r
1784         defaultTextHeight : 75,\r
1785         /**\r
1786          * The maximum width in pixels of the message box (defaults to 600)\r
1787          * @type Number\r
1788          */\r
1789         maxWidth : 600,\r
1790         /**\r
1791          * The minimum width in pixels of the message box (defaults to 100)\r
1792          * @type Number\r
1793          */\r
1794         minWidth : 100,\r
1795         /**\r
1796          * The minimum width in pixels of the message box if it is a progress-style dialog.  This is useful\r
1797          * for setting a different minimum width than text-only dialogs may need (defaults to 250).\r
1798          * @type Number\r
1799          */\r
1800         minProgressWidth : 250,\r
1801         /**\r
1802          * The minimum width in pixels of the message box if it is a prompt dialog.  This is useful\r
1803          * for setting a different minimum width than text-only dialogs may need (defaults to 250).\r
1804          * @type Number\r
1805          */\r
1806         minPromptWidth: 250,\r
1807         /**\r
1808          * An object containing the default button text strings that can be overriden for localized language support.\r
1809          * Supported properties are: ok, cancel, yes and no.  Generally you should include a locale-specific\r
1810          * resource file for handling language support across the framework.\r
1811          * Customize the default text like so: Ext.MessageBox.buttonText.yes = "oui"; //french\r
1812          * @type Object\r
1813          */\r
1814         buttonText : {\r
1815             ok : "OK",\r
1816             cancel : "Cancel",\r
1817             yes : "Yes",\r
1818             no : "No"\r
1819         }\r
1820     };\r
1821 }();\r
1822 \r
1823 /**\r
1824  * Shorthand for {@link Ext.MessageBox}\r
1825  */\r
1826 Ext.Msg = Ext.MessageBox;/**\r
1827  * @class Ext.dd.PanelProxy\r
1828  * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally\r
1829  * for the Panel's drag drop implementation, and should never need to be created directly.\r
1830  * @constructor\r
1831  * @param panel The {@link Ext.Panel} to proxy for\r
1832  * @param config Configuration options\r
1833  */\r
1834 Ext.dd.PanelProxy = function(panel, config){\r
1835     this.panel = panel;\r
1836     this.id = this.panel.id +'-ddproxy';\r
1837     Ext.apply(this, config);\r
1838 };\r
1839 \r
1840 Ext.dd.PanelProxy.prototype = {\r
1841     /**\r
1842      * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,\r
1843      * false to drag with no proxy (defaults to true).\r
1844      */\r
1845     insertProxy : true,\r
1846 \r
1847     // private overrides\r
1848     setStatus : Ext.emptyFn,\r
1849     reset : Ext.emptyFn,\r
1850     update : Ext.emptyFn,\r
1851     stop : Ext.emptyFn,\r
1852     sync: Ext.emptyFn,\r
1853 \r
1854     /**\r
1855      * Gets the proxy's element\r
1856      * @return {Element} The proxy's element\r
1857      */\r
1858     getEl : function(){\r
1859         return this.ghost;\r
1860     },\r
1861 \r
1862     /**\r
1863      * Gets the proxy's ghost element\r
1864      * @return {Element} The proxy's ghost element\r
1865      */\r
1866     getGhost : function(){\r
1867         return this.ghost;\r
1868     },\r
1869 \r
1870     /**\r
1871      * Gets the proxy's element\r
1872      * @return {Element} The proxy's element\r
1873      */\r
1874     getProxy : function(){\r
1875         return this.proxy;\r
1876     },\r
1877 \r
1878     /**\r
1879      * Hides the proxy\r
1880      */\r
1881     hide : function(){\r
1882         if(this.ghost){\r
1883             if(this.proxy){\r
1884                 this.proxy.remove();\r
1885                 delete this.proxy;\r
1886             }\r
1887             this.panel.el.dom.style.display = '';\r
1888             this.ghost.remove();\r
1889             delete this.ghost;\r
1890         }\r
1891     },\r
1892 \r
1893     /**\r
1894      * Shows the proxy\r
1895      */\r
1896     show : function(){\r
1897         if(!this.ghost){\r
1898             this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());\r
1899             this.ghost.setXY(this.panel.el.getXY())\r
1900             if(this.insertProxy){\r
1901                 this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});\r
1902                 this.proxy.setSize(this.panel.getSize());\r
1903             }\r
1904             this.panel.el.dom.style.display = 'none';\r
1905         }\r
1906     },\r
1907 \r
1908     // private\r
1909     repair : function(xy, callback, scope){\r
1910         this.hide();\r
1911         if(typeof callback == "function"){\r
1912             callback.call(scope || this);\r
1913         }\r
1914     },\r
1915 \r
1916     /**\r
1917      * Moves the proxy to a different position in the DOM.  This is typically called while dragging the Panel\r
1918      * to keep the proxy sync'd to the Panel's location.\r
1919      * @param {HTMLElement} parentNode The proxy's parent DOM node\r
1920      * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults\r
1921      * to the parent's last child if not specified)\r
1922      */\r
1923     moveProxy : function(parentNode, before){\r
1924         if(this.proxy){\r
1925             parentNode.insertBefore(this.proxy.dom, before);\r
1926         }\r
1927     }\r
1928 };\r
1929 \r
1930 // private - DD implementation for Panels\r
1931 Ext.Panel.DD = function(panel, cfg){\r
1932     this.panel = panel;\r
1933     this.dragData = {panel: panel};\r
1934     this.proxy = new Ext.dd.PanelProxy(panel, cfg);\r
1935     Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);\r
1936     var h = panel.header;\r
1937     if(h){\r
1938         this.setHandleElId(h.id);\r
1939     }\r
1940     (h ? h : this.panel.body).setStyle('cursor', 'move');\r
1941     this.scroll = false;\r
1942 };\r
1943 \r
1944 Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {\r
1945     showFrame: Ext.emptyFn,\r
1946     startDrag: Ext.emptyFn,\r
1947     b4StartDrag: function(x, y) {\r
1948         this.proxy.show();\r
1949     },\r
1950     b4MouseDown: function(e) {\r
1951         var x = e.getPageX();\r
1952         var y = e.getPageY();\r
1953         this.autoOffset(x, y);\r
1954     },\r
1955     onInitDrag : function(x, y){\r
1956         this.onStartDrag(x, y);\r
1957         return true;\r
1958     },\r
1959     createFrame : Ext.emptyFn,\r
1960     getDragEl : function(e){\r
1961         return this.proxy.ghost.dom;\r
1962     },\r
1963     endDrag : function(e){\r
1964         this.proxy.hide();\r
1965         this.panel.saveState();\r
1966     },\r
1967 \r
1968     autoOffset : function(x, y) {\r
1969         x -= this.startPageX;\r
1970         y -= this.startPageY;\r
1971         this.setDelta(x, y);\r
1972     }\r
1973 });