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.

138 lines
4.5 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.LoadMask"></div>/**
  16. * @class Ext.LoadMask
  17. * A simple utility class for generically masking elements while loading data. If the {@link #store}
  18. * config option is specified, the masking will be automatically synchronized with the store's loading
  19. * process and the mask element will be cached for reuse. For all other elements, this mask will replace the
  20. * element's Updater load indicator and will be destroyed after the initial load.
  21. * <p>Example usage:</p>
  22. *<pre><code>
  23. // Basic mask:
  24. var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
  25. myMask.show();
  26. </code></pre>
  27. * @constructor
  28. * Create a new LoadMask
  29. * @param {Mixed} el The element or DOM node, or its id
  30. * @param {Object} config The config object
  31. */
  32. Ext.LoadMask = function(el, config){
  33. this.el = Ext.get(el);
  34. Ext.apply(this, config);
  35. if(this.store){
  36. this.store.on({
  37. scope: this,
  38. beforeload: this.onBeforeLoad,
  39. load: this.onLoad,
  40. exception: this.onLoad
  41. });
  42. this.removeMask = Ext.value(this.removeMask, false);
  43. }else{
  44. var um = this.el.getUpdater();
  45. um.showLoadIndicator = false; // disable the default indicator
  46. um.on({
  47. scope: this,
  48. beforeupdate: this.onBeforeLoad,
  49. update: this.onLoad,
  50. failure: this.onLoad
  51. });
  52. this.removeMask = Ext.value(this.removeMask, true);
  53. }
  54. };
  55. Ext.LoadMask.prototype = {
  56. <div id="cfg-Ext.LoadMask-store"></div>/**
  57. * @cfg {Ext.data.Store} store
  58. * Optional Store to which the mask is bound. The mask is displayed when a load request is issued, and
  59. * hidden on either load sucess, or load fail.
  60. */
  61. <div id="cfg-Ext.LoadMask-removeMask"></div>/**
  62. * @cfg {Boolean} removeMask
  63. * True to create a single-use mask that is automatically destroyed after loading (useful for page loads),
  64. * False to persist the mask element reference for multiple uses (e.g., for paged data widgets). Defaults to false.
  65. */
  66. <div id="cfg-Ext.LoadMask-msg"></div>/**
  67. * @cfg {String} msg
  68. * The text to display in a centered loading message box (defaults to 'Loading...')
  69. */
  70. msg : 'Loading...',
  71. <div id="cfg-Ext.LoadMask-msgCls"></div>/**
  72. * @cfg {String} msgCls
  73. * The CSS class to apply to the loading message element (defaults to "x-mask-loading")
  74. */
  75. msgCls : 'x-mask-loading',
  76. <div id="prop-Ext.LoadMask-disabled"></div>/**
  77. * Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)
  78. * @type Boolean
  79. */
  80. disabled: false,
  81. <div id="method-Ext.LoadMask-disable"></div>/**
  82. * Disables the mask to prevent it from being displayed
  83. */
  84. disable : function(){
  85. this.disabled = true;
  86. },
  87. <div id="method-Ext.LoadMask-enable"></div>/**
  88. * Enables the mask so that it can be displayed
  89. */
  90. enable : function(){
  91. this.disabled = false;
  92. },
  93. // private
  94. onLoad : function(){
  95. this.el.unmask(this.removeMask);
  96. },
  97. // private
  98. onBeforeLoad : function(){
  99. if(!this.disabled){
  100. this.el.mask(this.msg, this.msgCls);
  101. }
  102. },
  103. <div id="method-Ext.LoadMask-show"></div>/**
  104. * Show this LoadMask over the configured Element.
  105. */
  106. show: function(){
  107. this.onBeforeLoad();
  108. },
  109. <div id="method-Ext.LoadMask-hide"></div>/**
  110. * Hide this LoadMask.
  111. */
  112. hide: function(){
  113. this.onLoad();
  114. },
  115. // private
  116. destroy : function(){
  117. if(this.store){
  118. this.store.un('beforeload', this.onBeforeLoad, this);
  119. this.store.un('load', this.onLoad, this);
  120. this.store.un('exception', this.onLoad, this);
  121. }else{
  122. var um = this.el.getUpdater();
  123. um.un('beforeupdate', this.onBeforeLoad, this);
  124. um.un('update', this.onLoad, this);
  125. um.un('failure', this.onLoad, this);
  126. }
  127. }
  128. };</pre>
  129. </body>
  130. </html>