use of org.adempiere.webui.panel.ADSortTab in project adempiere by adempiere.
the class AbstractADTab method prepareContext.
private void prepareContext(int newIndex, IADTabPanel newTab) {
//update context
if (newTab != null && (adWindowPanel == null || !adWindowPanel.isEmbedded())) {
List<Integer> parents = new ArrayList<Integer>();
//get parent list
if (newIndex > 0) {
int currentLevel = newTab.getTabLevel();
for (int i = newIndex - 1; i >= 0; i--) {
IADTabPanel adtab = tabPanelList.get(i);
if (adtab.getGridTab() == null)
continue;
if (adtab instanceof ADSortTab)
continue;
if (adtab.getTabLevel() < currentLevel || i == 0) {
parents.add(i);
}
}
Collections.reverse(parents);
} else {
parents.add(0);
}
//clear context
for (int i = 0; i < tabPanelList.size(); i++) {
IADTabPanel adtab = tabPanelList.get(i);
if (adtab.getGridTab() == null)
continue;
if (adtab instanceof ADSortTab)
continue;
GridField[] fields = adtab.getGridTab().getFields();
for (GridField gf : fields) {
Env.setContext(Env.getCtx(), gf.getWindowNo(), gf.getColumnName(), "");
}
}
//add parent value to context
if (!parents.isEmpty()) {
for (int i : parents) {
IADTabPanel adtab = tabPanelList.get(i);
GridField[] fields = adtab.getGridTab().getFields();
for (GridField gf : fields) {
if (// preserve value of tab above if null on current tab
gf.getValue() != null)
gf.updateContext();
}
}
}
}
}
Aggregations