Search in sources :

Example 36 with MTreeNode

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);
        }
    }
}
Also used : MTreeNode(org.compiere.model.MTreeNode) Treeitem(org.zkoss.zul.Treeitem) Treechildren(org.zkoss.zul.Treechildren)

Example 37 with MTreeNode

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);
    }
}
Also used : MTreeNode(org.compiere.model.MTreeNode)

Example 38 with MTreeNode

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();
}
Also used : MTreeNode(org.compiere.model.MTreeNode) MTree(org.compiere.model.MTree)

Aggregations

MTreeNode (org.compiere.model.MTreeNode)38 MTree (org.compiere.model.MTree)9 DefaultTreeNode (org.zkoss.zul.DefaultTreeNode)8 Treeitem (org.zkoss.zul.Treeitem)7 JTree (javax.swing.JTree)5 ArrayList (java.util.ArrayList)4 Enumeration (java.util.Enumeration)4 TreePath (javax.swing.tree.TreePath)4 MContainer (org.compiere.model.MContainer)3 BorderLayout (java.awt.BorderLayout)2 JButton (javax.swing.JButton)2 JToolBar (javax.swing.JToolBar)2 AdempiereTaskPaneUI (org.adempiere.plaf.AdempiereTaskPaneUI)2 SimpleTreeModel (org.adempiere.webui.component.SimpleTreeModel)2 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)2 org.apache.ecs.xhtml.body (org.apache.ecs.xhtml.body)2 org.apache.ecs.xhtml.head (org.apache.ecs.xhtml.head)2 org.apache.ecs.xhtml.link (org.apache.ecs.xhtml.link)2 MCStage (org.compiere.model.MCStage)2 JXTaskPane (org.jdesktop.swingx.JXTaskPane)2