Source: temp/jsdocinputdirs/cercalia.widget.loadingoverlay.js

/**
 * LoadingOverlay widget constructor
 * @class
 * @constructor 
 * @param {cercaliax.widget.LoadingOverlayOptions} options Opciones del LoadingOverlay
 */
cercalia.widget.LoadingOverlay = function (options) {
	
	/**
	 * Class name
	 * @private
	 * @type {string}
	 */
	this.CLASS_NAME_ = "cercalia.widget.LoadingOverlay";
	
	/* OPTIONS */
	
	/**
	 * DIV ID to be hidden with the widget.
	 * @private
	 * @type {string}
	 */
	this.divId_ = options.div ? options.div : null;
	
	/**
	 * Overlay default text. OVERLAY_DEFAULT_TEXT = key defined in the language file.
	 * @private
	 * @type {string}
	 */
	this.defaultText_ = options.defaultText ? options.defaultText : cercalia.i18n._("OVERLAY_DEFAULT_TEXT");
	
	/* VARIABLES PRIVADAS */
	
	/**
	 * Modal DIV.
	 * @private
	 * @type {Object}
	 */
	this.overlayElement_ = null;
	
	/**
	 * Dialog with text
	 * @private
	 * @type {Object}
	 */
	this.overlayDialog_ = null;
	
	// Inicializamos
	this.initialize_();
};

/**
 * Initializes element.
 * @private
 */
cercalia.widget.LoadingOverlay.prototype.initialize_ = function () {
	
	if( ! this.divId_ ) {
		cercalia.Exception(cercalia.i18n._('WIDGET_ERR_NO_DIV "%"', this.CLASS_NAME_));
	} else {
		
		this.overlayElement_ = cercalia.jQuery("<div />").addClass("cercalia-widget cercalia-widget-overlay ui-widget-overlay").insertAfter( "#" + this.divId_).hide();
		this.overlayDialog_ = cercalia.jQuery("<div />").addClass("cercalia-widget-overlay-dialog-content").appendTo(this.overlayElement_).dialog({
			autoOpen: false,
			closeOnEscape: false,
			closeText: "",
			draggable: false,
			resizable: false,
			title: "",
			dialogClass: "cercalia-widget cercalia-widget-overlay cercalia-widget-overlay-dialog cercalia-widget-shadow",
			position: { my: "center", at: "center", of: "#" + this.divId_ },
			width: 200,
			height: 100
		});
		
		cercalia.jQuery("<span />").addClass("ui-icon cercalia-icon cercalia-loader").appendTo(this.overlayDialog_);
		cercalia.jQuery("<p />").addClass("cercalia-widget-overlay-dialog-text").appendTo(this.overlayDialog_).html(this.defaultText_);
	}
};

/**
 * Hide the overlay and the dialog.
 */
cercalia.widget.LoadingOverlay.prototype.hide = function () {
	this.overlayElement_.hide();
	this.overlayDialog_.dialog("close");
};

/**
 * Displays overlay and dialog  information.
 * @param {string} [text=defaultText] Displays text in the dialog.
 * @param {boolean} [showText=true] Display / not display text in the dialog. 
 */
cercalia.widget.LoadingOverlay.prototype.show = function (text, showText) {
	showText = typeof(showText) === "boolean" ? showText : true;
	text = typeof(text) === "string" ? text : this.defaultText_;
	
	var spanText = this.overlayDialog_.find(".cercalia-widget-overlay-dialog-text").html(text);
	if(showText) spanText.show();
	else spanText.hide();
	
	this.overlayElement_.show();
	this.overlayDialog_.dialog("open");
};

/**
* Returns the type of the object.
* @return {string}
*/
cercalia.widget.LoadingOverlay.prototype.getClass = function(){
	return this.CLASS_NAME_;
};