セッション復元時にツリーが壊れることがあったのを修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1615 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-11-23 21:34:43 +00:00
parent 905dd6369f
commit dd18b16982

View File

@ -1106,13 +1106,22 @@ TreeStyleTabBrowser.prototype = {
id += 'd'; id += 'd';
} }
if (!isDuplicated) {
/* If it has a parent, it is wrongly attacched by tab moving /* If it has a parent, it is wrongly attacched by tab moving
on restoring. Restoring the old ID (the next statement) on restoring. Restoring the old ID (the next statement)
breaks the children list of the temporary parent and causes breaks the children list of the temporary parent and causes
many problems. So, to prevent these problems, I part the tab many problems. So, to prevent these problems, I part the tab
from the temporary parent manually. */ from the temporary parent manually. */
if (!isDuplicated && this.getParentTab(tab))
this.partTab(tab); this.partTab(tab);
/* reset attributes before restoring */
tab.removeAttribute(this.kID);
tab.removeAttribute(this.kPARENT);
tab.removeAttribute(this.kCHILDREN);
tab.removeAttribute(this.kSUBTREE_COLLAPSED);
tab.removeAttribute(this.kCOLLAPSED);
tab.removeAttribute(this.kNEST);
this.updateTabsIndent([tab]);
}
this.setTabValue(tab, this.kID, id); this.setTabValue(tab, this.kID, id);
@ -1161,7 +1170,9 @@ TreeStyleTabBrowser.prototype = {
if (!parent && (before = this.getTabById(before))) { if (!parent && (before = this.getTabById(before))) {
var index = before._tPos; var index = before._tPos;
if (index > tab._tPos) index--; if (index > tab._tPos) index--;
// b.treeStyleTab.internallyTabMoving = true;
b.moveTabTo(tab, index); b.moveTabTo(tab, index);
// b.treeStyleTab.internallyTabMoving = false;
} }
this.deleteTabValue(tab, this.kINSERT_BEFORE); this.deleteTabValue(tab, this.kINSERT_BEFORE);