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 236331 - After reading the persistence settings all the OutlineView property cells become empty
Summary: After reading the persistence settings all the OutlineView property cells bec...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: PATCH_AVAILABLE
Depends on:
Blocks:
 
Reported: 2013-09-24 15:30 UTC by thedavero
Modified: 2015-04-08 07:32 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NetBeans RPC project to reproduce this persistence bug (19.19 KB, application/octet-stream)
2013-09-24 15:30 UTC, thedavero
Details
Possible fix and a test case (7.70 KB, patch)
2014-01-09 13:19 UTC, Jaroslav Havlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description thedavero 2013-09-24 15:30:25 UTC
Created attachment 140418 [details]
NetBeans RPC project to reproduce this persistence bug

If the property columns have different names than their display names, which is quite usual, then, upon reading the persisted settings, the property values can no longer be identified due to dropping the initial properties and recreating them using the display name for the programmatic name. This happens in the method OutlineView.OutlineViewOutline.setColumnModel(TableColumnModel columnModel):
....
for (int ic = 1; ic < cc; ic++) {
                    TableColumn column = columnModel.getColumn(ic);
                    String name = column.getHeaderValue().toString();
                    properties[ic - 1] = new PrototypeProperty(name, name);
                }

The previous properties are then dropped and when the nodes will be created and their property sheet will use the programmatic name the association can no longer by satisfied hence all the property cell except the node column ones are empty.

Attached is a mini project based on https://blogs.oracle.com/geertjan/entry/simple_example_for_an_outlineview which can be used to replicate this behavior. Open the application and then Window/DemoTopComponent, then close the application, and reopen it.

If we modify the column header to match the property's programmatic name, that is in ro.edulib.tests.ovp.DemoTopComponent we modify:
    ov.setPropertyColumns(
            "city", "City",
            "age", "Age",
            "married", "Married");
into
    ov.setPropertyColumns(
            "city", "city",
            "age", "age",
            "married", "married");

and then empty the user's directory, the persistence will correctly work and the data is shown. However the header value is no longer what an end-user expects.

As a note the OutlineView persistence correctly worked up to and including NetBeans 7.1, and currently both in 7.3/7.4 RC1 and the very last night build, 201309240002, it doesn't.
Comment 1 arittner 2013-11-20 16:43:14 UTC
I've the same problem. 

Setting up the model with the setPropert* methods shows the node properties in the OutlineView. But loading the model ui settings via readSettings drops the node-property support. All cells are empty. 

IMHO the PropertiesNodeModel (in OutlineView) is not in sync with the ETableColumnModel
Comment 2 Jaroslav Havlin 2014-01-09 13:19:47 UTC
Created attachment 143749 [details]
Possible fix and a test case

Martin, please check the patch. Thank you.
Comment 3 Martin Entlicher 2014-02-05 15:32:33 UTC
The patch looks fine, thanks.
Comment 4 Jaroslav Havlin 2014-02-06 06:58:33 UTC
(In reply to Martin Entlicher from comment #3)
> The patch looks fine, thanks.
Thanks for the review, Martin.

Patch applied as http://hg.netbeans.org/core-main/rev/3799915ad343

Thank you for reporting.
Comment 5 Quality Engineering 2014-02-07 02:40:37 UTC
Integrated into 'main-silver', will be available in build *201402070001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3799915ad343
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #236331: After reading the persistence settings all the OutlineView property cells become empty