new APIs: promoteTab() / demoteTab()

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5554 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-12-18 07:47:03 +00:00
parent 1681b3e2c6
commit 02973ca013

View File

@ -1158,6 +1158,40 @@ var TreeStyleTabService = {
);
},
promoteTab : function(aTab)
{
var b = this.getTabBrowserFromChild(aTab);
var sv = b.treeStyleTab;
var parent = sv.getParentTab(aTab);
if (!parent) return;
var nextSibling = sv.getNextSiblingTab(parent);
var grandParent = sv.getParentTab(parent);
if (grandParent) {
sv.attachTabTo(aTab, grandParent, {
insertBefore : nextSibling
});
}
else {
sv.partTab(aTab);
let index = nextSibling ? nextSibling._tPos : b.mTabContainer.childNodes.length ;
if (index > aTab._tPos) index--;
b.moveTabTo(aTab, index);
}
},
demoteTab : function(aTab)
{
var b = this.getTabBrowserFromChild(aTab);
var sv = b.treeStyleTab;
var previous = this.getPreviousSiblingTab(aTab);
if (previous)
sv.attachTabTo(aTab, previous);
},
/* Session Store API */
getTabValue : function(aTab, aKey)