You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/08/10 08:38:53 UTC

svn commit: r983868 - /myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java

Author: lofwyr
Date: Tue Aug 10 06:38:53 2010
New Revision: 983868

URL: http://svn.apache.org/viewvc?rev=983868&view=rev
Log:
Must the default locale be in the supported list? This question is not specified explicit and diffent implemented in the RI and MyFaces

Modified:
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java?rev=983868&r1=983867&r2=983868&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java Tue Aug 10 06:38:53 2010
@@ -22,13 +22,12 @@ package org.apache.myfaces.tobago.exampl
  * $Id$
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.Theme;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import javax.faces.application.Application;
 import javax.faces.context.FacesContext;
 import javax.faces.model.SelectItem;
@@ -129,11 +128,20 @@ public class ClientConfigController {
     Locale defaultLocale = application.getDefaultLocale();
     Iterator supportedLocales = application.getSupportedLocales();
 
+    boolean defaultInList = false;
     List<SelectItem> localeItems = new ArrayList<SelectItem>();
-    localeItems.add(createLocaleItem(defaultLocale));
     while (supportedLocales.hasNext()) {
       Locale locale = (Locale) supportedLocales.next();
       localeItems.add(createLocaleItem(locale));
+      if (locale.equals(defaultLocale)) {
+        defaultInList = true;
+      }
+    }
+    // If the default is already in the list, don't add it.
+    // Background: Must the default be in the supported list? Yes or No?
+    // This question is not specified explicit and different implemented in the RI and MyFaces
+    if (! defaultInList) {
+      localeItems.add(0, createLocaleItem(defaultLocale));
     }
     return localeItems;
   }