cc09388d9b14471377fcca2e8f8fdfe68d190dd6
[roojs1] / Roo / bootstrap / dash / TabPane.js
1 /*
2  * - LGPL
3  *
4  * Tab pane
5  * 
6  */
7 Roo.bootstrap.dash = Roo.bootstrap.dash || {};
8 /**
9  * @class Roo.bootstrap.TabPane
10  * @extends Roo.bootstrap.Component
11  * Bootstrap TabPane class
12  * @cfg {Boolean} active (false | true) Default false
13  * @cfg {String} title title of panel
14
15  * 
16  * @constructor
17  * Create a new TabPane
18  * @param {Object} config The config object
19  */
20
21 Roo.bootstrap.dash.TabPane = function(config){
22     Roo.bootstrap.dash.TabPane.superclass.constructor.call(this, config);
23     
24     this.addEvents({
25         // raw events
26         /**
27          * @event activate
28          * When a pane is activated
29          * @param {Roo.bootstrap.dash.TabPane} pane
30          */
31         "activate" : true
32          
33     });
34 };
35
36 Roo.extend(Roo.bootstrap.dash.TabPane, Roo.bootstrap.Component,  {
37     
38     active : false,
39     title : '',
40     
41     // the tabBox that this is attached to.
42     tab : false,
43      
44     getAutoCreate : function() 
45     {
46         var cfg = {
47             tag: 'div',
48             cls: 'tab-pane'
49         };
50         
51         if(this.active){
52             cfg.cls += ' active';
53         }
54         
55         return cfg;
56     },
57     initEvents  : function()
58     {
59         //Roo.log('trigger add pane handler');
60         this.parent().fireEvent('addpane', this)
61     },
62     
63      /**
64      * Updates the tab title 
65      * @param {String} html to set the title to.
66      */
67     setTitle: function(str)
68     {
69         if (!this.tab) {
70             return;
71         }
72         this.title = str;
73         this.tab.select('a', true).first().dom.innerHTML = str;
74         
75     }
76     
77     
78     
79 });
80
81  
82
83
84