Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / src / widgets / Toolbar.js
index 9745710..f29394a 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -187,7 +187,7 @@ Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, {
     clearMenu : function(){\r
         var m = this.moreMenu;\r
         if(m && m.items){\r
-            this.moreMenu.items.each(function(item){\r
+            m.items.each(function(item){\r
                 delete item.menu;\r
             });\r
         }\r
@@ -230,6 +230,7 @@ Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, {
                     scope: this\r
                 }\r
             });\r
+            this.moreMenu.ownerCt = this.container;\r
             this.more = new Ext.Button({\r
                 iconCls: 'x-toolbar-more-icon',\r
                 cls: 'x-toolbar-more',\r
@@ -367,6 +368,15 @@ Ext.extend(T, Ext.Container, {
 \r
     defaultType: 'button',\r
 \r
+    /**\r
+     * @cfg {String/Object} layout\r
+     * This class assigns a default layout (<code>layout:'<b>toolbar</b>'</code>).\r
+     * Developers <i>may</i> override this configuration option if another layout\r
+     * is required (the constructor must be passed a configuration object in this\r
+     * case instead of an array).\r
+     * See {@link Ext.Container#layout} for additional information.\r
+     */\r
+\r
     trackMenus : true,\r
     internalDefaults: {removeMode: 'container', hideParent: true},\r
     toolbarCls: 'x-toolbar',\r
@@ -392,12 +402,14 @@ Ext.extend(T, Ext.Container, {
                 };\r
             }\r
             this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);\r
+            Ext.Toolbar.superclass.onRender.apply(this, arguments);\r
         }\r
     },\r
 \r
     /**\r
-     * Adds element(s) to the toolbar -- this function takes a variable number of\r
-     * arguments of mixed type and adds them to the toolbar.\r
+     * <p>Adds element(s) to the toolbar -- this function takes a variable number of\r
+     * arguments of mixed type and adds them to the toolbar.</p>\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Mixed} arg1 The following types of arguments are all valid:<br />\r
      * <ul>\r
      * <li>{@link Ext.Button} config: A valid button config object (equivalent to {@link #addButton})</li>\r
@@ -464,6 +476,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Adds a separator\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @return {Ext.Toolbar.Item} The separator {@link Ext.Toolbar.Item item}\r
      */\r
     addSeparator : function(){\r
@@ -472,6 +485,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Adds a spacer element\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @return {Ext.Toolbar.Spacer} The spacer item\r
      */\r
     addSpacer : function(){\r
@@ -480,6 +494,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Forces subsequent additions into the float:right toolbar\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      */\r
     addFill : function(){\r
         this.add(new T.Fill());\r
@@ -487,6 +502,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Adds any standard HTML element to the toolbar\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Mixed} el The element or id of the element to add\r
      * @return {Ext.Toolbar.Item} The element's item\r
      */\r
@@ -496,15 +512,17 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Adds any Toolbar.Item or subclass\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Ext.Toolbar.Item} item\r
      * @return {Ext.Toolbar.Item} The item\r
      */\r
     addItem : function(item){\r
-        return Ext.Toolbar.superclass.add.apply(this, arguments);\r
+        return this.add.apply(this, arguments);\r
     },\r
 \r
     /**\r
      * Adds a button (or buttons). See {@link Ext.Button} for more info on the config.\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Object/Array} config A button config or array of configs\r
      * @return {Ext.Button/Array}\r
      */\r
@@ -521,6 +539,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Adds text to the toolbar\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {String} text The text to add\r
      * @return {Ext.Toolbar.Item} The element's item\r
      */\r
@@ -530,6 +549,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Object} config\r
      * @return {Ext.Toolbar.Item} The element's item\r
      */\r
@@ -540,6 +560,7 @@ Ext.extend(T, Ext.Container, {
     /**\r
      * Adds a dynamically rendered Ext.form field (TextField, ComboBox, etc). Note: the field should not have\r
      * been rendered yet. For a field that has already been rendered, use {@link #addElement}.\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Ext.form.Field} field\r
      * @return {Ext.Toolbar.Item}\r
      */\r
@@ -549,6 +570,7 @@ Ext.extend(T, Ext.Container, {
 \r
     /**\r
      * Inserts any {@link Ext.Toolbar.Item}/{@link Ext.Button} at the specified index.\r
+     * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>\r
      * @param {Number} index The index where the item is to be inserted\r
      * @param {Object/Ext.Toolbar.Item/Ext.Button/Array} item The button, or button config object to be\r
      * inserted, or an array of buttons/configs.\r
@@ -750,23 +772,29 @@ new Ext.Panel({
  * @xtype tbtext\r
  */\r
 T.TextItem = Ext.extend(T.Item, {\r
+    /**\r
+     * @cfg {String} text The text to be used as innerHTML (html tags are accepted)\r
+     */ \r
+\r
     constructor: function(config){\r
-        if (Ext.isString(config)) {\r
-            config = { autoEl: {cls: 'xtb-text', html: config }};\r
-        } else {\r
-            config.autoEl = {cls: 'xtb-text', html: config.text || ''};\r
-        }\r
-        T.TextItem.superclass.constructor.call(this, config);\r
+        T.TextItem.superclass.constructor.call(this, Ext.isString(config) ? {text: config} : config);\r
+    },\r
+    \r
+    // private\r
+    onRender : function(ct, position) {\r
+        this.autoEl = {cls: 'xtb-text', html: this.text || ''};\r
+        T.TextItem.superclass.onRender.call(this, ct, position);\r
     },\r
+    \r
     /**\r
      * Updates this item's text, setting the text to be used as innerHTML.\r
      * @param {String} t The text to display (html accepted).\r
      */\r
     setText : function(t) {\r
-        if (this.rendered) {\r
-            this.el.dom.innerHTML = t;\r
-        } else {\r
-            this.autoEl.html = t;\r
+        if(this.rendered){\r
+            this.el.update(t);\r
+        }else{\r
+            this.text = t;\r
         }\r
     }\r
 });\r