[Building Sakai] Filenae sorting in Sakai 2

Matthew Jones jonespm at umich.edu
Thu Apr 15 10:31:58 PDT 2010


First, quickly checking at the code I think you meant
c2[i] instead of c1[i] after the && in this code.

http://goo.gl/difL
* if (c1[i].getClass().getName().equals("java.lang.String") &&
c1[i].getClass().getName().equals("java.lang.String")) {*

Also I had some concerns about how this works originally (performance wise)
but we haven't noticed any issues and tested both methods. If you were going
to use the collator for i18n you'd probably be pulling the locale out of the
users specific preference rather than the system locale. Would for sure be
an interesting feature. I'd still think you need to leave the 2 options for
smart sort and non smart sort in there and probably fix both cases.

(This is toggable via a property content.smartSort from KNL-16.)

For the smartSort, it correctly sorts the numbers in a more intuitive order.
Without smart sort it leaves them in the alphanumeric order that "sort"
would return. This would be easier using the collator in this older (non
smart sorting) case.

-Matthew

On Thu, Apr 15, 2010 at 1:09 PM, David Horwitz <david.horwitz at uct.ac.za> wrote:

Hi
>
> (just noticed the horrific typo in the title). Using collator the list
> bellow would look like
>
> file1
> file01
> file10
> file2
> ...
>
>
> There is no util or commons class that I've found that does it properly
> and all example code I've seen at best approximates this behavior and
> ignores the possible i18n cases. If you know of one I'd like to know of it.
>
> David
>
> On 04/15/2010 06:53 PM, Adam Marshall wrote:
> > so what order would the list below be in if we used java.text.Collator ?
> >
> > Aren't there other alternatives like stuff from java.util?
> >
> > adam
> >
> > | -----Original Message-----
> > | From: sakai-dev-bounces at collab.sakaiproject.org [mailto:sakai-dev-
> > | bounces at collab.sakaiproject.org] On Behalf Of David Horwitz
> > | Sent: 15 April 2010 15:13
> > | To: sakai-dev; i18n at collab.sakaiproject.org
> > | Subject: [Building Sakai] Filenae sorting in Sakai 2
> > |
> > | Hi All,
> > |
> > | I was looking into:
> > | http://jira.sakaiproject.org/browse/KNL-467
> > |
> > | In which Matthew Buckett reported that sorting of files and folders in
> > | contentHosting is case sensitive. I looked into this also aware that
> > | there are i18n problems with many sorting methods in Sakai. Now the
> > | sort
> > | method is designed to mimic Windows explorer and Mac finder when it
> > | comes to sorting files with numbers in the names:
> > |
> > | file
> > | file01
> > | file1
> > | file02
> > | file2
> > | file10
> > |
> > | The sorting should also be case insensitive. Now I can see no easy to
> > | fix the case problem in the sort method or make it obey locale specific
> > | sort rules. Both of these can be done by using java.text.Collator in
> > | the
> > | process eliminating 50 lines of Sakai code, but we then loose the
> > | sortign behaviour described above.
> > |
> > | What do people think?
> > |
> > | David
> > | _______________________________________________
> > | sakai-dev mailing list
> > | sakai-dev at collab.sakaiproject.org
> > | http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
> > |
> > | TO UNSUBSCRIBE: send email to sakai-dev-
> > | unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> >
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100415/7891feb4/attachment.html 


More information about the sakai-dev mailing list