Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
7.9 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.WindowGroup"></div>/**
  16. * @class Ext.WindowGroup
  17. * An object that manages a group of {@link Ext.Window} instances and provides z-order management
  18. * and window activation behavior.
  19. * @constructor
  20. */
  21. Ext.WindowGroup = function(){
  22. var list = {};
  23. var accessList = [];
  24. var front = null;
  25. // private
  26. var sortWindows = function(d1, d2){
  27. return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
  28. };
  29. // private
  30. var orderWindows = function(){
  31. var a = accessList, len = a.length;
  32. if(len > 0){
  33. a.sort(sortWindows);
  34. var seed = a[0].manager.zseed;
  35. for(var i = 0; i < len; i++){
  36. var win = a[i];
  37. if(win && !win.hidden){
  38. win.setZIndex(seed + (i*10));
  39. }
  40. }
  41. }
  42. activateLast();
  43. };
  44. // private
  45. var setActiveWin = function(win){
  46. if(win != front){
  47. if(front){
  48. front.setActive(false);
  49. }
  50. front = win;
  51. if(win){
  52. win.setActive(true);
  53. }
  54. }
  55. };
  56. // private
  57. var activateLast = function(){
  58. for(var i = accessList.length-1; i >=0; --i) {
  59. if(!accessList[i].hidden){
  60. setActiveWin(accessList[i]);
  61. return;
  62. }
  63. }
  64. // none to activate
  65. setActiveWin(null);
  66. };
  67. return {
  68. <div id="prop-Ext.WindowGroup-zseed"></div>/**
  69. * The starting z-index for windows in this WindowGroup (defaults to 9000)
  70. * @type Number The z-index value
  71. */
  72. zseed : 9000,
  73. <div id="method-Ext.WindowGroup-register"></div>/**
  74. * <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
  75. * need to be called under normal circumstances. Windows are automatically registered
  76. * with a {@link Ext.Window#manager manager} at construction time.</p>
  77. * <p>Where this may be useful is moving Windows between two WindowManagers. For example,
  78. * to bring the Ext.MessageBox dialog under the same manager as the Desktop's
  79. * WindowManager in the desktop sample app:</p><code><pre>
  80. var msgWin = Ext.MessageBox.getDialog();
  81. MyDesktop.getDesktop().getManager().register(msgWin);
  82. </pre></code>
  83. * @param {Window} win The Window to register.
  84. */
  85. register : function(win){
  86. if(win.manager){
  87. win.manager.unregister(win);
  88. }
  89. win.manager = this;
  90. list[win.id] = win;
  91. accessList.push(win);
  92. win.on('hide', activateLast);
  93. },
  94. <div id="method-Ext.WindowGroup-unregister"></div>/**
  95. * <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
  96. * need to be called. Windows are automatically unregistered upon destruction.
  97. * See {@link #register}.</p>
  98. * @param {Window} win The Window to unregister.
  99. */
  100. unregister : function(win){
  101. delete win.manager;
  102. delete list[win.id];
  103. win.un('hide', activateLast);
  104. accessList.remove(win);
  105. },
  106. <div id="method-Ext.WindowGroup-get"></div>/**
  107. * Gets a registered window by id.
  108. * @param {String/Object} id The id of the window or a {@link Ext.Window} instance
  109. * @return {Ext.Window}
  110. */
  111. get : function(id){
  112. return typeof id == "object" ? id : list[id];
  113. },
  114. <div id="method-Ext.WindowGroup-bringToFront"></div>/**
  115. * Brings the specified window to the front of any other active windows in this WindowGroup.
  116. * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
  117. * @return {Boolean} True if the dialog was brought to the front, else false
  118. * if it was already in front
  119. */
  120. bringToFront : function(win){
  121. win = this.get(win);
  122. if(win != front){
  123. win._lastAccess = new Date().getTime();
  124. orderWindows();
  125. return true;
  126. }
  127. return false;
  128. },
  129. <div id="method-Ext.WindowGroup-sendToBack"></div>/**
  130. * Sends the specified window to the back of other active windows in this WindowGroup.
  131. * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
  132. * @return {Ext.Window} The window
  133. */
  134. sendToBack : function(win){
  135. win = this.get(win);
  136. win._lastAccess = -(new Date().getTime());
  137. orderWindows();
  138. return win;
  139. },
  140. <div id="method-Ext.WindowGroup-hideAll"></div>/**
  141. * Hides all windows in this WindowGroup.
  142. */
  143. hideAll : function(){
  144. for(var id in list){
  145. if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
  146. list[id].hide();
  147. }
  148. }
  149. },
  150. <div id="method-Ext.WindowGroup-getActive"></div>/**
  151. * Gets the currently-active window in this WindowGroup.
  152. * @return {Ext.Window} The active window
  153. */
  154. getActive : function(){
  155. return front;
  156. },
  157. <div id="method-Ext.WindowGroup-getBy"></div>/**
  158. * Returns zero or more windows in this WindowGroup using the custom search function passed to this method.
  159. * The function should accept a single {@link Ext.Window} reference as its only argument and should
  160. * return true if the window matches the search criteria, otherwise it should return false.
  161. * @param {Function} fn The search function
  162. * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Window being tested.
  163. * that gets passed to the function if not specified)
  164. * @return {Array} An array of zero or more matching windows
  165. */
  166. getBy : function(fn, scope){
  167. var r = [];
  168. for(var i = accessList.length-1; i >=0; --i) {
  169. var win = accessList[i];
  170. if(fn.call(scope||win, win) !== false){
  171. r.push(win);
  172. }
  173. }
  174. return r;
  175. },
  176. <div id="method-Ext.WindowGroup-each"></div>/**
  177. * Executes the specified function once for every window in this WindowGroup, passing each
  178. * window as the only parameter. Returning false from the function will stop the iteration.
  179. * @param {Function} fn The function to execute for each item
  180. * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current Window in the iteration.
  181. */
  182. each : function(fn, scope){
  183. for(var id in list){
  184. if(list[id] && typeof list[id] != "function"){
  185. if(fn.call(scope || list[id], list[id]) === false){
  186. return;
  187. }
  188. }
  189. }
  190. }
  191. };
  192. };
  193. <div id="cls-Ext.WindowMgr"></div>/**
  194. * @class Ext.WindowMgr
  195. * @extends Ext.WindowGroup
  196. * The default global window group that is available automatically. To have more than one group of windows
  197. * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
  198. * @singleton
  199. */
  200. Ext.WindowMgr = new Ext.WindowGroup();</pre>
  201. </body>
  202. </html>