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.

207 lines
5.4 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. Ext.tree.TreeEventModel = function(tree){
  16. this.tree = tree;
  17. this.tree.on('render', this.initEvents, this);
  18. };
  19. Ext.tree.TreeEventModel.prototype = {
  20. initEvents : function(){
  21. var t = this.tree;
  22. if(t.trackMouseOver !== false){
  23. t.mon(t.innerCt, {
  24. scope: this,
  25. mouseover: this.delegateOver,
  26. mouseout: this.delegateOut
  27. });
  28. }
  29. t.mon(t.getTreeEl(), {
  30. scope: this,
  31. click: this.delegateClick,
  32. dblclick: this.delegateDblClick,
  33. contextmenu: this.delegateContextMenu
  34. });
  35. },
  36. getNode : function(e){
  37. var t;
  38. if(t = e.getTarget('.x-tree-node-el', 10)){
  39. var id = Ext.fly(t, '_treeEvents').getAttribute('tree-node-id', 'ext');
  40. if(id){
  41. return this.tree.getNodeById(id);
  42. }
  43. }
  44. return null;
  45. },
  46. getNodeTarget : function(e){
  47. var t = e.getTarget('.x-tree-node-icon', 1);
  48. if(!t){
  49. t = e.getTarget('.x-tree-node-el', 6);
  50. }
  51. return t;
  52. },
  53. delegateOut : function(e, t){
  54. if(!this.beforeEvent(e)){
  55. return;
  56. }
  57. if(e.getTarget('.x-tree-ec-icon', 1)){
  58. var n = this.getNode(e);
  59. this.onIconOut(e, n);
  60. if(n == this.lastEcOver){
  61. delete this.lastEcOver;
  62. }
  63. }
  64. if((t = this.getNodeTarget(e)) && !e.within(t, true)){
  65. this.onNodeOut(e, this.getNode(e));
  66. }
  67. },
  68. delegateOver : function(e, t){
  69. if(!this.beforeEvent(e)){
  70. return;
  71. }
  72. if(Ext.isGecko && !this.trackingDoc){ // prevent hanging in FF
  73. Ext.getBody().on('mouseover', this.trackExit, this);
  74. this.trackingDoc = true;
  75. }
  76. if(this.lastEcOver){ // prevent hung highlight
  77. this.onIconOut(e, this.lastEcOver);
  78. delete this.lastEcOver;
  79. }
  80. if(e.getTarget('.x-tree-ec-icon', 1)){
  81. this.lastEcOver = this.getNode(e);
  82. this.onIconOver(e, this.lastEcOver);
  83. }
  84. if(t = this.getNodeTarget(e)){
  85. this.onNodeOver(e, this.getNode(e));
  86. }
  87. },
  88. trackExit : function(e){
  89. if(this.lastOverNode){
  90. if(this.lastOverNode.ui && !e.within(this.lastOverNode.ui.getEl())){
  91. this.onNodeOut(e, this.lastOverNode);
  92. }
  93. delete this.lastOverNode;
  94. Ext.getBody().un('mouseover', this.trackExit, this);
  95. this.trackingDoc = false;
  96. }
  97. },
  98. delegateClick : function(e, t){
  99. if(this.beforeEvent(e)){
  100. if(e.getTarget('input[type=checkbox]', 1)){
  101. this.onCheckboxClick(e, this.getNode(e));
  102. }else if(e.getTarget('.x-tree-ec-icon', 1)){
  103. this.onIconClick(e, this.getNode(e));
  104. }else if(this.getNodeTarget(e)){
  105. this.onNodeClick(e, this.getNode(e));
  106. }
  107. }else{
  108. this.checkContainerEvent(e, 'click');
  109. }
  110. },
  111. delegateDblClick : function(e, t){
  112. if(this.beforeEvent(e)){
  113. if(this.getNodeTarget(e)){
  114. this.onNodeDblClick(e, this.getNode(e));
  115. }
  116. }else{
  117. this.checkContainerEvent(e, 'dblclick');
  118. }
  119. },
  120. delegateContextMenu : function(e, t){
  121. if(this.beforeEvent(e)){
  122. if(this.getNodeTarget(e)){
  123. this.onNodeContextMenu(e, this.getNode(e));
  124. }
  125. }else{
  126. this.checkContainerEvent(e, 'contextmenu');
  127. }
  128. },
  129. checkContainerEvent: function(e, type){
  130. if(this.disabled){
  131. e.stopEvent();
  132. return false;
  133. }
  134. this.onContainerEvent(e, type);
  135. },
  136. onContainerEvent: function(e, type){
  137. this.tree.fireEvent('container' + type, this.tree, e);
  138. },
  139. onNodeClick : function(e, node){
  140. node.ui.onClick(e);
  141. },
  142. onNodeOver : function(e, node){
  143. this.lastOverNode = node;
  144. node.ui.onOver(e);
  145. },
  146. onNodeOut : function(e, node){
  147. node.ui.onOut(e);
  148. },
  149. onIconOver : function(e, node){
  150. node.ui.addClass('x-tree-ec-over');
  151. },
  152. onIconOut : function(e, node){
  153. node.ui.removeClass('x-tree-ec-over');
  154. },
  155. onIconClick : function(e, node){
  156. node.ui.ecClick(e);
  157. },
  158. onCheckboxClick : function(e, node){
  159. node.ui.onCheckChange(e);
  160. },
  161. onNodeDblClick : function(e, node){
  162. node.ui.onDblClick(e);
  163. },
  164. onNodeContextMenu : function(e, node){
  165. node.ui.onContextMenu(e);
  166. },
  167. beforeEvent : function(e){
  168. var node = this.getNode(e);
  169. if(this.disabled || !node || !node.ui){
  170. e.stopEvent();
  171. return false;
  172. }
  173. return true;
  174. },
  175. disable: function(){
  176. this.disabled = true;
  177. },
  178. enable: function(){
  179. this.disabled = false;
  180. }
  181. };</pre>
  182. </body>
  183. </html>