Search code examples
javarichfacestreenode

Java richfaces TreeNode child count


I need a solution for my problem that i was trying to solve. I had a few cheap workarounds to achive my needs, but I hope there are better solutions.

So whats the problem?

I have an event that handles a TreeNode to a java method. The handling of this treenode depends on if it has children or not.

What I need is to get the count of those childnodes. (or maybe someone knows how to iterate trough childnodes)

basicly with the count i could make a for loop to each child (cause TreeNode got method .getChild(param))

Treenode is in org.richfaces.model; package


Solution

  • You can iterate through the childnodes, TreeNode has method getChildrenKeysIterator() for that.