You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Greg Brown (JIRA)" <ji...@apache.org> on 2009/09/17 21:58:58 UTC

[jira] Created: (PIVOT-300) Refine TableView sort API

Refine TableView sort API
-------------------------

                 Key: PIVOT-300
                 URL: https://issues.apache.org/jira/browse/PIVOT-300
             Project: Pivot
          Issue Type: Improvement
          Components: wtk
            Reporter: Greg Brown
            Assignee: Greg Brown
             Fix For: 1.3.1


The current API for managing sorting in TableView is cumbersome and inflexible. In particular, it doesn't convey any concept of sort order - only sort direction for individual columns. Managing sort order and sort state is left entirely to the caller - the platform should provide better support for this.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Greg Brown <gk...@mac.com>.
>> From my experience, control is used for multiple row selection, but  
>> shift is more common for multiple column selection.
> I've never find an application using this controls, but it's not a  
> problem.
> So what do you think on adding also the Control modifier here to have
> the same thing (for consistency with other selection features) ?

I think Shift is the right modifier to use here.

>> Ah, the range selection (with the Shift key) doesn't work in  
>> Trees ... but works in Lists and Tables.
> Is it wanted, or is it a bug to be fixed ?
> In many applications I had Trees, and needed to select some elements,
> so also a range selection could be useful (but i agree only in some
> cases).

We simply didn't implement it, under the assumption that range  
selection in trees is much less common than in tables and lists.

>> what do you think on changing a little the Kitchen Sink demo to  
>> include some null value in some cells ?

The Kitchen Sink demo isn't meant to be a catch-all for all possible  
examples - it is meant to highlight some key examples of Pivot's  
features. However, we could certainly add another demo (or test app)  
that shows this behavior.

>> And, change one of the data columns for example to have inside only  
>> numbered items like 0..9 repeated, so a sort on multiple columns  
>> will show exactly this feature ...

Each column contains random numbers of increasing magnitude. So, if  
you sort column A first, then B, then C, you will see how multi-sort  
works.

>> And to improve it, a tooltip on table headers that tells "Click to  
>> sort, xxx-Click to add the column to the sort", etc ? Maybe in  
>> standard TableHeaders, and as an optional style.

It shouldn't be a standard feature, because a) we can't assume that  
clicking on a header will always sort and b) we'd have to localize it.  
You could easily do this in your app by setting the tooltipText  
property on the header, though.


Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
Hi Greg,

>> Usually Shift on selection groups if for range selection, as already done in Pivot Lists, tables, etc ...
>
> From my experience, control is used for multiple row selection, but shift is more common for multiple column selection.
I've never find an application using this controls, but it's not a problem.
So what do you think on adding also the Control modifier here to have
the same thing (for consistency with other selection features) ?

> Ah, the range selection (with the Shift key) doesn't work in Trees ... but works in Lists and Tables.
Is it wanted, or is it a bug to be fixed ?
In many applications I had Trees, and needed to select some elements,
so also a range selection could be useful (but i agree only in some
cases).

> what do you think on changing a little the Kitchen Sink demo to include some null value in some cells ?
> And, change one of the data columns for example to have inside only numbered items like 0..9 repeated, so a sort on multiple columns will show exactly this feature ...
What do you think ?

> And to improve it, a tooltip on table headers that tells "Click to sort, xxx-Click to add the column to the sort", etc ? Maybe in standard TableHeaders, and as an optional style.
What do you think ?

Thanks,
Sandro

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Greg Brown <gk...@mac.com>.
> Usually Shift on selection groups if for range selection, as already
> done in Pivot Lists, tables, etc ...

 From my experience, control is used for multiple row selection, but  
shift is more common for multiple column selection.


Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
Sorry, really the last question on this ...
what do you think on changing a little the Kitchen Sink demo to
include some null value in some cells ?
And, change one of the data columns for example to have inside only
numbered items like 0..9 repeated, so a sort on multiple columns will
show exactly this feature ...

And to improve it, a tooltip on table headers that tells "Click to
sort, xxx-Click to add the column to the sort", etc ?
Maybe in standard TableHeaders, and as an optional style.


Tell me if I can help in both cases.

Thanks,
Sandro

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
Hi, excuse me, a last question on this theme:
is it possible to disable the sort feature (i think yes) ?
And is it possible to have a third status on sort (maybe enabled only
when desired), like ascending, descending, and none (default) ?

Ah,
the range selection (with the Shift key) doesn't work in Trees ... but
works in Lists and Tables.

Thanks,
Sandro

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
Hi Greg,
I've just seen: great, thanks very much !!

> Yes, you can currently sort on multiple columns. Left-click to sort on any single column. Shift-left-click to add another column to the sort. You can see an example in the Kitchen Sink demo.
Only one question: in many applications (at least on Windows) a
standard key to add/subtract something to a selection group is Control
... would it be a problem to change this ? Or add also the Control key
?

Usually Shift on selection groups if for range selection, as already
done in Pivot Lists, tables, etc ...


Bye

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Greg Brown <gk...@mac.com>.
>> someone has tried to see what happens sorting on a column that
>> contains null values ?
>
> It's up to the comparator to decide how to handle (or if to handle)  
> null
> values, though I do believe that supporting a binary search on a  
> list with
> null values is a TODO in the code.

