The following comment has been added to this issue:

     Author: 
    Created: Tue, 9 Nov 2004 7:22 PM
       Body:
I implemented option one and rebuilt displaytag. It works quite well, even 
without passing the Locale to the Collator, as a default RuleBasedCollator has 
a rule set which sorts most languages much more "naturally" than does 
String.compareTo.

In order to have RowSorter.checkNullsAndCompare actually use the Collator 
however, you must also modify the first 'if' clause to filter out Strings, 
since they implement Comparable and would otherwise never reach the clause 
which uses the Collator:

        if (object1 instanceof Comparable && object2 instanceof Comparable 
                && ! (object1 instanceof String && object2 instanceof String))


---------------------------------------------------------------------
View this comment:
  http://jira.codehaus.org/browse/DISPL-77?page=comments#action_26270

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/DISPL-77

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DISPL-77
    Summary: Account for extended ascii strings when sorting
       Type: Bug

     Status: Unassigned
   Priority: Major

 Original Estimate: Unknown
 Time Spent: Unknown
  Remaining: Unknown

    Project: DisplayTag
 Components: 
             Paging/Sorting
   Versions:
             1.0 RC1

   Assignee: 
   Reporter: fabrizio giustina

    Created: Fri, 22 Oct 2004 7:40 AM
    Updated: Tue, 9 Nov 2004 7:22 PM

Description:
====
imported from sf tracker
id 949485
submitted by karlhungus - karlhungus
http://sourceforge.net/support/tracker.php?aid=949485
====

 Feature: take extended ascii into account when sorting
strings

Solutions:
-Option 1
in RowSorter.checkNullsAndCompare
change the last else condition:
<code> // if object are not null and don't
implement comparable, compare using string values
returnValue =
object1.toString().compareTo(object2.toString());</code>

to:
<code>Collator.getInstance().compare(object1.toString(),
object2.toString());</code>


It's simple and it basicly solves the problem
-Option 2
When creating the TableModel in TableTag pass in the
locale and make it an attribute of RowSorter, then
<code>Collator.getInstance(locale).compare(object1.toString(),
object2.toString());</code>

It's a little more impacting but it sovles the problem
more generally



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to