Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 157466 - html navigator tree expansion inaccurate
html navigator tree expansion inaccurate
Product: editor
Classification: Unclassified
Component: CSL (API & infrastructure)
PC All
: P3 (vote)
: 6.x
Assigned To: Vitezslav Stejskal
Depends on:
  Show dependency treegraph
Reported: 2009-01-26 23:00 UTC by phazei
Modified: 2010-04-09 04:43 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT

Proposed patch (2.44 KB, patch)
2010-03-31 21:43 UTC, lujop
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description phazei 2009-01-26 23:00:57 UTC
When expanding the html navigator tree, all tags have an expansion "+" next to them, weather they can expand or not. 
Only tags that have children should have a "+" next to them to expand.

Once a tag is clicked, the "+" goes away if it isn't expandable, but this doesn't allow for visual distinction of what
elements have children.

Tested in NB PHP 6.5 and 7M1 on WinXP.
Comment 1 Marek Fukala 2009-10-22 13:05:04 UTC
Comment 2 Marek Fukala 2009-11-05 09:30:20 UTC
The StructureItem.isLeaf() method must always return false for html items. See the code comment below for clarification. 

I belive this needs to be fixed in CSL somehow, maybe the proposed way.

HtmlStructureScanner$HtmlStructureItem.isLeaf() {
            //potentialy incorrect workaround for ElementNode.updateRecursively(StructureItem) method.
            //If the StructureItem says it is a leaf then if a new node is created inside
            //the navigator representation - ElementNode still holds empty children list 
            //which is not an instance of ElementChildren and then the subnodes are not refreshed.
            //possible fix would be to modify the ElementNode constructor to always create 
            //ElementChildren even if the node is a leaf, but I am not sure whether it may 
            //have some bad influence on other things.
            return false;
            //return handle.node().children().isEmpty();

Comment 3 Jiri Kovalsky 2010-03-26 14:47:50 UTC
This issue was added to the list of NetFIX [1] candidates. If module owner does not agree, please speak up. Thanks!

Comment 4 Jiri Kovalsky 2010-03-31 16:37:35 UTC
Vita Stejskal is willing to review & integrate possible patch if you manage to fix this issue. Good luck Joan!
Comment 5 lujop 2010-03-31 21:43:04 UTC
Created attachment 96483 [details]
Proposed patch

I attach my proposed patch.
My approach is that isLeaf() return only true when the node is really a leaf. That is: when the node has no tags inside it (text inside tag is ok).

Then to solve the update problem in CSL module I convert the Children.LEAF to ElementChildren if it's needed beacause a node that was a Leaf now it isn't.

I have tested it manually and it works. I hope that the patch doesn't break any invariants that I'm not aware of.
Comment 6 Jiri Kovalsky 2010-04-01 06:29:31 UTC
Vito, can you please review the patch and provide your comments? Thanks!
Comment 7 Marek Fukala 2010-04-02 09:41:09 UTC
The patch looks ok to me. Thanks.
Comment 8 Vitezslav Stejskal 2010-04-07 13:16:58 UTC

Thanks for the patch!
Comment 9 Jiri Kovalsky 2010-04-07 13:21:53 UTC
Excellent, thanks Vito and especially thanks to Joan for his patch!
Comment 10 Quality Engineering 2010-04-09 04:43:29 UTC
Integrated into 'main-golden', will be available in build *201004090201* on (upload may still be in progress)
User: Vita Stejskal <>
Log: #157466: applying lujop's patch fixing navigator nodes

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo