You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2020/04/13 17:05:07 UTC

[openmeetings] branch master updated: [OPENMEETINGS-2257] countries are sorted

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new d5a0eea  [OPENMEETINGS-2257] countries are sorted
d5a0eea is described below

commit d5a0eeaca0fbb6ac5220034485c3a7d8a304c3b3
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Tue Apr 14 00:04:51 2020 +0700

    [OPENMEETINGS-2257] countries are sorted
---
 .../java/org/apache/openmeetings/web/util/CountryDropDown.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/CountryDropDown.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/CountryDropDown.java
index f7f5a46..472fe64 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/CountryDropDown.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/util/CountryDropDown.java
@@ -21,6 +21,7 @@ package org.apache.openmeetings.web.util;
 import static org.apache.openmeetings.db.util.LocaleHelper.getCountries;
 import static org.apache.openmeetings.db.util.LocaleHelper.getCountryName;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.wicket.markup.html.form.DropDownChoice;
@@ -35,7 +36,11 @@ public class CountryDropDown extends DropDownChoice<String>  {
 	}
 
 	public CountryDropDown(String id, IModel<String> model) {
-		super(id, model, getCountries());
+		super(id);
+		setDefaultModel(model);
+		List<String> countries = new ArrayList<>(getCountries());
+		countries.sort((c1, c2) -> getCountryName(c1, getLocale()).compareTo(getCountryName(c2, getLocale())));
+		setChoices(countries);
 		setChoiceRenderer(new IChoiceRenderer<String>() {
 			private static final long serialVersionUID = 1L;