at the same time isLeaf() && treeNode.getChildCount() == 0 should be synonymous.
On 1/2/07, kal stevens <[EMAIL PROTECTED]> wrote:
Thank you, I will write a test case. I guess my question can be boiled down to this. Is it true or false that If treeNode.isLeaf() == true ==> treeNode.getChildren() / treeNode.getChildCount() should never be called? It seems like that should be an invariant. Thanks for the links, I will be back with a test case On 1/2/07, Paul Spencer < [EMAIL PROTECTED]> wrote: > I suggest creating a test case. A test case is a good way to prove the bug exist and verify when > it has been fixed, in addition to getting a commiter's attention. In this case simply add the > test to HtmlTreeRendererTest[1]. Feel free to look at the component test [2] for more examples. > If the test require "user interaction" then I a Selenium based test may be appropriate [3][4]. See the current > set of Selenium test[5][6]. > > Paul Spencer > > [1] http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/custom/tree2/HtmlTreeRendererTest.java?view=markup > [2] http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/component/html/ext/ > [3] http://myfaces.apache.org/tomahawk/testing/selenium.html > [4] http://wiki.apache.org/myfaces/Automated_Testing?highlight=%28selenium%29 > [5] http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/test/selenium/ > [6] http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/testSuite/ > > > William Huang wrote: > > I would say, is a bug if you configured server side toggle, if configured > > as client-side toggle, is not a bug. IMO.. > > > > Awhile back, I configure the tree to be serverside toggle, for all the > > nodes that have children, I loaded with one dummy child noe, and when the > > user click on the expend node, then I would remove the dummy child and load > > the actual children. > > > > Bill > > > > > > "kal stevens" > > <[EMAIL PROTECTED] > > .com> To > > "MyFaces Discussion" > > 01/02/2007 04:28 <[email protected]> > > PM cc > > > > Subject > > Please respond to Re: tree2 problem with isLeaf() = > > "MyFaces true but getChildren().size > 0 > > Discussion" > > <[EMAIL PROTECTED] > > ache.org> > > > > > > > > > > > > > > > > I also need to return a new list of children with size = 0 > > This just seemed like a horrible hack. > > And I was just wondering if it was supposed to work like this or if this is > > a bug? > > > > Does anyone know how I can get the source to the core library 1.1.13? > > My coworker used that version but did not get the source. > > > > thanks > > > > On 1/2/07, Andrew Robinson < [EMAIL PROTECTED]> wrote: > > 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 > > > > > > > > > > Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you. > > > > > >

