text: PrimeFaces.widget.TabView=PrimeFaces.widget.BaseWidget.extend({GRID_MAP:{"2":"a","3":"b","4":"c","5":"d"},BLOCK_MAP:{"0":"a","1":"b","2":"c","3":"d","4":"e"},init:function(a){this._super(a);this.navbar=this.jq.children(".ui-navbar");this.navContainer=this.navbar.children(".ui-tabs-nav");this.headers=this.navContainer.children(".ui-tabs-header");this.panelContainer=this.jq.children(".ui-tabs-panels");this.stateHolder=$(this.jqId+"_activeIndex");this.cfg.selected=parseInt(this.stateHolder.val());this.onshowHandlers=this.onshowHandlers||{};this.initGrid();this.bindEvents();if(this.cfg.dynamic&&this.cfg.cache){this.markAsLoaded(this.panelContainer.children().eq(this.cfg.selected))}},initGrid:function(){var b=this.headers.length;this.navContainer.addClass("ui-grid-"+this.GRID_MAP[b.toString()]);for(var a=0;a<b;a++){this.headers.eq(a).addClass("ui-block-"+this.BLOCK_MAP[(a%5).toString()])}},bindEvents:function(){var a=this;this.headers.children("a").on("click.tabView",function(d){var c=$(this),b=c.parent().index();if(!c.hasClass("ui-state-disabled")&&(b!==a.cfg.selected)){a.select(b)}d.preventDefault()})},select:function(d,c){if(this.cfg.onTabChange&&!c){var a=this.cfg.onTabChange.call(this,d);if(a===false){return false}}var b=this.panelContainer.children().eq(d),e=this.cfg.dynamic&&!this.isLoaded(b);this.stateHolder.val(d);this.cfg.selected=d;if(e){this.loadDynamicTab(b)}else{this.show(b);if(this.hasBehavior("tabChange")&&!c){this.fireTabChangeEvent(b)}}return true},show:function(b){var d=this.headers.filter(".ui-tabs-active"),a=this.headers.eq(b.index()),c=this.panelContainer.children(":visible");c.attr("aria-hidden",true);d.attr("aria-expanded",false);b.attr("aria-hidden",false);a.attr("aria-expanded",true);d.removeClass("ui-tabs-active").children("a").removeClass("ui-btn-active");c.hide();a.addClass("ui-tabs-active").children("a").addClass("ui-btn-active");b.show();this.postTabShow(b)},fireTabChangeEvent:function(a){var c=this.cfg.behaviors.tabChange,b={params:[{name:this.id+"_newTab",value:a.attr("id")},{name:this.id+"_tabindex",value:a.index()}]};c.call(this,b)},loadDynamicTab:function(a){var d=this,c=a.index(),b={source:this.id,process:this.id,update:this.id,params:[{name:this.id+"_contentLoad",value:true},{name:this.id+"_newTab",value:a.attr("id")},{name:this.id+"_tabindex",value:c}],onsuccess:function(g,e,f){PrimeFaces.ajax.Response.handle(g,e,f,{widget:d,handle:function(h){a.children("p").html(h);if(this.cfg.cache){this.markAsLoaded(a)}}});return true},oncomplete:function(){d.show(a)}};if(this.hasBehavior("tabChange")){this.cfg.behaviors.tabChange.call(this,b)}else{PrimeFaces.ajax.Request.handle(b)}},postTabShow:function(a){if(this.cfg.onTabShow){this.cfg.onTabShow.call(this,a.index())}for(var c in this.onshowHandlers){if(this.onshowHandlers.hasOwnProperty(c)){var b=this.onshowHandlers[c];if(b.call()){delete this.onshowHandlers[c]}}}},hasBehavior:function(a){if(this.cfg.behaviors){return this.cfg.behaviors[a]!==undefined}return false},markAsLoaded:function(a){a.data("loaded",true)},isLoaded:function(a){return a.data("loaded")===true}});