Fixed context management bug

This commit is contained in:
Heng Sin Low 2010-07-19 14:06:28 +08:00
parent 432b8a4183
commit eff346092a
1 changed files with 10 additions and 12 deletions

View File

@ -136,21 +136,22 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
if (newTab != null) if (newTab != null)
{ {
List<Integer> parents = new ArrayList<Integer>(); List<Integer> parents = new ArrayList<Integer>();
//get parent list //get parent list, always include first tab (0)
if (newIndex > 0) if (newIndex > 0)
{ {
int currentLevel = newTab.getTabLevel(); int currentLevel = newTab.getTabLevel();
for (int i = newIndex - 1; i >= 0; i--) for (int i = newIndex - 1; i > 0; i--)
{ {
IADTabpanel adtab = tabPanelList.get(i); IADTabpanel adtab = tabPanelList.get(i);
if (adtab.getGridTab() == null) continue; if (adtab.getGridTab() == null) continue;
if (adtab instanceof ADSortTab) continue; if (adtab instanceof ADSortTab) continue;
if (adtab.getTabLevel() < currentLevel || i == 0) if (adtab.getTabLevel() < currentLevel)
{ {
parents.add(i); parents.add(i);
currentLevel = adtab.getTabLevel(); currentLevel = adtab.getTabLevel();
} }
} }
parents.add(0);
Collections.reverse(parents); Collections.reverse(parents);
} }
else else
@ -172,8 +173,6 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
} }
//add parent value to context //add parent value to context
if (!parents.isEmpty())
{
for(int i : parents) for(int i : parents)
{ {
IADTabpanel adtab = tabPanelList.get(i); IADTabpanel adtab = tabPanelList.get(i);
@ -186,7 +185,6 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
} }
} }
} }
}
protected abstract void doTabSelectionChanged(int oldIndex, int newIndex); protected abstract void doTabSelectionChanged(int oldIndex, int newIndex);