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 195884 - Outline.setColumnSorted(0) does not work in contrast to specification
Summary: Outline.setColumnSorted(0) does not work in contrast to specification
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 7.0
Hardware: Other Linux
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-23 18:06 UTC by Jaroslav Tulach
Modified: 2011-03-04 05:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
0 shall remove the EColumn from sorted list (1018 bytes, patch)
2011-02-23 18:06 UTC, Jaroslav Tulach
Details | Diff
Modified test that I've used to verify the sorting functionality. (4.12 KB, patch)
2011-03-03 15:33 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2011-02-23 18:06:48 UTC
Created attachment 106355 [details]
0 shall remove the EColumn from sorted list

First and foremost: what is the right way to sort outline view columns programaticaly? There is ETableColumn.setRank, setAscending, etc. just calling those has no meaning! Some of the methods there are deprecated, but they don't point to the proper way to do it.

At the end we ended up with
outlineView.getOutline().getColumnModel().clearSortedColumns();
outlineView.getOutline().getColumnModel().setColumnSorted(...);
outlineView.getOutline().tableChanged(new TableModelEvent(getModel(), 0, getModel().getRowCount()));
c'mon! Do you really mean this is the proper usage? If not, please change javadoc of these methods to point to the right method to use, thanks!

In addition to that I am attaching patch showing that the behaviour of the uses the API according to javadoc and generates java.lang.IndexOutOfBoundsException. I am making the bug P2 for violation of the API contract, but the fix of the documentation would be welcomed too.
Comment 1 Martin Entlicher 2011-03-03 15:32:05 UTC
The correct approach is to use ETable.setColumnSorted().

I've adjusted the documentation of ETable.setColumnSorted() and ETableColumnModel.setColumnSorted(). Also, I've fixed the IndexOutOfBoundsException and refresh of the UI.

Fixed by changeset:   189979:511ceb053bf2
http://hg.netbeans.org/main/rev/511ceb053bf2
Comment 2 Martin Entlicher 2011-03-03 15:33:20 UTC
Created attachment 106658 [details]
Modified test that I've used to verify the sorting functionality.
Comment 3 Quality Engineering 2011-03-04 05:43:07 UTC
Integrated into 'main-golden', will be available in build *201103040000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/511ceb053bf2
User: mentlicher@netbeans.org
Log: #195884 Make the setColumnSorted() method to work properly.