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 254560 - OutlineView collapses children of reordered nodes (after drag/drop, MoveUp/ModeDown, or Reorder)
Summary: OutlineView collapses children of reordered nodes (after drag/drop, MoveUp/Mo...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 8.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-20 16:29 UTC by matvei
Modified: 2015-09-29 01:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample project demonstrating this problem. (28.86 KB, application/zip)
2015-08-20 16:29 UTC, matvei
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matvei 2015-08-20 16:29:15 UTC
Created attachment 155498 [details]
Sample project demonstrating this problem.

Steps to reproduce:
1. Have a tree of nodes that support dragging and have some children
2. Present the nodes in an OutlineView
3. Expand some nodes
4. Cause nodes to be reordered (by dragging/dropping, by using MoveUp/MoveDown actions, or by using Reorder action)
5. Observe that all reordered nodes will collapse their children.

Note that BeanTreeView would not collapse nodes in this situation -- only OutlineView does.

Screen capture demonstrations:
OutlineView behavior: http://i.imgur.com/ItNS98a.gif (nodes collapse)
BeanTreeView behavior: http://i.imgur.com/k2cDCGY.gif (behaves as expected)

Attached project is based on this drag-and-drop sample code: https://java.net/projects/nb-api-samples/sources/api-samples/show/versions/7.1/misc/DragDrop (itself based on Geertjan's drag-and-drop example: https://blogs.oracle.com/geertjan/entry/node_cut_copy_paste_delete )

I was able to reproduce this problem with NetBeans Platform 8.1 Beta (Build 201508041349) and NetBeans Platform 8.0.2 (Build 201411181905).

Additional system information:
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b15
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (customer)
Comment 1 Martin Entlicher 2015-09-25 17:36:47 UTC
VariableHeightLayoutCache in response to treeStructureChanged() removes and re-creates nodes in D&D 2 folder. The expansion state is lost this way.

EventBroadcaster.treeStructureChanged() mentions a necessity to dump info about the existing tree structure, but does not do anything like that.
It looks like TreePathSupport was intended to be responsible for that.
Comment 2 Martin Entlicher 2015-09-28 08:43:46 UTC
Fixed by changeset:   292667:41e0e072b563
http://hg.netbeans.org/core-main/rev/41e0e072b563
Comment 3 Quality Engineering 2015-09-29 01:18:53 UTC
Integrated into 'main-silver', will be available in build *201509290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/41e0e072b563
User: mentlicher@netbeans.org
Log: #254560: Copy the expansion state of the structurally changed tree.