+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- * @class Ext.WindowGroup\r
- * An object that represents a group of {@link Ext.Window} instances and provides z-order management\r
- * and window activation behavior.\r
- * @constructor\r
- */\r
-Ext.WindowGroup = function(){\r
- var list = {};\r
- var accessList = [];\r
- var front = null;\r
-\r
- // private\r
- var sortWindows = function(d1, d2){\r
- return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;\r
- };\r
-\r
- // private\r
- var orderWindows = function(){\r
- var a = accessList, len = a.length;\r
- if(len > 0){\r
- a.sort(sortWindows);\r
- var seed = a[0].manager.zseed;\r
- for(var i = 0; i < len; i++){\r
- var win = a[i];\r
- if(win && !win.hidden){\r
- win.setZIndex(seed + (i*10));\r
- }\r
- }\r
- }\r
- activateLast();\r
- };\r
-\r
- // private\r
- var setActiveWin = function(win){\r
- if(win != front){\r
- if(front){\r
- front.setActive(false);\r
- }\r
- front = win;\r
- if(win){\r
- win.setActive(true);\r
- }\r
- }\r
- };\r
-\r
- // private\r
- var activateLast = function(){\r
- for(var i = accessList.length-1; i >=0; --i) {\r
- if(!accessList[i].hidden){\r
- setActiveWin(accessList[i]);\r
- return;\r
- }\r
- }\r
- // none to activate\r
- setActiveWin(null);\r
- };\r
-\r
- return {\r
- /**\r
- * The starting z-index for windows (defaults to 9000)\r
- * @type Number The z-index value\r
- */\r
- zseed : 9000,\r
-\r
- // private\r
- register : function(win){\r
- list[win.id] = win;\r
- accessList.push(win);\r
- win.on('hide', activateLast);\r
- },\r
-\r
- // private\r
- unregister : function(win){\r
- delete list[win.id];\r
- win.un('hide', activateLast);\r
- accessList.remove(win);\r
- },\r
-\r
- /**\r
- * Gets a registered window by id.\r
- * @param {String/Object} id The id of the window or a {@link Ext.Window} instance\r
- * @return {Ext.Window}\r
- */\r
- get : function(id){\r
- return typeof id == "object" ? id : list[id];\r
- },\r
-\r
- /**\r
- * Brings the specified window to the front of any other active windows.\r
- * @param {String/Object} win The id of the window or a {@link Ext.Window} instance\r
- * @return {Boolean} True if the dialog was brought to the front, else false\r
- * if it was already in front\r
- */\r
- bringToFront : function(win){\r
- win = this.get(win);\r
- if(win != front){\r
- win._lastAccess = new Date().getTime();\r
- orderWindows();\r
- return true;\r
- }\r
- return false;\r
- },\r
-\r
- /**\r
- * Sends the specified window to the back of other active windows.\r
- * @param {String/Object} win The id of the window or a {@link Ext.Window} instance\r
- * @return {Ext.Window} The window\r
- */\r
- sendToBack : function(win){\r
- win = this.get(win);\r
- win._lastAccess = -(new Date().getTime());\r
- orderWindows();\r
- return win;\r
- },\r
-\r
- /**\r
- * Hides all windows in the group.\r
- */\r
- hideAll : function(){\r
- for(var id in list){\r
- if(list[id] && typeof list[id] != "function" && list[id].isVisible()){\r
- list[id].hide();\r
- }\r
- }\r
- },\r
-\r
- /**\r
- * Gets the currently-active window in the group.\r
- * @return {Ext.Window} The active window\r
- */\r
- getActive : function(){\r
- return front;\r
- },\r
-\r
- /**\r
- * Returns zero or more windows in the group using the custom search function passed to this method.\r
- * The function should accept a single {@link Ext.Window} reference as its only argument and should\r
- * return true if the window matches the search criteria, otherwise it should return false.\r
- * @param {Function} fn The search function\r
- * @param {Object} scope (optional) The scope in which to execute the function (defaults to the window\r
- * that gets passed to the function if not specified)\r
- * @return {Array} An array of zero or more matching windows\r
- */\r
- getBy : function(fn, scope){\r
- var r = [];\r
- for(var i = accessList.length-1; i >=0; --i) {\r
- var win = accessList[i];\r
- if(fn.call(scope||win, win) !== false){\r
- r.push(win);\r
- }\r
- }\r
- return r;\r
- },\r
-\r
- /**\r
- * Executes the specified function once for every window in the group, passing each\r
- * window as the only parameter. Returning false from the function will stop the iteration.\r
- * @param {Function} fn The function to execute for each item\r
- * @param {Object} scope (optional) The scope in which to execute the function\r
- */\r
- each : function(fn, scope){\r
- for(var id in list){\r
- if(list[id] && typeof list[id] != "function"){\r
- if(fn.call(scope || list[id], list[id]) === false){\r
- return;\r
- }\r
- }\r
- }\r
- }\r
- };\r
-};\r
-\r
-\r
-/**\r
- * @class Ext.WindowMgr\r
- * @extends Ext.WindowGroup\r
- * The default global window group that is available automatically. To have more than one group of windows\r
- * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.\r
- * @singleton\r
- */\r
-Ext.WindowMgr = new Ext.WindowGroup();
\ No newline at end of file