sync
[roojs1] / Roo / bootstrap / dash / TabPane.js
index 7543acd..ebf6472 100644 (file)
@@ -1,65 +1,80 @@
 /*
  * - LGPL
  *
- * nav group
+ * Tab pane
  * 
  */
-
+Roo.bootstrap.dash = Roo.bootstrap.dash || {};
 /**
- * @class Roo.bootstrap.NavGroup
+ * @class Roo.bootstrap.TabPane
  * @extends Roo.bootstrap.Component
- * Bootstrap NavGroup class
- * @cfg {String} align left | right
- * @cfg {Boolean} inverse false | true
- * @cfg {String} type (nav|pills|tab) default nav
- * @cfg {String} navId - reference Id for navbar.
+ * @children  Roo.bootstrap.Graph Roo.bootstrap.Column
+ * Bootstrap TabPane class
+ * @cfg {Boolean} active (false | true) Default false
+ * @cfg {String} title title of panel
 
  * 
  * @constructor
- * Create a new nav group
+ * Create a new TabPane
  * @param {Object} config The config object
  */
-Roo.bootstrap.dash = Roo.bootstrap.dash || {};
+
 Roo.bootstrap.dash.TabPane = function(config){
     Roo.bootstrap.dash.TabPane.superclass.constructor.call(this, config);
     
-    //Roo.bootstrap.NavGroup.register(this);
-     this.addEvents({
+    this.addEvents({
+        // raw events
         /**
-            * @event changed
-            * Fires when the active item changes
-            * @param {Roo.bootstrap.NavGroup} this
-            * @param {Roo.bootstrap.Navbar.Item} item The item selected
-            * @param {Roo.bootstrap.Navbar.Item} item The previously selected item 
+         * @event activate
+         * When a pane is activated
+         * @param {Roo.bootstrap.dash.TabPane} pane
          */
-        //'changed': true
-     });
-    
+        "activate" : true
+         
+    });
 };
 
 Roo.extend(Roo.bootstrap.dash.TabPane, Roo.bootstrap.Component,  {
     
-    //text: '',
-    // inverse: false,
-    // form: false,
-    // type: 'nav',
-    // navId : '',
-    // private
+    active : false,
+    title : '',
     
-  
-    getAutoCreate : function()
+    // the tabBox that this is attached to.
+    tab : false,
+     
+    getAutoCreate : function() 
     {
-        
-        Roo.log(this);
-        cfg = {
+        var cfg = {
             tag: 'div',
-            cls: 'tab-content no-padding',
-            html: null
+            cls: 'tab-pane'
+        };
+        
+        if(this.active){
+            cfg.cls += ' active';
         }
-          
         
         return cfg;
     },
+    initEvents  : function()
+    {
+        //Roo.log('trigger add pane handler');
+        this.parent().fireEvent('addpane', this)
+    },
+    
+     /**
+     * Updates the tab title 
+     * @param {String} html to set the title to.
+     */
+    setTitle: function(str)
+    {
+        if (!this.tab) {
+            return;
+        }
+        this.title = str;
+        this.tab.select('a', true).first().dom.innerHTML = str;
+        
+    }
+    
     
     
 });