IDEMPIERE-2451 Region list is not correctly sorted on location panel

This commit is contained in:
Carlos Ruiz 2015-02-18 12:13:13 -05:00
parent 300d2babc6
commit 34a1e631f4
5 changed files with 16 additions and 6 deletions

View File

@ -18,6 +18,7 @@ package org.compiere.model;
import java.io.Serializable; import java.io.Serializable;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.text.Collator;
import java.util.Comparator; import java.util.Comparator;
import java.util.Properties; import java.util.Properties;
@ -127,7 +128,8 @@ public class MCity extends X_C_City
String s2 = o2.toString(); String s2 = o2.toString();
if (s2 == null) if (s2 == null)
s2 = ""; s2 = "";
return s1.compareTo(s2); Collator collator = Collator.getInstance();
return collator.compare(s1, s2);
} // compare } // compare
} // MCity } // MCity

View File

@ -20,6 +20,7 @@ import static org.compiere.model.SystemIDs.COUNTRY_US;
import java.io.Serializable; import java.io.Serializable;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.text.Collator;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@ -289,7 +290,8 @@ public class MCountry extends X_C_Country
String s2 = o2.toString(); String s2 = o2.toString();
if (s2 == null) if (s2 == null)
s2 = ""; s2 = "";
return s1.compareTo(s2); Collator collator = Collator.getInstance();
return collator.compare(s1, s2);
} // compare } // compare
/** /**

View File

@ -20,6 +20,7 @@ import java.io.Serializable;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
@ -227,7 +228,8 @@ public class MRegion extends X_C_Region
String s2 = o2.toString(); String s2 = o2.toString();
if (s2 == null) if (s2 == null)
s2 = ""; s2 = "";
return s1.compareTo(s2); Collator collator = Collator.getInstance();
return collator.compare(s1, s2);
} // compare } // compare
/** /**

View File

@ -28,6 +28,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Savepoint; import java.sql.Savepoint;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
@ -344,6 +345,7 @@ public abstract class PO
if (!(o2 instanceof PO)) if (!(o2 instanceof PO))
throw new ClassCastException ("Not PO -2- " + o2); throw new ClassCastException ("Not PO -2- " + o2);
// same class // same class
Collator collator = Collator.getInstance();
if (o1.getClass().equals(o2.getClass())) if (o1.getClass().equals(o2.getClass()))
{ {
int index = get_ColumnIndex("DocumentNo"); int index = get_ColumnIndex("DocumentNo");
@ -363,10 +365,10 @@ public abstract class PO
return -1; return -1;
else if (comp2 == null) else if (comp2 == null)
return 1; return 1;
return comp1.toString().compareTo(comp2.toString()); return collator.compare(comp1.toString(), comp2.toString());
} }
} }
return o1.toString().compareTo(o2.toString()); return collator.compare(o1.toString(), o2.toString());
} // compare } // compare
/** /**

View File

@ -17,6 +17,7 @@
package org.compiere.util; package org.compiere.util;
import java.io.Serializable; import java.io.Serializable;
import java.text.Collator;
import java.util.Comparator; import java.util.Comparator;
/** /**
@ -84,7 +85,8 @@ public abstract class NamePair implements Comparator<Object>, Serializable, Comp
{ {
String s1 = o1 == null ? "" : o1.toString(); String s1 = o1 == null ? "" : o1.toString();
String s2 = o2 == null ? "" : o2.toString(); String s2 = o2 == null ? "" : o2.toString();
return s1.compareTo (s2); // sort order ?? Collator collator = Collator.getInstance();
return collator.compare(s1, s2);
} // compare } // compare
/** /**