Search in sources :

Example 6 with Treechildren

use of org.zkoss.zul.Treechildren 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 7 with Treechildren

use of org.zkoss.zul.Treechildren in project adempiere by adempiere.

the class WDeleteEntity method loadView.

/**
	 * Load View
	 * @param clientId
	 * @param tableId
	 */
private void loadView() {
    //	
    DeleteEntitiesModel data = new DeleteEntitiesModel(getClientId(), getTableId());
    //	
    tree.clear();
    if ((tree.getChildren()).size() > 1) {
        @SuppressWarnings("rawtypes") List treePreviousChild = tree.getChildren();
        tree.removeChild((Treechildren) treePreviousChild.get(1));
    }
    //	
    Treechildren rootTreeChild = new Treechildren();
    Treeitem rootTreeItem = new Treeitem();
    rootTreeItem.setValue(data);
    rootTreeItem.setLabel(data.toString());
    Treechildren rootTreeItemChild = new Treechildren();
    createNodes(data, rootTreeItemChild);
    rootTreeItem.appendChild(rootTreeItemChild);
    rootTreeChild.appendChild(rootTreeItem);
    tree.appendChild(rootTreeChild);
}
Also used : Treeitem(org.zkoss.zul.Treeitem) DeleteEntitiesModel(org.adempiere.util.DeleteEntitiesModel) Treechildren(org.zkoss.zul.Treechildren) ArrayList(java.util.ArrayList) List(java.util.List)

Example 8 with Treechildren

use of org.zkoss.zul.Treechildren in project adempiere by adempiere.

the class TreeUtils method traverse.

/**
	 * Traverse treechildren and execution action on Treeitem
	 * @param treechildren
	 * @param action
	 */
public static void traverse(Treechildren treechildren, TreeItemAction action) {
    List<?> list = treechildren.getChildren();
    for (int index = 0; index < list.size(); index++) {
        Object o = list.get(index);
        if (o instanceof Treechildren) {
            Treechildren treechild = (Treechildren) o;
            traverse(treechild, action);
        } else if (o instanceof Treeitem) {
            Treeitem treeitem = (Treeitem) o;
            action.run(treeitem);
            List<?> treeitemChildren = treeitem.getChildren();
            for (int childIndex = 0; childIndex < treeitemChildren.size(); childIndex++) {
                Object child = treeitemChildren.get(childIndex);
                if (child instanceof Treechildren) {
                    Treechildren treechild = (Treechildren) child;
                    traverse(treechild, action);
                }
            }
        }
    }
}
Also used : Treeitem(org.zkoss.zul.Treeitem) Treechildren(org.zkoss.zul.Treechildren) List(java.util.List)

Example 9 with Treechildren

use of org.zkoss.zul.Treechildren in project adempiere by adempiere.

the class TreeUtils method traverse.

/**
	 * Traverse tree and execution action on Treeitem
	 * @param tree
	 * @param action
	 */
public static void traverse(Tree tree, TreeItemAction action) {
    Treechildren treechildren = tree.getTreechildren();
    traverse(treechildren, action);
}
Also used : Treechildren(org.zkoss.zul.Treechildren)

Aggregations

Treechildren (org.zkoss.zul.Treechildren)9 Treeitem (org.zkoss.zul.Treeitem)7 DeleteEntitiesModel (org.adempiere.util.DeleteEntitiesModel)4 List (java.util.List)3 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 HashSet (java.util.HashSet)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 MTable (org.compiere.model.MTable)1 MTreeNode (org.compiere.model.MTreeNode)1 Treecol (org.zkoss.zul.Treecol)1 Treecols (org.zkoss.zul.Treecols)1