(function(){"use strict";u8.Base.Widgets.TabHeader=function(e,t){$.extend(true,this,u8.Base.Widgets.TabHeader.defaults,t);this.Widget(e,t);this._tab=null;u8.services.events.bind("u8.services.tabbedBrowsing.onCurrentTabChange",this._onCurrentTabChange.bind(this),this.id);this._bindToTab($p(u8.application.getWorkWindow()).tab);this._load(this._create.bind(this))};var e="<div class='u8-tabheader-left'>{{BreadCrumbs(breadCrumbsWidget)}}</div>"+"<div class='u8-tabheader-right' style='display:none'></div>";u8.Base.Widgets.TabHeader.defaults={};u8.Base.Widgets.TabHeader.makeClass({name:"TabHeader",deriveFrom:u8.Base.Widgets.Widget});$.extend(u8.Base.Widgets.TabHeader.prototype,{dispose:function(){if(this._isDisposed){return}this._bindToTab(null);u8.services.events.unbind("u8.services.tabbedBrowsing.onCurrentTabChange",this.id);this.Widget_dispose()},update:function(e){if(!e){e={reason:"all"}}switch(e.reason){case"attr":if(e.properties.breadCrumbs){var t=this.getWidget("breadcrumbs");if(t){t.attr("items",this.breadCrumbs)}}break;default:this._create();break}return this},_load:function(e){return e()},_create:function(){this._createModel();this._createView()},_createModel:function(){this._model={breadCrumbsWidget:{parent:this,id:this.id+"_breadcrumbs",uid:this.uid,items:this.breadCrumbs}}},_createView:function(){this.empty();this.$(this.element).addClass("u8-tabheader").utml({name:"tabheader-template",template:e,data:this._model,itemOptions:{parent:this,context:this.process}},this.layout.bind(this,null))},_bindToTab:function(e){if(this._tab===e){return}this._tab=e},_onCurrentTabChange:function(e,t){this._bindToTab(e.getTab())},_onSubscribe:function(e,t){if(this._isDisposed){return}}})})();