There is some weird code in the tree renderer that I saw when I was
trying to customize my own tree. In your case the weird code is a bug
(I didn't look to far into this and am going from memory, so I may be
mistaken). The code is something like:

for (int i = 0; i < node.getChildrenCount(); i++)
{
 if (treeWalker.next())
   ...
}

if you look at the code you will see the for loop is completely
useless, all that is needed is the treeWalker.next() call. Check out
the source for:

org.apache.myfaces.custom.tree2.HtmlTreeRenderer.encodeTree()

If you have debugging set up, debug through that method.

What is probably happening is that your children count is returning 1
but the walker skips it because it is a leaf node and the state may
become invalid at that point.

As a work-around, return "true" for isLeaf and "0" for
getChildrenCount() to make sure your child node is not rendered.

On 1/2/07, kal stevens <[EMAIL PROTECTED]> wrote:
I was wondering if this is valid or if I am doing something wrong here.

I have a node, that has children, but I don't want those children to be
displayed in some situations.

So in those situations I return true in isLeaf()

When this happens It displays the tree with the bottom elements chopped off.

So lets say I have a tree with 3 elements

1  Node 1 (is a leaf)
2  Node 2 is a child of Node 1 and should not be displayed
3  Node 3 is any node at the same level as Node 1

Then Node 3 is not displayed.

I am using myfaces 1.1.13

I was going to look through the bug forum, but I could not figure out how to
search through it.

Thanks


Reply via email to