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 getActive : function()
86 Roo.each(this.barItems, function(v){
100 setActiveItem : function(item)
104 Roo.each(this.barItems, function(v){
105 if (v.rid == item.rid) {
115 item.setActive(true);
117 this.fireEvent('changed', this, item, prev);
120 getBarItem: function(rid)
124 Roo.each(this.barItems, function(e) {
136 indexOfItem : function(item)
140 Roo.each(this.barItems, function(v, i){
142 if (v.rid != item.rid) {
153 setActiveNext : function()
155 var i = this.indexOfItem(this.getActive());
157 if (i > this.items.length) {
161 this.setActiveItem(this.items[i+1]);
164 setActivePrev : function()
166 var i = this.indexOfItem(this.getActive());
172 this.setActiveItem(this.items[i-1]);
175 formatBullets : function()
177 if(!this.barItems.length){
181 var width = 100 / this.barItems.length;
183 Roo.each(this.barItems, function(i){
184 i.el.setStyle('width', width + '%');
190 // indexOfNav : function(item)
192 // var index = false;
194 // Roo.each(this.items, function(v,i){
208 * adds a Navigation item
209 * @param {Roo.bootstrap.NavProgressItem} the NavProgressItem to add
214 // * register a Navigation item
215 // * @param {Roo.bootstrap.NavItem} the navitem to add
217 // register : function(item)
219 // this.items.push(item);
220 // item.navId = this.navId;
225 // * clear all the Navigation item
228 // clearAll : function()
231 // this.el.dom.innerHTML = '';
234 // getNavItem: function(tabId)
237 // Roo.each(this.items, function(e) {
238 // if (e.tabId == tabId) {
248 // setActiveNext : function()
250 // var i = this.indexOfNav(this.getActive());
252 // if (i > this.items.length) {
256 // this.setActiveItem(this.items[i+1]);
259 // setActivePrev : function()
261 // var i = this.indexOfNav(this.getActive());
267 // this.setActiveItem(this.items[i-1]);
270 // clearWasActive : function(except) {
271 // Roo.each(this.items, function(e) {
272 // if (e.tabId != except.tabId && e.was_active) {
273 // e.was_active = false;
281 // getWasActive : function ()
284 // Roo.each(this.items, function(e) {
285 // if (e.was_active) {
299 //Roo.apply(Roo.bootstrap.NavProgressBar, {
303 // * register a Navigation Group
304 // * @param {Roo.bootstrap.NavGroup} the navgroup to add
306 // register : function(bar)
308 // this.groups[bar.navId] = bar;
312 // * fetch a Navigation Bar based on the navigation ID
313 // * @param {string} the nav bar to add
314 // * @returns {Roo.bootstrap.NavProgressBar} the nav bar
316 // get: function(navId)
318 // if (typeof(this.groups[navId]) == 'undefined') {
322 // return this.groups[navId] ;