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 2014/07/02 13:36:05 UTC

svn commit: r1607320 - in /myfaces/tobago/trunk/tobago-example: tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ tobago-example-test/src/mai...

Author: lofwyr
Date: Wed Jul  2 11:36:05 2014
New Revision: 1607320

URL: http://svn.apache.org/r1607320
Log:
example: no default locale may set

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java?rev=1607320&r1=1607319&r2=1607320&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java Wed Jul  2 11:36:05 2014
@@ -117,7 +117,7 @@ public class ClientConfigController {
     // 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) {
+    if (!defaultInList && defaultLocale != null) {
       localeItems.add(0, createLocaleItem(defaultLocale));
     }
     return localeItems;

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java?rev=1607320&r1=1607319&r2=1607320&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java Wed Jul  2 11:36:05 2014
@@ -86,11 +86,20 @@ public class ClientConfigController {
     final Locale defaultLocale = application.getDefaultLocale();
     final Iterator supportedLocales = application.getSupportedLocales();
 
+    boolean defaultInList = false;
     final List<SelectItem> localeItems = new ArrayList<SelectItem>();
-    localeItems.add(createLocaleItem(defaultLocale));
     while (supportedLocales.hasNext()) {
       final 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 && defaultLocale != null) {
+      localeItems.add(0, createLocaleItem(defaultLocale));
     }
     return localeItems;
   }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml?rev=1607320&r1=1607319&r2=1607320&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/navigation.xhtml Wed Jul  2 11:36:05 2014
@@ -31,18 +31,23 @@
     <tc:panel>
       <f:facet name="layout">
         <!--todo replace 20px with "auto" -->
-        <tc:gridLayout rows="20px;*"/>
+        <tc:gridLayout rows="auto;*"/>
       </f:facet>
 
       <tc:panel>
         <f:facet name="layout">
-          <tc:gridLayout columns="*;30px"/>
+          <tc:gridLayout columns="*;30px" rows="auto;auto"/>
         </f:facet>
 
         <tx:selectOneChoice value="#{clientConfig.theme}" label="Theme">
           <f:selectItems value="#{clientConfig.themeItems}"/>
         </tx:selectOneChoice>
-        <tc:button action="#{clientConfig.submit}" label="OK"/>
+        <tc:button action="#{clientConfig.submit}" label="OK">
+          <tc:gridLayoutConstraint rowSpan="2"/>
+        </tc:button>
+        <tx:selectOneChoice value="#{clientConfig.locale}" label="Locale">
+          <f:selectItems value="#{clientConfig.localeItems}"/>
+        </tx:selectOneChoice>
       </tc:panel>
 
       <tc:tree value="#{browser.tree}" var="node">