IDEMPIERE-1477 NPE on tree

This commit is contained in:
hieplq 2013-12-26 20:19:50 +07:00
parent 5a3b33d4af
commit 9f7635ac7b
1 changed files with 23 additions and 31 deletions

View File

@ -614,7 +614,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
if (gridTab.isTreeTab() && treePanel != null) { if (gridTab.isTreeTab() && treePanel != null) {
int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true); int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true);
int AD_Tree_ID_Default = MTree.getDefaultAD_Tree_ID (Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName()); int AD_Tree_ID_Default = MTree.getDefaultAD_Tree_ID (Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
if (gridTab.getRecord_ID() >= 0) {
if (AD_Tree_ID != 0) { if (AD_Tree_ID != 0) {
treePanel.initTree(AD_Tree_ID, windowNo); treePanel.initTree(AD_Tree_ID, windowNo);
Events.echoEvent(ON_DEFER_SET_SELECTED_NODE, this, null); Events.echoEvent(ON_DEFER_SET_SELECTED_NODE, this, null);
@ -622,9 +622,6 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
treePanel.initTree(AD_Tree_ID_Default, windowNo); treePanel.initTree(AD_Tree_ID_Default, windowNo);
Events.echoEvent(ON_DEFER_SET_SELECTED_NODE, this, null); Events.echoEvent(ON_DEFER_SET_SELECTED_NODE, this, null);
} }
} else {
treePanel.getTree().clear();
}
} }
if (!gridTab.isSingleRow() && !isGridView()) if (!gridTab.isSingleRow() && !isGridView())
@ -1228,8 +1225,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
if (refresh) if (refresh)
{ {
int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true); int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true);
if (gridTab.getRecord_ID()>=0)
{
if (AD_Tree_ID != 0) if (AD_Tree_ID != 0)
{ {
if (treePanel.initTree(AD_Tree_ID, windowNo)) if (treePanel.initTree(AD_Tree_ID, windowNo))
@ -1243,11 +1239,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
AD_Tree_ID = MTree.getDefaultAD_Tree_ID (Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName()); AD_Tree_ID = MTree.getDefaultAD_Tree_ID (Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
treePanel.initTree(AD_Tree_ID, windowNo); treePanel.initTree(AD_Tree_ID, windowNo);
} }
}
else
{
treePanel.getTree().clear();
}
} }
}else if(e.isInserting() && gridTab.getRecord_ID() < 0 && gridTab.getTabLevel() > 0 ) }else if(e.isInserting() && gridTab.getRecord_ID() < 0 && gridTab.getTabLevel() > 0 )