3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.2.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
15 <div id="cls-Ext.WindowGroup"></div>/**
16 * @class Ext.WindowGroup
17 * An object that manages a group of {@link Ext.Window} instances and provides z-order management
18 * and window activation behavior.
21 Ext.WindowGroup = function(){
27 var sortWindows = function(d1, d2){
28 return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
32 var orderWindows = function(){
33 var a = accessList, len = a.length;
36 var seed = a[0].manager.zseed;
37 for(var i = 0; i < len; i++){
39 if(win && !win.hidden){
40 win.setZIndex(seed + (i*10));
48 var setActiveWin = function(win){
51 front.setActive(false);
61 var activateLast = function(){
62 for(var i = accessList.length-1; i >=0; --i) {
63 if(!accessList[i].hidden){
64 setActiveWin(accessList[i]);
73 <div id="prop-Ext.WindowGroup-zseed"></div>/**
74 * The starting z-index for windows in this WindowGroup (defaults to 9000)
75 * @type Number The z-index value
79 <div id="method-Ext.WindowGroup-register"></div>/**
80 * <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
81 * need to be called under normal circumstances. Windows are automatically registered
82 * with a {@link Ext.Window#manager manager} at construction time.</p>
83 * <p>Where this may be useful is moving Windows between two WindowManagers. For example,
84 * to bring the Ext.MessageBox dialog under the same manager as the Desktop's
85 * WindowManager in the desktop sample app:</p><code><pre>
86 var msgWin = Ext.MessageBox.getDialog();
87 MyDesktop.getDesktop().getManager().register(msgWin);
89 * @param {Window} win The Window to register.
91 register : function(win){
93 win.manager.unregister(win);
99 win.on('hide', activateLast);
102 <div id="method-Ext.WindowGroup-unregister"></div>/**
103 * <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
104 * need to be called. Windows are automatically unregistered upon destruction.
105 * See {@link #register}.</p>
106 * @param {Window} win The Window to unregister.
108 unregister : function(win){
111 win.un('hide', activateLast);
112 accessList.remove(win);
115 <div id="method-Ext.WindowGroup-get"></div>/**
116 * Gets a registered window by id.
117 * @param {String/Object} id The id of the window or a {@link Ext.Window} instance
118 * @return {Ext.Window}
121 return typeof id == "object" ? id : list[id];
124 <div id="method-Ext.WindowGroup-bringToFront"></div>/**
125 * Brings the specified window to the front of any other active windows in this WindowGroup.
126 * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
127 * @return {Boolean} True if the dialog was brought to the front, else false
128 * if it was already in front
130 bringToFront : function(win){
133 win._lastAccess = new Date().getTime();
140 <div id="method-Ext.WindowGroup-sendToBack"></div>/**
141 * Sends the specified window to the back of other active windows in this WindowGroup.
142 * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
143 * @return {Ext.Window} The window
145 sendToBack : function(win){
147 win._lastAccess = -(new Date().getTime());
152 <div id="method-Ext.WindowGroup-hideAll"></div>/**
153 * Hides all windows in this WindowGroup.
155 hideAll : function(){
157 if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
163 <div id="method-Ext.WindowGroup-getActive"></div>/**
164 * Gets the currently-active window in this WindowGroup.
165 * @return {Ext.Window} The active window
167 getActive : function(){
171 <div id="method-Ext.WindowGroup-getBy"></div>/**
172 * Returns zero or more windows in this WindowGroup using the custom search function passed to this method.
173 * The function should accept a single {@link Ext.Window} reference as its only argument and should
174 * return true if the window matches the search criteria, otherwise it should return false.
175 * @param {Function} fn The search function
176 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Window being tested.
177 * that gets passed to the function if not specified)
178 * @return {Array} An array of zero or more matching windows
180 getBy : function(fn, scope){
182 for(var i = accessList.length-1; i >=0; --i) {
183 var win = accessList[i];
184 if(fn.call(scope||win, win) !== false){
191 <div id="method-Ext.WindowGroup-each"></div>/**
192 * Executes the specified function once for every window in this WindowGroup, passing each
193 * window as the only parameter. Returning false from the function will stop the iteration.
194 * @param {Function} fn The function to execute for each item
195 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Window in the iteration.
197 each : function(fn, scope){
199 if(list[id] && typeof list[id] != "function"){
200 if(fn.call(scope || list[id], list[id]) === false){
210 <div id="cls-Ext.WindowMgr"></div>/**
211 * @class Ext.WindowMgr
212 * @extends Ext.WindowGroup
213 * The default global window group that is available automatically. To have more than one group of windows
214 * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
217 Ext.WindowMgr = new Ext.WindowGroup();</pre>