+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- * @class Ext.LoadMask\r
- * A simple utility class for generically masking elements while loading data. If the {@link #store}\r
- * config option is specified, the masking will be automatically synchronized with the store's loading\r
- * process and the mask element will be cached for reuse. For all other elements, this mask will replace the\r
- * element's Updater load indicator and will be destroyed after the initial load.\r
- * <p>Example usage:</p>\r
- *<pre><code>\r
-// Basic mask:\r
-var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});\r
-myMask.show();\r
-</code></pre>\r
- * @constructor\r
- * Create a new LoadMask\r
- * @param {Mixed} el The element or DOM node, or its id\r
- * @param {Object} config The config object\r
- */\r
-Ext.LoadMask = function(el, config){\r
- this.el = Ext.get(el);\r
- Ext.apply(this, config);\r
- if(this.store){\r
- this.store.on('beforeload', this.onBeforeLoad, this);\r
- this.store.on('load', this.onLoad, this);\r
- this.store.on('loadexception', this.onLoad, this);\r
- this.removeMask = Ext.value(this.removeMask, false);\r
- }else{\r
- var um = this.el.getUpdater();\r
- um.showLoadIndicator = false; // disable the default indicator\r
- um.on('beforeupdate', this.onBeforeLoad, this);\r
- um.on('update', this.onLoad, this);\r
- um.on('failure', this.onLoad, this);\r
- this.removeMask = Ext.value(this.removeMask, true);\r
- }\r
-};\r
-\r
-Ext.LoadMask.prototype = {\r
- /**\r
- * @cfg {Ext.data.Store} store\r
- * Optional Store to which the mask is bound. The mask is displayed when a load request is issued, and\r
- * hidden on either load sucess, or load fail.\r
- */\r
- /**\r
- * @cfg {Boolean} removeMask\r
- * True to create a single-use mask that is automatically destroyed after loading (useful for page loads),\r
- * False to persist the mask element reference for multiple uses (e.g., for paged data widgets). Defaults to false.\r
- */\r
- /**\r
- * @cfg {String} msg\r
- * The text to display in a centered loading message box (defaults to 'Loading...')\r
- */\r
- msg : 'Loading...',\r
- /**\r
- * @cfg {String} msgCls\r
- * The CSS class to apply to the loading message element (defaults to "x-mask-loading")\r
- */\r
- msgCls : 'x-mask-loading',\r
-\r
- /**\r
- * Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)\r
- * @type Boolean\r
- */\r
- disabled: false,\r
-\r
- /**\r
- * Disables the mask to prevent it from being displayed\r
- */\r
- disable : function(){\r
- this.disabled = true;\r
- },\r
-\r
- /**\r
- * Enables the mask so that it can be displayed\r
- */\r
- enable : function(){\r
- this.disabled = false;\r
- },\r
-\r
- // private\r
- onLoad : function(){\r
- this.el.unmask(this.removeMask);\r
- },\r
-\r
- // private\r
- onBeforeLoad : function(){\r
- if(!this.disabled){\r
- this.el.mask(this.msg, this.msgCls);\r
- }\r
- },\r
-\r
- /**\r
- * Show this LoadMask over the configured Element.\r
- */\r
- show: function(){\r
- this.onBeforeLoad();\r
- },\r
-\r
- /**\r
- * Hide this LoadMask.\r
- */\r
- hide: function(){\r
- this.onLoad(); \r
- },\r
-\r
- // private\r
- destroy : function(){\r
- if(this.store){\r
- this.store.un('beforeload', this.onBeforeLoad, this);\r
- this.store.un('load', this.onLoad, this);\r
- this.store.un('loadexception', this.onLoad, this);\r
- }else{\r
- var um = this.el.getUpdater();\r
- um.un('beforeupdate', this.onBeforeLoad, this);\r
- um.un('update', this.onLoad, this);\r
- um.un('failure', this.onLoad, this);\r
- }\r
- }\r
-};
\ No newline at end of file