/*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("datatable-message",function(b){var a;b.namespace("DataTable").Message=a=function(){};a.ATTRS={showMessages:{value:true,validator:b.Lang.isBoolean}};b.mix(a.prototype,{MESSAGE_TEMPLATE:'<tbody class="{className}"><tr><td class="{contentClass}" colspan="{colspan}"></td></tr></tbody>',hideMessage:function(){this.get("boundingBox").removeClass(this.getClassName("message","visible"));return this;},showMessage:function(d){var c=this.getString(d)||d;if(!this._messageNode){this._initMessageNode();}if(this.get("showMessages")){if(c){this._messageNode.one("."+this.getClassName("message","content")).setContent(c);this.get("boundingBox").addClass(this.getClassName("message","visible"));}else{this.hideMessage();}}return this;},_afterMessageColumnsChange:function(d){var c;if(this._messageNode){c=this._messageNode.one("."+this.getClassName("message","content"));if(c){c.set("colSpan",this._displayColumns.length);}}},_afterMessageDataChange:function(c){this._uiSetMessage();},_afterShowMessagesChange:function(c){if(c.newVal){this._uiSetMessage(c);}else{if(this._messageNode){this.get("boundingBox").removeClass(this.getClassName("message","visible"));this._messageNode.remove().destroy(true);this._messageNode=null;}}},_bindMessageUI:function(){this.after(["dataChange","*:add","*:remove","*:reset"],b.bind("_afterMessageDataChange",this));this.after("columnsChange",b.bind("_afterMessageColumnsChange",this));this.after("showMessagesChange",b.bind("_afterShowMessagesChange",this));},initializer:function(){this._initMessageStrings();if(this.get("showMessages")){this.after("renderBody",b.bind("_initMessageNode",this));}this.after(b.bind("_bindMessageUI",this),this,"bindUI");this.after(b.bind("_syncMessageUI",this),this,"syncUI");},_initMessageNode:function(){if(!this._messageNode){this._messageNode=b.Node.create(b.Lang.sub(this.MESSAGE_TEMPLATE,{className:this.getClassName("message"),contentClass:this.getClassName("message","content"),colspan:this._displayColumns.length||1}));this._tableNode.insertBefore(this._messageNode,this._tbodyNode);}},_initMessageStrings:function(){this.set("strings",b.mix((this.get("strings")||{}),b.Intl.get("datatable-message")));},_syncMessageUI:function(){this._uiSetMessage();},_uiSetMessage:function(c){if(!this.data.size()){this.showMessage((c&&c.message)||"emptyMessage");}else{this.hideMessage();}}});if(b.Lang.isFunction(b.DataTable)){b.Base.mix(b.DataTable,[a]);}},"3.5.1",{requires:["datatable-base"],skinnable:true,lang:["en"]});