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 151294

Summary: Inability to persist column sorting
Product: platform Reporter: Martin Entlicher <mentlicher>
Component: Outline&TreeTableAssignee: Jiri Rechtacek <jrechtacek>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 136658    

Description Martin Entlicher 2008-10-24 15:20:44 UTC
In TTV we used "SortingColumnTTV" and "DescendingOrderTTV" properties to set sorting programmatically because of
persistence. In Outline we did not find similar functionality.

ETableColumn has public methods isSorted(), getSortRank() and isAscending(), but corresponding setSorted(),
setSortRank() and setAscending() are package-private.

Also, protected getRowComparator() is impossible to override for us, because instance of protected class OutlineColumn
is created through protected Outline.createColumn(int), which we can not override, because that method is already
overriden in a private class OutlineViewOutline, returning implementation of private class OutlineViewOutlineColumn.

I consider this to be a design mistake to hide these protected methods this way. We might want to override e.g.
isSortingAllowed() and especially the getRowComparator() to define comparator for integers for instance. Now we must use
a hack to prepend numbers with spaces to get correct numerical sorting through alphabetical one.
Comment 1 Stanislav Aubrecht 2008-12-08 16:24:11 UTC
reassigning to new component owner
Comment 2 Jiri Rechtacek 2009-01-09 13:38:03 UTC
> In TTV we used "SortingColumnTTV" and "DescendingOrderTTV" properties to 
> set sorting programmatically because of
> persistence. In Outline we did not find similar functionality.
> 
> ETableColumn has public methods isSorted(), getSortRank() and 
> isAscending(), but corresponding setSorted(),
> setSortRank() and setAscending() are package-private.
I made it public.

> Also, protected getRowComparator() is impossible to override for us, 
> because instance of protected class OutlineColumn
> is created through protected Outline.createColumn(int), which we can not 
> override, because that method is already
> overriden in a private class OutlineViewOutline, returning 
> implementation of private class OutlineViewOutlineColumn.
That's true.

> I consider this to be a design mistake to hide these protected methods 
> this way. We might want to override e.g.
> isSortingAllowed()
I'll solve it later.

> and especially the getRowComparator() to define 
> comparator for integers for instance. Now we must use
> a hack to prepend numbers with spaces to get correct numerical sorting 
> through alphabetical one.
No need to solve it in this way. Outline uses j.l.Comparable interface to order rows. If column's class is Integer, will
sorted naturally as numbers. For own order you can wrap Integer to YourInteger class and define own comparator.

Fixed in rev/13b0821dda4a
Comment 3 Quality Engineering 2009-01-11 06:34:03 UTC
Integrated into 'main-golden', will be available in build *200901110304* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/13b0821dda4a
User: Jiri Rechtacek <jrechtacek@netbeans.org>
Log: #151294: Inability to persist column sorting