123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /*
- * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
- *
- * http://extjs.com/license
- */
- Ext.WindowGroup = function() {
- var F = {};
- var D = [];
- var E = null;
- var C = function(I, H) {
- return (!I._lastAccess || I._lastAccess < H._lastAccess) ? -1 : 1
- };
- var G = function() {
- var J = D, H = J.length;
- if (H > 0) {
- J.sort(C);
- var I = J[0].manager.zseed;
- for (var K = 0; K < H; K++) {
- var L = J[K];
- if (L && !L.hidden) {
- L.setZIndex(I + (K * 10))
- }
- }
- }
- A()
- };
- var B = function(H) {
- if (H != E) {
- if (E) {
- E.setActive(false)
- }
- E = H;
- if (H) {
- H.setActive(true)
- }
- }
- };
- var A = function() {
- for (var H = D.length - 1; H >= 0; --H) {
- if (!D[H].hidden) {
- B(D[H]);
- return
- }
- }
- B(null)
- };
- return {
- zseed : 9000,
- register : function(H) {
- F[H.id] = H;
- D.push(H);
- H.on("hide", A)
- },
- unregister : function(H) {
- delete F[H.id];
- H.un("hide", A);
- D.remove(H)
- },
- get : function(H) {
- return typeof H == "object" ? H : F[H]
- },
- bringToFront : function(H) {
- H = this.get(H);
- if (H != E) {
- H._lastAccess = allGetServerTime().getTime();
- G();
- return true
- }
- return false
- },
- sendToBack : function(H) {
- H = this.get(H);
- H._lastAccess = -(allGetServerTime().getTime());
- G();
- return H
- },
- hideAll : function() {
- for (var H in F) {
- if (F[H] && typeof F[H] != "function" && F[H].isVisible()) {
- F[H].hide()
- }
- }
- },
- getActive : function() {
- return E
- },
- getBy : function(J, I) {
- var K = [];
- for (var H = D.length - 1; H >= 0; --H) {
- var L = D[H];
- if (J.call(I || L, L) !== false) {
- K.push(L)
- }
- }
- return K
- },
- each : function(I, H) {
- for (var J in F) {
- if (F[J] && typeof F[J] != "function") {
- if (I.call(H || F[J], F[J]) === false) {
- return
- }
- }
- }
- }
- }
- };
- Ext.WindowMgr = new Ext.WindowGroup();
|