IDEMPIERE-787 Cannot create tree of menu.

This commit is contained in:
Heng Sin Low 2013-03-28 10:28:43 +08:00
parent 6230ac9d40
commit ed5fcfd04a
3 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/******************************************************************************
f * Product: Posterita Ajax UI *
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *

View File

@ -145,7 +145,7 @@ public class ADTreeOnDropListener implements EventListener<Event> {
}
// insert
treeModel.addNode(newParent, movingNode, index);
newParent = treeModel.addNode(newParent, movingNode, index);
int path[] = treeModel.getPath(movingNode);
if (TreeUtils.isOnInitRenderPosted(tree) || tree.getTreechildren() == null)
@ -192,7 +192,7 @@ public class ADTreeOnDropListener implements EventListener<Event> {
.append(" WHERE AD_Tree_ID=").append(mTree.getAD_Tree_ID())
.append(" AND Node_ID=").append(md.getNode_ID());
if (log.isLoggable(Level.FINE)) log.fine(sql.toString());
no = DB.executeUpdate(sql.toString(),trx.getTrxName());
DB.executeUpdateEx(sql.toString(),trx.getTrxName());
}
}
// COMMIT *********************
@ -203,8 +203,11 @@ public class ADTreeOnDropListener implements EventListener<Event> {
trx.rollback();
FDialog.error(windowNo, tree, "TreeUpdateError", e.getLocalizedMessage());
}
trx.close();
trx = null;
finally
{
trx.close();
trx = null;
}
}
class MenuListener implements EventListener<Event> {

View File

@ -249,8 +249,9 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
* @param newParent
* @param newNode
* @param index
* @return parent node. this could be a new instance created to replace the newParent node param
*/
public void addNode(DefaultTreeNode<Object> newParent, DefaultTreeNode<Object> newNode,
public DefaultTreeNode<Object> addNode(DefaultTreeNode<Object> newParent, DefaultTreeNode<Object> newNode,
int index) {
DefaultTreeNode<Object> parent = newParent;
if (newParent.getChildren() == null) {
@ -260,6 +261,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
}
parent.getChildren().add(index, newNode);
return parent;
}
/**