From 34a1e631f4aa31791ef8133bb0c690f530156eff Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 18 Feb 2015 12:13:13 -0500 Subject: [PATCH] IDEMPIERE-2451 Region list is not correctly sorted on location panel --- org.adempiere.base/src/org/compiere/model/MCity.java | 4 +++- org.adempiere.base/src/org/compiere/model/MCountry.java | 4 +++- org.adempiere.base/src/org/compiere/model/MRegion.java | 4 +++- org.adempiere.base/src/org/compiere/model/PO.java | 6 ++++-- org.adempiere.base/src/org/compiere/util/NamePair.java | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MCity.java b/org.adempiere.base/src/org/compiere/model/MCity.java index abcc27ee4b..ada89eebbc 100644 --- a/org.adempiere.base/src/org/compiere/model/MCity.java +++ b/org.adempiere.base/src/org/compiere/model/MCity.java @@ -18,6 +18,7 @@ package org.compiere.model; import java.io.Serializable; import java.sql.ResultSet; +import java.text.Collator; import java.util.Comparator; import java.util.Properties; @@ -127,7 +128,8 @@ public class MCity extends X_C_City String s2 = o2.toString(); if (s2 == null) s2 = ""; - return s1.compareTo(s2); + Collator collator = Collator.getInstance(); + return collator.compare(s1, s2); } // compare } // MCity diff --git a/org.adempiere.base/src/org/compiere/model/MCountry.java b/org.adempiere.base/src/org/compiere/model/MCountry.java index c2516d1b02..5ed796dc90 100644 --- a/org.adempiere.base/src/org/compiere/model/MCountry.java +++ b/org.adempiere.base/src/org/compiere/model/MCountry.java @@ -20,6 +20,7 @@ import static org.compiere.model.SystemIDs.COUNTRY_US; import java.io.Serializable; import java.sql.ResultSet; +import java.text.Collator; import java.util.Arrays; import java.util.Comparator; import java.util.List; @@ -289,7 +290,8 @@ public class MCountry extends X_C_Country String s2 = o2.toString(); if (s2 == null) s2 = ""; - return s1.compareTo(s2); + Collator collator = Collator.getInstance(); + return collator.compare(s1, s2); } // compare /** diff --git a/org.adempiere.base/src/org/compiere/model/MRegion.java b/org.adempiere.base/src/org/compiere/model/MRegion.java index 71612c8471..903608acb3 100644 --- a/org.adempiere.base/src/org/compiere/model/MRegion.java +++ b/org.adempiere.base/src/org/compiere/model/MRegion.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; +import java.text.Collator; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -227,7 +228,8 @@ public class MRegion extends X_C_Region String s2 = o2.toString(); if (s2 == null) s2 = ""; - return s1.compareTo(s2); + Collator collator = Collator.getInstance(); + return collator.compare(s1, s2); } // compare /** diff --git a/org.adempiere.base/src/org/compiere/model/PO.java b/org.adempiere.base/src/org/compiere/model/PO.java index 50c8af2a14..93e76913d2 100644 --- a/org.adempiere.base/src/org/compiere/model/PO.java +++ b/org.adempiere.base/src/org/compiere/model/PO.java @@ -28,6 +28,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Savepoint; import java.sql.Timestamp; +import java.text.Collator; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; @@ -344,6 +345,7 @@ public abstract class PO if (!(o2 instanceof PO)) throw new ClassCastException ("Not PO -2- " + o2); // same class + Collator collator = Collator.getInstance(); if (o1.getClass().equals(o2.getClass())) { int index = get_ColumnIndex("DocumentNo"); @@ -363,10 +365,10 @@ public abstract class PO return -1; else if (comp2 == null) 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 /** diff --git a/org.adempiere.base/src/org/compiere/util/NamePair.java b/org.adempiere.base/src/org/compiere/util/NamePair.java index 2e8aa1be86..72bef355b3 100644 --- a/org.adempiere.base/src/org/compiere/util/NamePair.java +++ b/org.adempiere.base/src/org/compiere/util/NamePair.java @@ -17,6 +17,7 @@ package org.compiere.util; import java.io.Serializable; +import java.text.Collator; import java.util.Comparator; /** @@ -84,7 +85,8 @@ public abstract class NamePair implements Comparator, Serializable, Comp { String s1 = o1 == null ? "" : o1.toString(); String s2 = o2 == null ? "" : o2.toString(); - return s1.compareTo (s2); // sort order ?? + Collator collator = Collator.getInstance(); + return collator.compare(s1, s2); } // compare /**