Fixed tab context preparation error.

This commit is contained in:
Heng Sin Low 2011-01-19 11:10:47 +08:00
parent 1d5b1541dd
commit b81502f138
3 changed files with 15 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import java.util.List;
import org.adempiere.webui.panel.ADSortTab; import org.adempiere.webui.panel.ADSortTab;
import org.adempiere.webui.panel.ADTabpanel; import org.adempiere.webui.panel.ADTabpanel;
import org.adempiere.webui.panel.AbstractADWindowPanel;
import org.adempiere.webui.panel.IADTabpanel; import org.adempiere.webui.panel.IADTabpanel;
import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.part.AbstractUIPart;
import org.compiere.model.DataStatusEvent; import org.compiere.model.DataStatusEvent;
@ -48,6 +49,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
/** Tabs associated to this tab box */ /** Tabs associated to this tab box */
protected List<IADTabpanel> tabPanelList = new ArrayList<IADTabpanel>(); protected List<IADTabpanel> tabPanelList = new ArrayList<IADTabpanel>();
protected AbstractADWindowPanel adWindowPanel;
public AbstractADTab() public AbstractADTab()
{ {
@ -133,7 +135,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
private void prepareContext(int newIndex, IADTabpanel newTab) { private void prepareContext(int newIndex, IADTabpanel newTab) {
//update context //update context
if (newTab != null) if (newTab != null && (adWindowPanel == null || !adWindowPanel.isEmbedded()))
{ {
List<Integer> parents = new ArrayList<Integer>(); List<Integer> parents = new ArrayList<Integer>();
//get parent list, always include first tab (0) //get parent list, always include first tab (0)
@ -324,4 +326,8 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
int oldIndex = getSelectedIndex(); int oldIndex = getSelectedIndex();
updateSelectedIndex(oldIndex, newIndex); updateSelectedIndex(oldIndex, newIndex);
} }
public void setADWindowPanel(AbstractADWindowPanel abstractADWindowPanel) {
this.adWindowPanel = abstractADWindowPanel;
}
} }

View File

@ -12,6 +12,7 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import org.adempiere.webui.panel.AbstractADWindowPanel;
import org.adempiere.webui.panel.IADTabpanel; import org.adempiere.webui.panel.IADTabpanel;
import org.adempiere.webui.part.UIPart; import org.adempiere.webui.part.UIPart;
import org.compiere.model.DataStatusEvent; import org.compiere.model.DataStatusEvent;
@ -125,4 +126,10 @@ public interface IADTab extends UIPart {
* @return IADTabpanel or null if not found * @return IADTabpanel or null if not found
*/ */
public IADTabpanel findADTabpanel(GridTab gTab); public IADTabpanel findADTabpanel(GridTab gTab);
/**
*
* @param abstractADWindowPanel
*/
public void setADWindowPanel(AbstractADWindowPanel abstractADWindowPanel);
} }

View File

@ -209,6 +209,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
adTab = createADTab(); adTab = createADTab();
adTab.addSelectionEventListener(this); adTab.addSelectionEventListener(this);
adTab.setADWindowPanel(this);
return super.createPart(parent); return super.createPart(parent);
} }