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);
}
Aggregations