Search in sources :

Example 1 with TreeNodeAction

use of org.adempiere.webui.util.TreeNodeAction in project adempiere by adempiere.

the class TreeSearchPanel method refreshSearchList.

private void refreshSearchList() {
    treeNodeItemMap.clear();
    if (tree.getModel() == null) {
        TreeUtils.traverse(tree, new TreeItemAction() {

            public void run(Treeitem treeItem) {
                addTreeItem(treeItem);
            }
        });
    } else {
        TreeUtils.traverse(tree.getModel(), new TreeNodeAction() {

            public void run(DefaultTreeNode<?> treeNode) {
                addTreeItem(treeNode);
            }
        });
    }
    treeValues = new String[treeNodeItemMap.size()];
    treeDescription = new String[treeNodeItemMap.size()];
    int i = -1;
    for (Object value : treeNodeItemMap.values()) {
        i++;
        if (value instanceof Treeitem) {
            Treeitem treeItem = (Treeitem) value;
            treeValues[i] = treeItem.getLabel();
            treeDescription[i] = treeItem.getTooltiptext();
        } else if (value instanceof DefaultTreeNode) {
            DefaultTreeNode<?> sNode = (DefaultTreeNode<?>) value;
            MTreeNode mNode = (MTreeNode) sNode.getData();
            treeValues[i] = mNode.getName();
            treeDescription[i] = mNode.getDescription();
        }
    }
    cmbSearch.setDescription(treeDescription);
    cmbSearch.setDict(treeValues);
}
Also used : MTreeNode(org.compiere.model.MTreeNode) TreeItemAction(org.adempiere.webui.util.TreeItemAction) Treeitem(org.zkoss.zul.Treeitem) DefaultTreeNode(org.zkoss.zul.DefaultTreeNode) TreeNodeAction(org.adempiere.webui.util.TreeNodeAction)

Aggregations

TreeItemAction (org.adempiere.webui.util.TreeItemAction)1 TreeNodeAction (org.adempiere.webui.util.TreeNodeAction)1 MTreeNode (org.compiere.model.MTreeNode)1 DefaultTreeNode (org.zkoss.zul.DefaultTreeNode)1 Treeitem (org.zkoss.zul.Treeitem)1