3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js"><div id="cls-Ext.WindowGroup"></div>/**
10 * @class Ext.WindowGroup
11 * An object that manages a group of {@link Ext.Window} instances and provides z-order management
12 * and window activation behavior.
15 Ext.WindowGroup = function(){
21 var sortWindows = function(d1, d2){
22 return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
26 var orderWindows = function(){
27 var a = accessList, len = a.length;
30 var seed = a[0].manager.zseed;
31 for(var i = 0; i < len; i++){
33 if(win && !win.hidden){
34 win.setZIndex(seed + (i*10));
42 var setActiveWin = function(win){
45 front.setActive(false);
55 var activateLast = function(){
56 for(var i = accessList.length-1; i >=0; --i) {
57 if(!accessList[i].hidden){
58 setActiveWin(accessList[i]);
67 <div id="prop-Ext.WindowGroup-zseed"></div>/**
68 * The starting z-index for windows in this WindowGroup (defaults to 9000)
69 * @type Number The z-index value
73 <div id="method-Ext.WindowGroup-register"></div>/**
74 * <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
75 * need to be called under normal circumstances. Windows are automatically registered
76 * with a {@link Ext.Window#manager manager} at construction time.</p>
77 * <p>Where this may be useful is moving Windows between two WindowManagers. For example,
78 * to bring the Ext.MessageBox dialog under the same manager as the Desktop's
79 * WindowManager in the desktop sample app:</p><code><pre>
80 var msgWin = Ext.MessageBox.getDialog();
81 MyDesktop.getDesktop().getManager().register(msgWin);
83 * @param {Window} win The Window to register.
85 register : function(win){
87 win.manager.unregister(win);
93 win.on('hide', activateLast);
96 <div id="method-Ext.WindowGroup-unregister"></div>/**
97 * <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
98 * need to be called. Windows are automatically unregistered upon destruction.
99 * See {@link #register}.</p>
100 * @param {Window} win The Window to unregister.
102 unregister : function(win){
105 win.un('hide', activateLast);
106 accessList.remove(win);
109 <div id="method-Ext.WindowGroup-get"></div>/**
110 * Gets a registered window by id.
111 * @param {String/Object} id The id of the window or a {@link Ext.Window} instance
112 * @return {Ext.Window}
115 return typeof id == "object" ? id : list[id];
118 <div id="method-Ext.WindowGroup-bringToFront"></div>/**
119 * Brings the specified window to the front of any other active windows in this WindowGroup.
120 * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
121 * @return {Boolean} True if the dialog was brought to the front, else false
122 * if it was already in front
124 bringToFront : function(win){
127 win._lastAccess = new Date().getTime();
134 <div id="method-Ext.WindowGroup-sendToBack"></div>/**
135 * Sends the specified window to the back of other active windows in this WindowGroup.
136 * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
137 * @return {Ext.Window} The window
139 sendToBack : function(win){
141 win._lastAccess = -(new Date().getTime());
146 <div id="method-Ext.WindowGroup-hideAll"></div>/**
147 * Hides all windows in this WindowGroup.
149 hideAll : function(){
151 if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
157 <div id="method-Ext.WindowGroup-getActive"></div>/**
158 * Gets the currently-active window in this WindowGroup.
159 * @return {Ext.Window} The active window
161 getActive : function(){
165 <div id="method-Ext.WindowGroup-getBy"></div>/**
166 * Returns zero or more windows in this WindowGroup using the custom search function passed to this method.
167 * The function should accept a single {@link Ext.Window} reference as its only argument and should
168 * return true if the window matches the search criteria, otherwise it should return false.
169 * @param {Function} fn The search function
170 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Window being tested.
171 * that gets passed to the function if not specified)
172 * @return {Array} An array of zero or more matching windows
174 getBy : function(fn, scope){
176 for(var i = accessList.length-1; i >=0; --i) {
177 var win = accessList[i];
178 if(fn.call(scope||win, win) !== false){
185 <div id="method-Ext.WindowGroup-each"></div>/**
186 * Executes the specified function once for every window in this WindowGroup, passing each
187 * window as the only parameter. Returning false from the function will stop the iteration.
188 * @param {Function} fn The function to execute for each item
189 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Window in the iteration.
191 each : function(fn, scope){
193 if(list[id] && typeof list[id] != "function"){
194 if(fn.call(scope || list[id], list[id]) === false){
204 <div id="cls-Ext.WindowMgr"></div>/**
205 * @class Ext.WindowMgr
206 * @extends Ext.WindowGroup
207 * The default global window group that is available automatically. To have more than one group of windows
208 * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
211 Ext.WindowMgr = new Ext.WindowGroup();</pre>
\r