binarySearch() isn't actually involved here - sorting using Arrays.sort 
(). I'm not sure how that method handles null values (which would be  
the rows in this case), but the change I just checked in adds support  
for null column values within a row.


Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Todd Volkert <tv...@gmail.com>.
Feel free to take a look :)

On Fri, Sep 18, 2009 at 7:20 AM, Sandro Martini <sa...@gmail.com>wrote:

> > The trouble is that until that TODO is done, it will likely throw
> exceptions ;-)
> mhhh not-so-good, sigh ...
>
> Exist a JIRA ticket for this ? Someone is already working on it ?
> If I find some time I could take a look ...
>
> Thanks,
> Sandro
>

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
> The trouble is that until that TODO is done, it will likely throw exceptions ;-)
mhhh not-so-good, sigh ...

Exist a JIRA ticket for this ? Someone is already working on it ?
If I find some time I could take a look ...

Thanks,
Sandro

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Todd Volkert <tv...@gmail.com>.
>
>
> > It's up to the comparator to decide how to handle (or if to handle) null
> > values, though I do believe that supporting a binary search on a list
> with
> > null values is a TODO in the code.
> Ok, my trouble here is to ensure that no exceptions will be thrown ...
> So what do you think on add some null values for example in the
> Kitchen Sink demo in the table section, so we can ensure that all is
> ok, and also out users could see it ...
>

The trouble is that until that TODO is done, it will likely throw exceptions
;-)

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
Hi Todd,

> It's up to the comparator to decide how to handle (or if to handle) null
> values, though I do believe that supporting a binary search on a list with
> null values is a TODO in the code.
Ok, my trouble here is to ensure that no exceptions will be thrown ...
So what do you think on add some null values for example in the
Kitchen Sink demo in the table section, so we can ensure that all is
ok, and also out users could see it ...


>> And with this change, will it be possible to have the sort also on
>> multiple columns (useful in some cases) ?
>>
>
> Yep - check it out in the kitchen sink demo by holding down shift while
> sorting on another column.
Great.

> Check out the sorting demo in the kitchen sink app -- table view already
> does this :)
Great, sometimes I'm too behind ... and my memory lose infos.


Thanks,
Sandro

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Todd Volkert <tv...@gmail.com>.
> someone has tried to see what happens sorting on a column that
> contains null values ?
>

It's up to the comparator to decide how to handle (or if to handle) null
values, though I do believe that supporting a binary search on a list with
null values is a TODO in the code.


> And with this change, will it be possible to have the sort also on
> multiple columns (useful in some cases) ?
>

Yep - check it out in the kitchen sink demo by holding down shift while
sorting on another column.


>
> A last thing:
> what do you think on adding an optional style to change the background
> color on all the column/s being sorted (only a little, using a similar
> color to that currently used) ?
>

Check out the sorting demo in the kitchen sink app -- table view already
does this :)

Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Greg Brown <gk...@mac.com>.
> someone has tried to see what happens sorting on a column that
> contains null values ?

Actually, I just reintroduced support for sorting on null values this  
morning. I had inadvertently removed it when I moved the class out of  
TableView.

> And with this change, will it be possible to have the sort also on
> multiple columns (useful in some cases) ?

Yes, you can currently sort on multiple columns. Left-click to sort on  
any single column. Shift-left-click to add another column to the sort.  
You can see an example in the Kitchen Sink demo.

> what do you think on adding an optional style to change the background
> color on all the column/s being sorted (only a little, using a similar
> color to that currently used) ?

This is already supported via the "columnSelectionColor" style.



Re: [jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by Sandro Martini <sa...@gmail.com>.
Hi Greg,
someone has tried to see what happens sorting on a column that
contains null values ?

And with this change, will it be possible to have the sort also on
multiple columns (useful in some cases) ?
Or if not, open Ticket in JIRA for this ?


A last thing:
what do you think on adding an optional style to change the background
color on all the column/s being sorted (only a little, using a similar
color to that currently used) ?
For example Windows Explorer has this, and is some cases could be
useful to have more in evidence the sort.
Ticket in JIRA for this ?

Thanks,
Sandro

[jira] Resolved: (PIVOT-300) Refine TableView sort API

Posted by "Greg Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Greg Brown resolved PIVOT-300.
------------------------------

    Resolution: Fixed

The TableView sort API has been revised to be more flexible and provide better support such that the caller is not responsible for implementing quite as much. TableView now provides a "sort dictionary", a sorted set of key value pairs where the keys are column names and the values are sort directions. Insertion order is preserved.

TableView also now fires events associated with the sort dictionary, so a caller can listen for sort events to determine when data needs to be re-sorted rather than header press events. TableViewHeader now takes care of updating the table view's sort state in response to header presses so a caller is no longer responsible for handling this at the application level.


> Refine TableView sort API
> -------------------------
>
>                 Key: PIVOT-300
>                 URL: https://issues.apache.org/jira/browse/PIVOT-300
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk
>            Reporter: Greg Brown
>            Assignee: Greg Brown
>             Fix For: 1.3.1
>
>
> The current API for managing sorting in TableView is cumbersome and inflexible. In particular, it doesn't convey any concept of sort order - only sort direction for individual columns. Managing sort order and sort state is left entirely to the caller - the platform should provide better support for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.