Collator support

259 views
Skip to first unread message

Miles T.

unread,
Jun 8, 2009, 5:30:40 AM6/8/09
to Google Web Toolkit
Hi,

Are there plans to support the java.text.Collator class in GWT ? That
would be very useful to sort Strings using locale rules.

Thanks in advance.

Cheers

Akiim

unread,
Jun 8, 2009, 10:59:33 AM6/8/09
to Google Web Toolkit
I hope anyone will find a solution !
Collator equivalent in GWT is missing !

Thanks,
Cheers

nicolas.deloof

unread,
Jun 22, 2009, 6:30:05 AM6/22/09
to Google Web Toolkit
I've searched an Apache compatible implementation to add such support
in gwtx, but didn't find one. Apache Harmony is delegating to icu4j
that requires many more classes to be ported.

nicolas.deloof

unread,
Jun 22, 2009, 8:37:29 AM6/22/09
to Google Web Toolkit
For information I made some test on using the javascript
String.localeCompare() method to handle this.
My need is that as a French guy I need "état" to be sorted before
"civil". java.text.Collator is needed to do this in Java but I don't
need all this class features.
I've used this :

public class Collator {

public static final Collator getInstance() {
return instance;
}

private static final Collator instance = new Collator();

public native int compare( String source, String target ); /*-{
return source.localeCompare( target );
}-*/
}

This works on IE (I don't need multi-browser support for my current
app), but this method also exists on Firefox > 2 and Webkit AFAIK. Not
sure it behaves the same way on other browsers.

Hope this helps

Miles T.

unread,
Jun 23, 2009, 6:11:51 AM6/23/09
to Google Web Toolkit
That is also all I need and it works well. Thank you very much !
Reply all
Reply to author
Forward
0 new messages