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)
99 Roo.each(this.barItems, function(v){
100 if (v.rid == item.rid) {
110 item.setActive(true);
112 this.fireEvent('changed', this, item, prev);
117 // * sets the active Navigation item
118 // * @param {Roo.bootstrap.NavProgressItem} the new current navitem
120 // setActiveItem : function(item)
123 // Roo.each(this.items, function(v){
127 // if (v.isActive()) {
128 // v.setActive(false, true);
135 // item.setActive(true, true);
136 // this.fireEvent('changed', this, item, prev);
140 // * gets the active Navigation item
141 // * @return {Roo.bootstrap.NavProgressItem} the current navitem
143 // getActive : function()
145 // var active = false;
147 // Roo.each(this.items, function(v){
149 // if (!v.isActive()) {
161 // indexOfNav : function(item)
163 // var index = false;
165 // Roo.each(this.items, function(v,i){
179 * adds a Navigation item
180 * @param {Roo.bootstrap.NavProgressItem} the NavProgressItem to add
185 // * register a Navigation item
186 // * @param {Roo.bootstrap.NavItem} the navitem to add
188 // register : function(item)
190 // this.items.push(item);
191 // item.navId = this.navId;
196 // * clear all the Navigation item
199 // clearAll : function()
202 // this.el.dom.innerHTML = '';
205 // getNavItem: function(tabId)
208 // Roo.each(this.items, function(e) {
209 // if (e.tabId == tabId) {
219 // setActiveNext : function()
221 // var i = this.indexOfNav(this.getActive());
223 // if (i > this.items.length) {
227 // this.setActiveItem(this.items[i+1]);
230 // setActivePrev : function()
232 // var i = this.indexOfNav(this.getActive());
238 // this.setActiveItem(this.items[i-1]);
241 // clearWasActive : function(except) {
242 // Roo.each(this.items, function(e) {
243 // if (e.tabId != except.tabId && e.was_active) {
244 // e.was_active = false;
252 // getWasActive : function ()
255 // Roo.each(this.items, function(e) {
256 // if (e.was_active) {
270 //Roo.apply(Roo.bootstrap.NavProgressBar, {
274 // * register a Navigation Group
275 // * @param {Roo.bootstrap.NavGroup} the navgroup to add
277 // register : function(bar)
279 // this.groups[bar.navId] = bar;
283 // * fetch a Navigation Bar based on the navigation ID
284 // * @param {string} the nav bar to add
285 // * @returns {Roo.bootstrap.NavProgressBar} the nav bar
287 // get: function(navId)
289 // if (typeof(this.groups[navId]) == 'undefined') {
293 // return this.groups[navId] ;