3
* Copyright(c) 2006-2008, Ext JS, LLC.
6
* http://extjs.com/license
10
* @class Ext.WindowGroup
11
* An object that represents 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]);
68
* The starting z-index for windows (defaults to 9000)
69
* @type Number The z-index value
74
register : function(win){
77
win.on('hide', activateLast);
81
unregister : function(win){
83
win.un('hide', activateLast);
84
accessList.remove(win);
88
* Gets a registered window by id.
89
* @param {String/Object} id The id of the window or a {@link Ext.Window} instance
90
* @return {Ext.Window}
93
return typeof id == "object" ? id : list[id];
97
* Brings the specified window to the front of any other active windows.
98
* @param {String/Object} win The id of the window or a {@link Ext.Window} instance
99
* @return {Boolean} True if the dialog was brought to the front, else false
100
* if it was already in front
102
bringToFront : function(win){
105
win._lastAccess = new Date().getTime();
113
* Sends the specified window to the back of other active windows.
114
* @param {String/Object} win The id of the window or a {@link Ext.Window} instance
115
* @return {Ext.Window} The window
117
sendToBack : function(win){
119
win._lastAccess = -(new Date().getTime());
125
* Hides all windows in the group.
127
hideAll : function(){
129
if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
136
* Gets the currently-active window in the group.
137
* @return {Ext.Window} The active window
139
getActive : function(){
144
* Returns zero or more windows in the group using the custom search function passed to this method.
145
* The function should accept a single {@link Ext.Window} reference as its only argument and should
146
* return true if the window matches the search criteria, otherwise it should return false.
147
* @param {Function} fn The search function
148
* @param {Object} scope (optional) The scope in which to execute the function (defaults to the window
149
* that gets passed to the function if not specified)
150
* @return {Array} An array of zero or more matching windows
152
getBy : function(fn, scope){
154
for(var i = accessList.length-1; i >=0; --i) {
155
var win = accessList[i];
156
if(fn.call(scope||win, win) !== false){
164
* Executes the specified function once for every window in the group, passing each
165
* window as the only parameter. Returning false from the function will stop the iteration.
166
* @param {Function} fn The function to execute for each item
167
* @param {Object} scope (optional) The scope in which to execute the function
169
each : function(fn, scope){
171
if(list[id] && typeof list[id] != "function"){
172
if(fn.call(scope || list[id], list[id]) === false){
183
* @class Ext.WindowMgr
184
* @extends Ext.WindowGroup
185
* The default global window group that is available automatically. To have more than one group of windows
186
* with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
189
Ext.WindowMgr = new Ext.WindowGroup();
b'\\ No newline at end of file'