X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..6746dc89c47ed01b165cc1152533605f97eb8e8d:/src/tab/Tab.js diff --git a/src/tab/Tab.js b/src/tab/Tab.js index 6ad7ba07..19a371b7 100644 --- a/src/tab/Tab.js +++ b/src/tab/Tab.js @@ -1,3 +1,17 @@ +/* + +This file is part of Ext JS 4 + +Copyright (c) 2011 Sencha Inc + +Contact: http://www.sencha.com/contact + +GNU General Public License Usage +This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. + +If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact. + +*/ /** * @author Ed Spencer * @class Ext.tab.Tab @@ -6,8 +20,6 @@ *
Represents a single Tab in a {@link Ext.tab.Panel TabPanel}. A Tab is simply a slightly customized {@link Ext.button.Button Button}, * styled to look like a tab. Tabs are optionally closable, and can also be disabled. 99% of the time you will not * need to create Tabs manually as the framework does so automatically when you use a {@link Ext.tab.Panel TabPanel}
- * - * @xtype tab */ Ext.define('Ext.tab.Tab', { extend: 'Ext.button.Button', @@ -222,7 +234,7 @@ Ext.define('Ext.tab.Tab', { tag: 'a', cls: me.baseCls + '-close-btn', href: '#', - html: me.closeText, + // html: me.closeText, // removed for EXTJSIV-1719, by rob@sencha.com title: me.closeText }).on('click', Ext.EventManager.preventDefault); // mon ??? } @@ -272,13 +284,25 @@ Ext.define('Ext.tab.Tab', { if (me.fireEvent('beforeclose', me) !== false) { if (me.tabBar) { - me.tabBar.closeTab(me); + if (me.tabBar.closeTab(me) === false) { + // beforeclose on the panel vetoed the event, stop here + return; + } + } else { + // if there's no tabbar, fire the close event + me.fireEvent('close', me); } - - me.fireEvent('close', me); } }, + /** + * Fires the close event on the tab. + * @private + */ + fireClose: function(){ + this.fireEvent('close', this); + }, + /** * @private */ @@ -325,3 +349,4 @@ Ext.define('Ext.tab.Tab', { } } }); +