22697dfac688f9fc2ab5bea5845da033a2d2ede1.svn-base 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. Ext.WindowGroup = function() {
  7. var F = {};
  8. var D = [];
  9. var E = null;
  10. var C = function(I, H) {
  11. return (!I._lastAccess || I._lastAccess < H._lastAccess) ? -1 : 1
  12. };
  13. var G = function() {
  14. var J = D, H = J.length;
  15. if (H > 0) {
  16. J.sort(C);
  17. var I = J[0].manager.zseed;
  18. for (var K = 0; K < H; K++) {
  19. var L = J[K];
  20. if (L && !L.hidden) {
  21. L.setZIndex(I + (K * 10))
  22. }
  23. }
  24. }
  25. A()
  26. };
  27. var B = function(H) {
  28. if (H != E) {
  29. if (E) {
  30. E.setActive(false)
  31. }
  32. E = H;
  33. if (H) {
  34. H.setActive(true)
  35. }
  36. }
  37. };
  38. var A = function() {
  39. for (var H = D.length - 1; H >= 0; --H) {
  40. if (!D[H].hidden) {
  41. B(D[H]);
  42. return
  43. }
  44. }
  45. B(null)
  46. };
  47. return {
  48. zseed : 9000,
  49. register : function(H) {
  50. F[H.id] = H;
  51. D.push(H);
  52. H.on("hide", A)
  53. },
  54. unregister : function(H) {
  55. delete F[H.id];
  56. H.un("hide", A);
  57. D.remove(H)
  58. },
  59. get : function(H) {
  60. return typeof H == "object" ? H : F[H]
  61. },
  62. bringToFront : function(H) {
  63. H = this.get(H);
  64. if (H != E) {
  65. H._lastAccess = allGetServerTime().getTime();
  66. G();
  67. return true
  68. }
  69. return false
  70. },
  71. sendToBack : function(H) {
  72. H = this.get(H);
  73. H._lastAccess = -(allGetServerTime().getTime());
  74. G();
  75. return H
  76. },
  77. hideAll : function() {
  78. for (var H in F) {
  79. if (F[H] && typeof F[H] != "function" && F[H].isVisible()) {
  80. F[H].hide()
  81. }
  82. }
  83. },
  84. getActive : function() {
  85. return E
  86. },
  87. getBy : function(J, I) {
  88. var K = [];
  89. for (var H = D.length - 1; H >= 0; --H) {
  90. var L = D[H];
  91. if (J.call(I || L, L) !== false) {
  92. K.push(L)
  93. }
  94. }
  95. return K
  96. },
  97. each : function(I, H) {
  98. for (var J in F) {
  99. if (F[J] && typeof F[J] != "function") {
  100. if (I.call(H || F[J], F[J]) === false) {
  101. return
  102. }
  103. }
  104. }
  105. }
  106. }
  107. };
  108. Ext.WindowMgr = new Ext.WindowGroup();