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 227183 - Regression in Outline view between 7.3beta2 and 7.3 FCS
Summary: Regression in Outline view between 7.3beta2 and 7.3 FCS
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.3
Hardware: PC Linux
: P1 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords: REGRESSION
: 225477 (view as bug list)
Depends on: 218096
Blocks:
  Show dependency tree
 
Reported: 2013-03-07 20:57 UTC by Jaroslav Tulach
Modified: 2014-01-21 11:32 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test which simulates the problem (8.60 KB, patch)
2013-03-07 20:57 UTC, Jaroslav Tulach
Details | Diff
Proposed Patch (1.23 KB, patch)
2013-03-08 12:34 UTC, Jaroslav Havlin
Details | Diff
Proposed Patch Full (contains both new tests) (16.99 KB, patch)
2013-03-08 12:37 UTC, Jaroslav Havlin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2013-03-07 20:57:36 UTC
Created attachment 132353 [details]
Test which simulates the problem

A customer of NetBeans platform reported a significant regression in the way they use OutlineView (they removeColumn(0), the one with node).

At the end we tracked the regression to bug 218096. Consider the fix soon, best in one of the first patches for 7.3.
Comment 1 Jaroslav Tulach 2013-03-07 20:58:37 UTC
Regression caused by bug 218096.
Comment 2 Martin Entlicher 2013-03-08 12:17:51 UTC
Thanks for the test.
It shows that the problem is in EventBroadcaster.computeRowIndices(), which returns -1 index. As a result, the whole table is refreshed.
Refresh of the whole table clears selection, and creates default columns from model.
IMHO this is a really bad design of Swing components, that it's possible to remove a column from TableColumnModel, while the column stays a part of TableModel. TableModel.getColumnCounts() returns 2 even after the column is removed from TableColumnModel. This is IMHO a schizophrenic design and I'm not sure how this should work...

The fact that this test is bad is demonstrated by this simple program:

   private static void test() {
        TableModel tModel = new DefaultTableModel(new Object[] { "1", "2" }, 10);
        JTable t = new JTable(tModel);
        TableColumnModel cModel = t.getColumnModel();
        assert cModel.getColumnCount() == 2;
        assert tModel.getColumnCount() == 2;
        assert t.getColumnCount() == 2;
        cModel.removeColumn(cModel.getColumn(0));
        System.err.println("cc = "+cModel.getColumnCount()+", "+tModel.getColumnCount()+", "+t.getColumnCount());
        t.tableChanged(new TableModelEvent(tModel, -1));
        System.err.println("cc = "+cModel.getColumnCount()+", "+tModel.getColumnCount()+", "+t.getColumnCount());
    }

The result is:

cc = 1, 2, 1
cc = 2, 2, 2

But the bug is definitely the fact that the whole table is refreshed when a node is inserted.
Comment 3 Jaroslav Havlin 2013-03-08 12:34:22 UTC
Created attachment 132379 [details]
Proposed Patch

Thank you, Martin. Please check the attached patch. Seems to work fine, all tests pass now.
Comment 4 Jaroslav Havlin 2013-03-08 12:37:18 UTC
Created attachment 132380 [details]
Proposed Patch Full (contains both new tests)
Comment 5 Martin Entlicher 2013-03-08 13:10:35 UTC
Thanks a lot Jarda for the fix. It works fine.
Comment 6 Jaroslav Havlin 2013-03-08 13:27:02 UTC
(In reply to comment #0)
> Created attachment 132353 [details]
> Test which simulates the problem
Thank you for the test.

> Consider the fix soon, best in one of the first patches for 7.3.
CCing Marian. Please mark as candidate for the appropriate 7.3 patch.

(In reply to comment #5)
> Thanks a lot Jarda for the fix. It works fine.
Thank you for evaluation and review.
Patch applied as http://hg.netbeans.org/core-main/rev/0cd7950bad32
Comment 7 Quality Engineering 2013-03-10 01:49:29 UTC
Integrated into 'main-golden', will be available in build *201303092300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/0cd7950bad32
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #227183: Regression in Outline view between 7.3beta2 and 7.3 FCS
Comment 8 Tomas Danek 2013-03-12 16:59:34 UTC
both tests pass on my machine on recent sources.
Comment 9 Jaroslav Havlin 2013-03-13 08:13:52 UTC
Integrated into releases:

http://hg.netbeans.org/releases/rev/062a0a12fe41 (graft)
http://hg.netbeans.org/releases/rev/fb0a55846534 (spec. versions, long desc.)
Comment 10 Quality Engineering 2013-03-14 21:16:48 UTC
Integrated into 'releases', will be available in build *201303141828* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/062a0a12fe41
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #227183: Regression in Outline view between 7.3beta2 and 7.3 FCS
Comment 11 Tomas Danek 2013-03-20 13:45:13 UTC
tests pass in release73 as well.
Comment 12 Jaroslav Havlin 2014-01-21 11:32:51 UTC
*** Bug 225477 has been marked as a duplicate of this bug. ***