use of org.compiere.model.MTreeNode in project adempiere by adempiere.
the class MenuPanel method generateMenu.
private void generateMenu(Treechildren treeChildren, MTreeNode mNode) {
Enumeration<?> nodeEnum = mNode.children();
while (nodeEnum.hasMoreElements()) {
MTreeNode mChildNode = (MTreeNode) nodeEnum.nextElement();
Treeitem treeitem = new Treeitem();
treeChildren.appendChild(treeitem);
treeitem.setLabel(mChildNode.getName());
treeitem.setTooltiptext(mChildNode.getDescription());
if (mChildNode.getChildCount() != 0) {
treeitem.setOpen(false);
Treechildren treeItemChildren = new Treechildren();
generateMenu(treeItemChildren, mChildNode);
if (treeItemChildren.getChildren().size() != 0)
treeitem.appendChild(treeItemChildren);
treeitem.getTreerow().addEventListener(Events.ON_CLICK, this);
} else {
treeitem.setValue(String.valueOf(mChildNode.getNode_ID()));
if (mChildNode.isReport())
treeitem.setImage(ServletFns.resolveThemeURL("~./images/mReport.png"));
else if (mChildNode.isProcess() || mChildNode.isTask())
treeitem.setImage(ServletFns.resolveThemeURL("~./images/mProcess.png"));
else if (mChildNode.isWorkFlow())
treeitem.setImage(ServletFns.resolveThemeURL("~./images/mWorkFlow.png"));
else
treeitem.setImage(ServletFns.resolveThemeURL("~./images/mWindow.png"));
// Elaine 2008/07/24
treeitem.getTreerow().setDraggable("favourite");
treeitem.getTreerow().addEventListener(Events.ON_CLICK, this);
}
}
}
use of org.compiere.model.MTreeNode in project adempiere by adempiere.
the class TreeSearchPanel method addTreeItem.
private void addTreeItem(DefaultTreeNode<?> node) {
Object data = node.getData();
if (data instanceof MTreeNode) {
MTreeNode mNode = (MTreeNode) data;
treeNodeItemMap.put(mNode.getName(), node);
}
}
use of org.compiere.model.MTreeNode in project adempiere by adempiere.
the class MenuPanel method init.
private void init() {
ctx = Env.getCtx();
int adRoleId = Env.getAD_Role_ID(ctx);
int adTreeId = getTreeId(ctx, adRoleId);
MTree mTree = new MTree(ctx, adTreeId, false, true, null);
MTreeNode rootNode = mTree.getRoot();
initComponents();
initMenu(rootNode);
pnlSearch.initialise();
}
Aggregations