IDEMPIERE-787 Cannot create tree of menu.
This commit is contained in:
parent
6230ac9d40
commit
ed5fcfd04a
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
f * Product: Posterita Ajax UI *
|
* Product: Posterita Ajax UI *
|
||||||
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class ADTreeOnDropListener implements EventListener<Event> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert
|
// insert
|
||||||
treeModel.addNode(newParent, movingNode, index);
|
newParent = treeModel.addNode(newParent, movingNode, index);
|
||||||
|
|
||||||
int path[] = treeModel.getPath(movingNode);
|
int path[] = treeModel.getPath(movingNode);
|
||||||
if (TreeUtils.isOnInitRenderPosted(tree) || tree.getTreechildren() == null)
|
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(" WHERE AD_Tree_ID=").append(mTree.getAD_Tree_ID())
|
||||||
.append(" AND Node_ID=").append(md.getNode_ID());
|
.append(" AND Node_ID=").append(md.getNode_ID());
|
||||||
if (log.isLoggable(Level.FINE)) log.fine(sql.toString());
|
if (log.isLoggable(Level.FINE)) log.fine(sql.toString());
|
||||||
no = DB.executeUpdate(sql.toString(),trx.getTrxName());
|
DB.executeUpdateEx(sql.toString(),trx.getTrxName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// COMMIT *********************
|
// COMMIT *********************
|
||||||
|
@ -203,8 +203,11 @@ public class ADTreeOnDropListener implements EventListener<Event> {
|
||||||
trx.rollback();
|
trx.rollback();
|
||||||
FDialog.error(windowNo, tree, "TreeUpdateError", e.getLocalizedMessage());
|
FDialog.error(windowNo, tree, "TreeUpdateError", e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
trx.close();
|
finally
|
||||||
trx = null;
|
{
|
||||||
|
trx.close();
|
||||||
|
trx = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MenuListener implements EventListener<Event> {
|
class MenuListener implements EventListener<Event> {
|
||||||
|
|
|
@ -249,8 +249,9 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
|
||||||
* @param newParent
|
* @param newParent
|
||||||
* @param newNode
|
* @param newNode
|
||||||
* @param index
|
* @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) {
|
int index) {
|
||||||
DefaultTreeNode<Object> parent = newParent;
|
DefaultTreeNode<Object> parent = newParent;
|
||||||
if (newParent.getChildren() == null) {
|
if (newParent.getChildren() == null) {
|
||||||
|
@ -260,6 +261,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.getChildren().add(index, newNode);
|
parent.getChildren().add(index, newNode);
|
||||||
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue