9 * @class Roo.bootstrap.NavProgressBar
10 * @extends Roo.bootstrap.Component
11 * Bootstrap NavProgressBar class
14 * Create a new nav progress bar
15 * @param {Object} config The config object
18 Roo.bootstrap.NavProgressBar = function(config){
19 Roo.bootstrap.NavProgressBar.superclass.constructor.call(this, config);
21 this.bullets = this.bullets || [];
23 // Roo.bootstrap.NavProgressBar.register(this);
27 * Fires when the active item changes
28 * @param {Roo.bootstrap.NavProgressBar} this
29 * @param {Roo.bootstrap.NavProgressItem} selected The item selected
30 * @param {Roo.bootstrap.NavProgressItem} prev The previously selected item
37 Roo.extend(Roo.bootstrap.NavProgressBar, Roo.bootstrap.Component, {
43 getAutoCreate : function()
45 var cfg = Roo.apply({}, Roo.bootstrap.NavProgressBar.superclass.getAutoCreate.call(this));
49 cls: 'roo-navigation-bar'
56 onRender : function(ct, position)
58 Roo.bootstrap.NavProgressBar.superclass.onRender.call(this, ct, position);
60 if(this.bullets.length){
61 Roo.each(this.bullets, function(b){
68 addItem : function(cfg)
70 var item = new Roo.bootstrap.NavProgressItem(cfg);
72 item.parentId = this.id;
73 item.onRender(this.el, null);
75 this.barItems.push(item);
82 formatBullets : function()
84 if(!this.barItems.length){
88 var width = 100 / this.barItems.length;
90 Roo.each(this.barItems, function(i){
91 i.el.setStyle('width', width + '%');
95 setActiveItem : function(item)
98 Roo.each(this.items, function(v){
103 v.setActive(false, true);
110 item.setActive(true, true);
111 this.fireEvent('changed', this, item, prev);
116 // * sets the active Navigation item
117 // * @param {Roo.bootstrap.NavProgressItem} the new current navitem
119 // setActiveItem : function(item)
122 // Roo.each(this.items, function(v){
126 // if (v.isActive()) {
127 // v.setActive(false, true);
134 // item.setActive(true, true);
135 // this.fireEvent('changed', this, item, prev);
139 // * gets the active Navigation item
140 // * @return {Roo.bootstrap.NavProgressItem} the current navitem
142 // getActive : function()
144 // var active = false;
146 // Roo.each(this.items, function(v){
148 // if (!v.isActive()) {
160 // indexOfNav : function(item)
162 // var index = false;
164 // Roo.each(this.items, function(v,i){
178 * adds a Navigation item
179 * @param {Roo.bootstrap.NavProgressItem} the NavProgressItem to add
184 // * register a Navigation item
185 // * @param {Roo.bootstrap.NavItem} the navitem to add
187 // register : function(item)
189 // this.items.push(item);
190 // item.navId = this.navId;
195 // * clear all the Navigation item
198 // clearAll : function()
201 // this.el.dom.innerHTML = '';
204 // getNavItem: function(tabId)
207 // Roo.each(this.items, function(e) {
208 // if (e.tabId == tabId) {
218 // setActiveNext : function()
220 // var i = this.indexOfNav(this.getActive());
222 // if (i > this.items.length) {
226 // this.setActiveItem(this.items[i+1]);
229 // setActivePrev : function()
231 // var i = this.indexOfNav(this.getActive());
237 // this.setActiveItem(this.items[i-1]);
240 // clearWasActive : function(except) {
241 // Roo.each(this.items, function(e) {
242 // if (e.tabId != except.tabId && e.was_active) {
243 // e.was_active = false;
251 // getWasActive : function ()
254 // Roo.each(this.items, function(e) {
255 // if (e.was_active) {
269 //Roo.apply(Roo.bootstrap.NavProgressBar, {
273 // * register a Navigation Group
274 // * @param {Roo.bootstrap.NavGroup} the navgroup to add
276 // register : function(bar)
278 // this.groups[bar.navId] = bar;
282 // * fetch a Navigation Bar based on the navigation ID
283 // * @param {string} the nav bar to add
284 // * @returns {Roo.bootstrap.NavProgressBar} the nav bar
286 // get: function(navId)
288 // if (typeof(this.groups[navId]) == 'undefined') {
292 // return this.groups[navId] ;