This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 97772 - Method findComponent(String expr) of Tree search only for components with level 1
Summary: Method findComponent(String expr) of Tree search only for components with lev...
Status: CLOSED WONTFIX
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Winston Prakash
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-13 18:39 UTC by Roman Mostyka
Modified: 2007-05-02 15:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2007-03-13 18:39:52 UTC
1. Create project.
2. Add Tree to the page. One node will be added by default with id "treeNode1".
3. Add new node to tree root and set id "treeNode2".
4. Add new node to previously added node and set id "treeNode3".
5. Add somewhere (for example in prerender() method) code like:

System.out.println("treeNode1=" + tree1.findComponent("treeNode1"));
System.out.println("treeNode2=" + tree1.findComponent("treeNode2"));
System.out.println("treeNode3=" + tree1.findComponent("treeNode3"));
System.out.println("treeNode2->treeNode3=" +
tree1.findComponent("treeNode2").findComponent("treeNode3"));

6. Run project.

Result: In output we get something like:
treeNode1=com.sun.rave.web.ui.component.TreeNode@6ba2ed
treeNode2=com.sun.rave.web.ui.component.TreeNode@8sdfl4
treeNode3=null
treeNode2->treeNode3=com.sun.rave.web.ui.component.TreeNode@4sdt0s

So, for tree we can find only components with level 1, we can't find components
with level 2 or higher. If we want to get components with level 2, we must
serach it in components with level 1; components with level 3, we must serach it
in components with level 2 and so on.
But if I want to find any component in tree, I want to search through whole
tree, not only through components with level 1.
Comment 1 Winston Prakash 2007-04-28 02:05:17 UTC
Isn't it by design. The node components are added to the component hierarchy.
Since node3 (a component) is added to node2 (another component), shouldn't be
expected to find in the component branch of node2, since you use
findComponent(). I think it works by deign.

If you think otherwise, please file a bug in woodstock, to get a better reply.