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 157466

Summary: html navigator tree expansion inaccurate
Product: editor Reporter: phazei <phazei>
Component: CSL (API & infrastructure)Assignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED FIXED    
Severity: blocker CC: jkovalsky, lujop, mfukala
Priority: P3 Keywords: NETFIX
Version: 6.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Proposed patch

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
reproducible
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!

[1] http://wiki.netbeans.org/NetFIXIssues
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
http://hg.netbeans.org/jet-main/rev/a8467d01a39f

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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a8467d01a39f
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #157466: applying lujop's patch fixing navigator nodes