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.
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.
Regression caused by bug 218096.
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.
Created attachment 132379 [details] Proposed Patch Thank you, Martin. Please check the attached patch. Seems to work fine, all tests pass now.
Created attachment 132380 [details] Proposed Patch Full (contains both new tests)
Thanks a lot Jarda for the fix. It works fine.
(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
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
both tests pass on my machine on recent sources.
Integrated into releases: http://hg.netbeans.org/releases/rev/062a0a12fe41 (graft) http://hg.netbeans.org/releases/rev/fb0a55846534 (spec. versions, long desc.)
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
tests pass in release73 as well.
*** Bug 225477 has been marked as a duplicate of this bug. ***