3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js"><div id="cls-Ext.WindowGroup"></div>/**
9 * @class Ext.WindowGroup
10 * An object that represents a group of {@link Ext.Window} instances and provides z-order management
11 * and window activation behavior.
14 Ext.WindowGroup = function(){
20 var sortWindows = function(d1, d2){
21 return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
25 var orderWindows = function(){
26 var a = accessList, len = a.length;
29 var seed = a[0].manager.zseed;
30 for(var i = 0; i < len; i++){
32 if(win && !win.hidden){
33 win.setZIndex(seed + (i*10));
41 var setActiveWin = function(win){
44 front.setActive(false);
54 var activateLast = function(){
55 for(var i = accessList.length-1; i >=0; --i) {
56 if(!accessList[i].hidden){
57 setActiveWin(accessList[i]);
66 <div id="prop-Ext.WindowGroup-zseed"></div>/**
67 * The starting z-index for windows (defaults to 9000)
68 * @type Number The z-index value
73 register : function(win){
76 win.on('hide', activateLast);
80 unregister : function(win){
82 win.un('hide', activateLast);
83 accessList.remove(win);
86 <div id="method-Ext.WindowGroup-get"></div>/**
87 * Gets a registered window by id.
88 * @param {String/Object} id The id of the window or a {@link Ext.Window} instance
89 * @return {Ext.Window}
92 return typeof id == "object" ? id : list[id];
95 <div id="method-Ext.WindowGroup-bringToFront"></div>/**
96 * Brings the specified window to the front of any other active windows.
97 * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
98 * @return {Boolean} True if the dialog was brought to the front, else false
99 * if it was already in front
101 bringToFront : function(win){
104 win._lastAccess = new Date().getTime();
111 <div id="method-Ext.WindowGroup-sendToBack"></div>/**
112 * Sends the specified window to the back of other active windows.
113 * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
114 * @return {Ext.Window} The window
116 sendToBack : function(win){
118 win._lastAccess = -(new Date().getTime());
123 <div id="method-Ext.WindowGroup-hideAll"></div>/**
124 * Hides all windows in the group.
126 hideAll : function(){
128 if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
134 <div id="method-Ext.WindowGroup-getActive"></div>/**
135 * Gets the currently-active window in the group.
136 * @return {Ext.Window} The active window
138 getActive : function(){
142 <div id="method-Ext.WindowGroup-getBy"></div>/**
143 * Returns zero or more windows in the group using the custom search function passed to this method.
144 * The function should accept a single {@link Ext.Window} reference as its only argument and should
145 * return true if the window matches the search criteria, otherwise it should return false.
146 * @param {Function} fn The search function
147 * @param {Object} scope (optional) The scope in which to execute the function (defaults to the window
148 * that gets passed to the function if not specified)
149 * @return {Array} An array of zero or more matching windows
151 getBy : function(fn, scope){
153 for(var i = accessList.length-1; i >=0; --i) {
154 var win = accessList[i];
155 if(fn.call(scope||win, win) !== false){
162 <div id="method-Ext.WindowGroup-each"></div>/**
163 * Executes the specified function once for every window in the group, passing each
164 * window as the only parameter. Returning false from the function will stop the iteration.
165 * @param {Function} fn The function to execute for each item
166 * @param {Object} scope (optional) The scope in which to execute the function
168 each : function(fn, scope){
170 if(list[id] && typeof list[id] != "function"){
171 if(fn.call(scope || list[id], list[id]) === false){
181 <div id="cls-Ext.WindowMgr"></div>/**
182 * @class Ext.WindowMgr
183 * @extends Ext.WindowGroup
184 * The default global window group that is available automatically. To have more than one group of windows
185 * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
188 Ext.WindowMgr = new Ext.WindowGroup();</pre>
\r