/*!
- * Ext JS Library 3.2.0
+ * Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
Ext.ux.GroupTabPanel = Ext.extend(Ext.TabPanel, {
tabPosition: 'left',
-
+
alternateColor: false,
-
+
alternateCls: 'x-grouptabs-panel-alt',
-
+
defaultType: 'grouptab',
-
+
deferredRender: false,
-
+
activeGroup : null,
-
+
initComponent: function(){
Ext.ux.GroupTabPanel.superclass.initComponent.call(this);
);
this.elements = 'body,header';
this.stripTarget = 'header';
-
+
this.tabPosition = this.tabPosition == 'right' ? 'right' : 'left';
-
+
this.addClass('x-grouptabs-panel');
-
+
if (this.tabStyle && this.tabStyle != '') {
this.addClass('x-grouptabs-panel-' + this.tabStyle);
}
-
+
if (this.alternateColor) {
this.addClass(this.alternateCls);
}
-
+
this.on('beforeadd', function(gtp, item, index){
this.initGroup(item, index);
- });
+ });
+ this.items.each(function(item){
+ item.on('tabchange',function(item){
+ this.fireEvent('tabchange', this, item.activeTab);
+ }, this);
+ },this);
},
-
+
initEvents : function() {
this.mon(this.strip, 'mousedown', this.onStripMouseDown, this);
},
-
+
onRender: function(ct, position){
Ext.TabPanel.superclass.onRender.call(this, ct, position);
if(this.plain){
var beforeEl = (this.tabPosition=='bottom' ? this.stripWrap : null);
this.strip = new Ext.Element(this.stripWrap.dom.firstChild);
- this.header.addClass('x-grouptabs-panel-header');
- this.bwrap.addClass('x-grouptabs-bwrap');
+ this.header.addClass('x-grouptabs-panel-header');
+ this.bwrap.addClass('x-grouptabs-bwrap');
this.body.addClass('x-tab-panel-body-'+this.tabPosition + ' x-grouptabs-panel-body');
if (!this.groupTpl) {
var tt = new Ext.Template(
- '<li class="{cls}" id="{id}">',
- '<a class="x-grouptabs-expand" onclick="return false;"></a>',
+ '<li class="{cls}" id="{id}">',
+ '<a class="x-grouptabs-expand" onclick="return false;"></a>',
'<a class="x-grouptabs-text {iconCls}" href="#" onclick="return false;">',
- '<span>{text}</span></a>',
+ '<span>{text}</span></a>',
'</li>'
);
tt.disableFormats = true;
}
this.items.each(this.initGroup, this);
},
-
+
afterRender: function(){
Ext.ux.GroupTabPanel.superclass.afterRender.call(this);
-
+
this.tabJoint = Ext.fly(this.body.dom.parentNode).createChild({
cls: 'x-tab-joint'
});
-
+
this.addClass('x-tab-panel-' + this.tabPosition);
this.header.setWidth(this.tabWidth);
-
+
if (this.activeGroup !== undefined) {
var group = (typeof this.activeGroup == 'object') ? this.activeGroup : this.items.get(this.activeGroup);
delete this.activeGroup;
},
getGroupEl : Ext.TabPanel.prototype.getTabEl,
-
+
// private
findTargets: function(e){
var item = null,
el: itemEl
};
},
-
+
// private
onStripMouseDown: function(e){
if (e.button != 0) {
}
}
},
-
+
expandGroup: function(groupEl){
if(groupEl.isXType) {
groupEl = this.getGroupEl(groupEl);
}
Ext.fly(groupEl).addClass('x-grouptabs-expanded');
- this.syncTabJoint();
+ this.syncTabJoint();
},
-
+
toggleGroup: function(groupEl){
if(groupEl.isXType) {
groupEl = this.getGroupEl(groupEl);
- }
+ }
Ext.fly(groupEl).toggleClass('x-grouptabs-expanded');
- this.syncTabJoint();
- },
+ this.syncTabJoint();
+ },
collapseGroup: function(groupEl){
if(groupEl.isXType) {
groupEl = this.getGroupEl(groupEl);
}
Ext.fly(groupEl).removeClass('x-grouptabs-expanded');
- this.syncTabJoint();
+ this.syncTabJoint();
},
-
+
syncTabJoint: function(groupEl){
if (!this.tabJoint) {
return;
}
-
+
groupEl = groupEl || this.getGroupEl(this.activeGroup);
if(groupEl) {
- this.tabJoint.setHeight(Ext.fly(groupEl).getHeight() - 2);
-
+ this.tabJoint.setHeight(Ext.fly(groupEl).getHeight() - 2);
+
var y = Ext.isGecko2 ? 0 : 1;
if (this.tabPosition == 'left'){
this.tabJoint.alignTo(groupEl, 'tl-tr', [-2,y]);
}
else {
this.tabJoint.alignTo(groupEl, 'tr-tl', [1,y]);
- }
+ }
}
else {
this.tabJoint.hide();
}
},
-
+
getActiveTab : function() {
if(!this.activeGroup) return null;
- return this.activeGroup.getTabEl(this.activeGroup.activeTab) || null;
+ return this.activeGroup.getTabEl(this.activeGroup.activeTab) || null;
},
-
+
onResize: function(){
Ext.ux.GroupTabPanel.superclass.onResize.apply(this, arguments);
this.syncTabJoint();
},
-
+
createCorner: function(el, pos){
return Ext.fly(el).createChild({
cls: 'x-grouptabs-corner x-grouptabs-corner-' + pos
});
},
-
+
initGroup: function(group, index){
- var before = this.strip.dom.childNodes[index],
+ var before = this.strip.dom.childNodes[index],
p = this.getTemplateArgs(group);
if (index === 0) {
p.cls += ' x-tab-first';
}
p.cls += ' x-grouptabs-main';
p.text = group.getMainItem().title;
-
+
var el = before ? this.groupTpl.insertBefore(before, p) : this.groupTpl.append(this.strip, p),
tl = this.createCorner(el, 'top-' + this.tabPosition),
bl = this.createCorner(el, 'bottom-' + this.tabPosition);
beforetabchange: this.onGroupBeforeTabChange
});
},
-
+
setActiveGroup : function(group) {
group = this.getComponent(group);
if(!group){
var groupEl = this.getGroupEl(group);
Ext.fly(groupEl).addClass('x-grouptabs-strip-active');
-
+
this.activeGroup = group;
this.stack.add(group);
this.fireEvent('groupchange', this, group);
return true;
}
- return false;
+ return false;
},
-
+
onGroupBeforeTabChange: function(group, newTab, oldTab){
if(group !== this.activeGroup || newTab !== oldTab) {
this.strip.select('.x-grouptabs-sub > li.x-grouptabs-strip-active', true).removeClass('x-grouptabs-strip-active');
- }
+ }
this.expandGroup(this.getGroupEl(group));
if(group !== this.activeGroup) {
return this.setActiveGroup(group);
- }
+ }
},
-
+
getFrameHeight: function(){
var h = this.el.getFrameWidth('tb');
h += (this.tbar ? this.tbar.getHeight() : 0) +
(this.bbar ? this.bbar.getHeight() : 0);
-
+
return h;
},
-
+
adjustBodyWidth: function(w){
return w - this.tabWidth;
}
});
-Ext.reg('grouptabpanel', Ext.ux.GroupTabPanel);
\ No newline at end of file
+Ext.reg('grouptabpanel', Ext.ux.GroupTabPanel);