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