Web Interface For Lite Argus Control modules
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.

184 lines
6.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.dd.StatusProxy"></div>/**
  16. * @class Ext.dd.StatusProxy
  17. * A specialized drag proxy that supports a drop status icon, {@link Ext.Layer} styles and auto-repair. This is the
  18. * default drag proxy used by all Ext.dd components.
  19. * @constructor
  20. * @param {Object} config
  21. */
  22. Ext.dd.StatusProxy = function(config){
  23. Ext.apply(this, config);
  24. this.id = this.id || Ext.id();
  25. this.el = new Ext.Layer({
  26. dh: {
  27. id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [
  28. {tag: "div", cls: "x-dd-drop-icon"},
  29. {tag: "div", cls: "x-dd-drag-ghost"}
  30. ]
  31. },
  32. shadow: !config || config.shadow !== false
  33. });
  34. this.ghost = Ext.get(this.el.dom.childNodes[1]);
  35. this.dropStatus = this.dropNotAllowed;
  36. };
  37. Ext.dd.StatusProxy.prototype = {
  38. <div id="cfg-Ext.dd.StatusProxy-dropAllowed"></div>/**
  39. * @cfg {String} dropAllowed
  40. * The CSS class to apply to the status element when drop is allowed (defaults to "x-dd-drop-ok").
  41. */
  42. dropAllowed : "x-dd-drop-ok",
  43. <div id="cfg-Ext.dd.StatusProxy-dropNotAllowed"></div>/**
  44. * @cfg {String} dropNotAllowed
  45. * The CSS class to apply to the status element when drop is not allowed (defaults to "x-dd-drop-nodrop").
  46. */
  47. dropNotAllowed : "x-dd-drop-nodrop",
  48. <div id="method-Ext.dd.StatusProxy-setStatus"></div>/**
  49. * Updates the proxy's visual element to indicate the status of whether or not drop is allowed
  50. * over the current target element.
  51. * @param {String} cssClass The css class for the new drop status indicator image
  52. */
  53. setStatus : function(cssClass){
  54. cssClass = cssClass || this.dropNotAllowed;
  55. if(this.dropStatus != cssClass){
  56. this.el.replaceClass(this.dropStatus, cssClass);
  57. this.dropStatus = cssClass;
  58. }
  59. },
  60. <div id="method-Ext.dd.StatusProxy-reset"></div>/**
  61. * Resets the status indicator to the default dropNotAllowed value
  62. * @param {Boolean} clearGhost True to also remove all content from the ghost, false to preserve it
  63. */
  64. reset : function(clearGhost){
  65. this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;
  66. this.dropStatus = this.dropNotAllowed;
  67. if(clearGhost){
  68. this.ghost.update("");
  69. }
  70. },
  71. <div id="method-Ext.dd.StatusProxy-update"></div>/**
  72. * Updates the contents of the ghost element
  73. * @param {String/HTMLElement} html The html that will replace the current innerHTML of the ghost element, or a
  74. * DOM node to append as the child of the ghost element (in which case the innerHTML will be cleared first).
  75. */
  76. update : function(html){
  77. if(typeof html == "string"){
  78. this.ghost.update(html);
  79. }else{
  80. this.ghost.update("");
  81. html.style.margin = "0";
  82. this.ghost.dom.appendChild(html);
  83. }
  84. var el = this.ghost.dom.firstChild;
  85. if(el){
  86. Ext.fly(el).setStyle('float', 'none');
  87. }
  88. },
  89. <div id="method-Ext.dd.StatusProxy-getEl"></div>/**
  90. * Returns the underlying proxy {@link Ext.Layer}
  91. * @return {Ext.Layer} el
  92. */
  93. getEl : function(){
  94. return this.el;
  95. },
  96. <div id="method-Ext.dd.StatusProxy-getGhost"></div>/**
  97. * Returns the ghost element
  98. * @return {Ext.Element} el
  99. */
  100. getGhost : function(){
  101. return this.ghost;
  102. },
  103. <div id="method-Ext.dd.StatusProxy-hide"></div>/**
  104. * Hides the proxy
  105. * @param {Boolean} clear True to reset the status and clear the ghost contents, false to preserve them
  106. */
  107. hide : function(clear){
  108. this.el.hide();
  109. if(clear){
  110. this.reset(true);
  111. }
  112. },
  113. <div id="method-Ext.dd.StatusProxy-stop"></div>/**
  114. * Stops the repair animation if it's currently running
  115. */
  116. stop : function(){
  117. if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){
  118. this.anim.stop();
  119. }
  120. },
  121. <div id="method-Ext.dd.StatusProxy-show"></div>/**
  122. * Displays this proxy
  123. */
  124. show : function(){
  125. this.el.show();
  126. },
  127. <div id="method-Ext.dd.StatusProxy-sync"></div>/**
  128. * Force the Layer to sync its shadow and shim positions to the element
  129. */
  130. sync : function(){
  131. this.el.sync();
  132. },
  133. <div id="method-Ext.dd.StatusProxy-repair"></div>/**
  134. * Causes the proxy to return to its position of origin via an animation. Should be called after an
  135. * invalid drop operation by the item being dragged.
  136. * @param {Array} xy The XY position of the element ([x, y])
  137. * @param {Function} callback The function to call after the repair is complete.
  138. * @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
  139. */
  140. repair : function(xy, callback, scope){
  141. this.callback = callback;
  142. this.scope = scope;
  143. if(xy && this.animRepair !== false){
  144. this.el.addClass("x-dd-drag-repair");
  145. this.el.hideUnders(true);
  146. this.anim = this.el.shift({
  147. duration: this.repairDuration || .5,
  148. easing: 'easeOut',
  149. xy: xy,
  150. stopFx: true,
  151. callback: this.afterRepair,
  152. scope: this
  153. });
  154. }else{
  155. this.afterRepair();
  156. }
  157. },
  158. // private
  159. afterRepair : function(){
  160. this.hide(true);
  161. if(typeof this.callback == "function"){
  162. this.callback.call(this.scope || this);
  163. }
  164. this.callback = null;
  165. this.scope = null;
  166. },
  167. destroy: function(){
  168. Ext.destroy(this.ghost, this.el);
  169. }
  170. };</pre>
  171. </body>
  172. </html>