X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..c8256059947f3aa8f5b0a9a2acf55e2142bb4742:/docs/source/Window.html?ds=inline diff --git a/docs/source/Window.html b/docs/source/Window.html index 21b4ac13..048384a6 100644 --- a/docs/source/Window.html +++ b/docs/source/Window.html @@ -1,13 +1,14 @@
+/*! - * Ext JS Library 3.0.3 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.2.1 + * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ @@ -57,8 +58,13 @@ Ext.Window = Ext.extend(Ext.Panel, { * A reference to the WindowGroup that should manage this window (defaults to {@link Ext.WindowMgr}). */ /** - * @cfg {String/Number/Button} defaultButton - * The id / index of a button or a button instance to focus when this window received the focus. + * @cfg {String/Number/Component} defaultButton + *+ \ No newline at end of fileSpecifies a Component to receive focus when this Window is focussed.
+ *This may be one of:
*/ /** * @cfg {Function} onEsc @@ -190,19 +196,13 @@ Ext.Window = Ext.extend(Ext.Panel, { * @deprecated */ initHidden : undefined, - + /** * @cfg {Boolean} hidden * Render this component hidden (default is true). If true, the * {@link #hide} method will be called internally. */ hidden : true, - - /** - * @cfg {Boolean} monitorResize @hide - * This is automatically managed based on the value of constrain and constrainToHeader - */ - monitorResize : true, // The following configs are set to provide the basic functionality of a window. // Changing them would require additional code to handle correctly and should @@ -313,7 +313,8 @@ Ext.Window = Ext.extend(Ext.Panel, { minHeight:this.minHeight, handles: this.resizeHandles || 'all', pinned: true, - resizeElement : this.resizerAction + resizeElement : this.resizerAction, + handleCls: 'x-window-handle' }); this.resizer.window = this; this.mon(this.resizer, 'beforeresize', this.beforeResize, this); @@ -338,8 +339,12 @@ Ext.Window = Ext.extend(Ext.Panel, { initDraggable : function(){ /** - * If this Window is configured {@link #draggable}, this property will contain - * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element. + *+ *
- The index of a footer Button.
+ *- The id of a Component.
+ *- A Component.
+ *If this Window is configured {@link #draggable}, this property will contain + * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.
+ *This has implementations of
* @type Ext.dd.DD * @property dd */ @@ -347,18 +352,16 @@ Ext.Window = Ext.extend(Ext.Panel, { }, // private - onEsc : function(){ + onEsc : function(k, e){ + e.stopEvent(); this[this.closeAction](); }, // private beforeDestroy : function(){ - if (this.rendered){ + if(this.rendered){ this.hide(); - if(this.doAnchor){ - Ext.EventManager.removeResizeListener(this.doAnchor, this); - Ext.EventManager.un(window, 'scroll', this.doAnchor, this); - } + this.clearAnchor(); Ext.destroy( this.focusEl, this.resizer, @@ -435,11 +438,13 @@ Ext.Window = Ext.extend(Ext.Panel, { this.updateBox(box); }else{ this.setSize(box); + if (Ext.isIE6 && Ext.isStrict) { + this.doLayout(); + } } this.focus(); this.updateHandles(); this.saveState(); - this.doLayout(); }, /** @@ -447,7 +452,11 @@ Ext.Window = Ext.extend(Ext.Panel, { * window itself will receive focus. */ focus : function(){ - var f = this.focusEl, db = this.defaultButton, t = typeof db; + var f = this.focusEl, + db = this.defaultButton, + t = typeof db, + el, + ct; if(Ext.isDefined(db)){ if(Ext.isNumber(db) && this.fbar){ f = this.fbar.items.get(db); @@ -456,6 +465,13 @@ Ext.Window = Ext.extend(Ext.Panel, { }else{ f = db; } + el = f.getEl(); + ct = Ext.getDom(this.container); + if (el && ct) { + if (!Ext.lib.Region.getRegion(ct).contains(Ext.lib.Region.getRegion(el.dom))){ + return; + } + } } f = f || this.focusEl; f.focus.defer(10, f); @@ -498,7 +514,7 @@ Ext.Window = Ext.extend(Ext.Panel, { * @param {String/Element} animateTarget (optional) The target element or id from which the window should * animate while opening (defaults to null with no animation) * @param {Function} callback (optional) A callback function to call after the window is displayed - * @param {Object} scope (optional) The scope in which to execute the callback + * @param {Object} scope (optional) The scope (startDrag
,onDrag
andendDrag
+ * which perform the dragging action. If extra logic is needed at these points, use + * {@link Function#createInterceptor createInterceptor} or {@link Function#createSequence createSequence} to + * augment the existing implementations.this
reference) in which the callback is executed. Defaults to this Window. * @return {Ext.Window} this */ show : function(animateTarget, cb, scope){ @@ -530,13 +546,16 @@ Ext.Window = Ext.extend(Ext.Panel, { // private afterShow : function(isAnim){ + if (this.isDestroyed){ + return false; + } this.proxy.hide(); this.el.setStyle('display', 'block'); this.el.show(); if(this.maximized){ this.fitContainer(); } - if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug + if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug this.cascade(this.setAutoScroll); } @@ -554,6 +573,7 @@ Ext.Window = Ext.extend(Ext.Panel, { var sz = this.getSize(); this.onResize(sz.width, sz.height); } + this.onShow(); this.fireEvent('show', this); }, @@ -578,7 +598,7 @@ Ext.Window = Ext.extend(Ext.Panel, { * @param {String/Element} animateTarget (optional) The target element or id to which the window should * animate while hiding (defaults to null with no animation) * @param {Function} callback (optional) A callback function to call after the window is hidden - * @param {Object} scope (optional) The scope in which to execute the callback + * @param {Object} scope (optional) The scope (this
reference) in which the callback is executed. Defaults to this Window. * @return {Ext.Window} this */ hide : function(animateTarget, cb, scope){ @@ -614,6 +634,7 @@ Ext.Window = Ext.extend(Ext.Panel, { if(this.keyMap){ this.keyMap.disable(); } + this.onHide(); this.fireEvent('hide', this); }, @@ -633,6 +654,18 @@ Ext.Window = Ext.extend(Ext.Panel, { })); }, + /** + * Method that is called immediately before theshow
event is fired. + * Defaults toExt.emptyFn
. + */ + onShow : Ext.emptyFn, + + /** + * Method that is called immediately before thehide
event is fired. + * Defaults toExt.emptyFn
. + */ + onHide : Ext.emptyFn, + // private onWindowResize : function(){ if(this.maximized){ @@ -689,8 +722,8 @@ Ext.Window = Ext.extend(Ext.Panel, { } if(show !== false){ this.el.show(); - this.focus(); - if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug + this.focus.defer(10, this); + if(Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug this.cascade(this.setAutoScroll); } } @@ -730,7 +763,7 @@ Ext.Window = Ext.extend(Ext.Panel, { } } }, - + // private doClose : function(){ this.fireEvent('close', this); @@ -780,9 +813,14 @@ Ext.Window = Ext.extend(Ext.Panel, { */ restore : function(){ if(this.maximized){ + var t = this.tools; this.el.removeClass('x-window-maximized'); - this.tools.restore.hide(); - this.tools.maximize.show(); + if(t.restore){ + t.restore.hide(); + } + if(t.maximize){ + t.maximize.show(); + } this.setPosition(this.restorePos[0], this.restorePos[1]); this.setSize(this.restoreSize.width, this.restoreSize.height); delete this.restorePos; @@ -793,8 +831,8 @@ Ext.Window = Ext.extend(Ext.Panel, { if(this.dd){ this.dd.unlock(); } - if(this.collapsible){ - this.tools.toggle.show(); + if(this.collapsible && t.toggle){ + t.toggle.show(); } this.container.removeClass('x-window-maximized-ct'); @@ -815,7 +853,7 @@ Ext.Window = Ext.extend(Ext.Panel, { // private fitContainer : function(){ - var vs = this.container.getViewSize(); + var vs = this.container.getViewSize(false); this.setSize(vs.width, vs.height); }, @@ -838,7 +876,7 @@ Ext.Window = Ext.extend(Ext.Panel, { /** * Aligns the window to the specified element * @param {Mixed} element The element to align to. - * @param {String} position The position to align to (see {@link Ext.Element#alignTo} for more details). + * @param {String} position (optional, defaults to "tl-bl?") The position to align to (see {@link Ext.Element#alignTo} for more details). * @param {Array} offsets (optional) Offset the positioning by [x, y] * @return {Ext.Window} this */ @@ -858,22 +896,44 @@ Ext.Window = Ext.extend(Ext.Panel, { * @return {Ext.Window} this */ anchorTo : function(el, alignment, offsets, monitorScroll){ - if(this.doAnchor){ - Ext.EventManager.removeResizeListener(this.doAnchor, this); - Ext.EventManager.un(window, 'scroll', this.doAnchor, this); - } - this.doAnchor = function(){ - this.alignTo(el, alignment, offsets); - }; - Ext.EventManager.onWindowResize(this.doAnchor, this); - - var tm = typeof monitorScroll; - if(tm != 'undefined'){ - Ext.EventManager.on(window, 'scroll', this.doAnchor, this, - {buffer: tm == 'number' ? monitorScroll : 50}); - } - this.doAnchor(); - return this; + this.clearAnchor(); + this.anchorTarget = { + el: el, + alignment: alignment, + offsets: offsets + }; + + Ext.EventManager.onWindowResize(this.doAnchor, this); + var tm = typeof monitorScroll; + if(tm != 'undefined'){ + Ext.EventManager.on(window, 'scroll', this.doAnchor, this, + {buffer: tm == 'number' ? monitorScroll : 50}); + } + return this.doAnchor(); + }, + + /** + * Performs the anchor, using the saved anchorTarget property. + * @return {Ext.Window} this + * @private + */ + doAnchor : function(){ + var o = this.anchorTarget; + this.alignTo(o.el, o.alignment, o.offsets); + return this; + }, + + /** + * Removes any existing anchor from this window. See {@link #anchorTo}. + * @return {Ext.Window} this + */ + clearAnchor : function(){ + if(this.anchorTarget){ + Ext.EventManager.removeResizeListener(this.doAnchor, this); + Ext.EventManager.un(window, 'scroll', this.doAnchor, this); + delete this.anchorTarget; + } + return this; }, /** @@ -966,6 +1026,6 @@ Ext.extend(Ext.Window.DD, Ext.dd.DD, { this.win.saveState(); } }); -