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 2009/08/07 16:55:13 UTC

svn commit: r802029 - in /myfaces/tobago/trunk/example/test/src/main: java/org/apache/myfaces/tobago/example/test/ClientConfigController.java webapp/WEB-INF/faces-config.xml webapp/WEB-INF/tobago-config.xml webapp/navigation.xhtml

Author: lofwyr
Date: Fri Aug  7 14:55:13 2009
New Revision: 802029

URL: http://svn.apache.org/viewvc?rev=802029&view=rev
Log:
enabled theme switching in the test app.

Added:
    myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java
      - copied, changed from r801603, myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
Modified:
    myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/tobago-config.xml
    myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml

Copied: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java (from r801603, myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java?p2=myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java&p1=myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java&r1=801603&r2=802029&rev=802029&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ClientConfigController.java Fri Aug  7 14:55:13 2009
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.example.demo.clientConfig;
+package org.apache.myfaces.tobago.example.test;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,18 +17,10 @@
  * limitations under the License.
  */
 
-/*
- * Created 21.08.2002 at 18:00:22.
- * $Id$
- */
-
 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;
@@ -39,8 +31,6 @@
 
 public class ClientConfigController {
 
-  private static final Log LOG = LogFactory.getLog(ClientConfigController.class);
-
   private boolean debugMode;
 
   private Theme theme;
@@ -84,30 +74,14 @@
   }
 
   public String submit() {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("invoke!!!");
-    }
-    FacesContext facesContext = FacesContext.getCurrentInstance();
-
     storeInClientProperties();
-
-    for (int i = 0; i < ClientConfigPhaseListener.BEAN_NAMES.length; i++) {
-      String beanName = ClientConfigPhaseListener.BEAN_NAMES[i];
-      ClientConfigController controller
-          = getCurrentInstance(facesContext, beanName);
-      if (controller != null) {
-        controller.setLocale(locale);
-      }
-    }
-
-    return FacesContext.getCurrentInstance().getViewRoot().getViewId();
+    return "navigation";
   }
 
 // ///////////////////////////////////////////// logic
 
   public void storeInClientProperties() {
-    ClientProperties client
-        = ClientProperties.getInstance(FacesContext.getCurrentInstance());
+    ClientProperties client = ClientProperties.getInstance(FacesContext.getCurrentInstance());
 
     client.setDebugMode(debugMode);
     client.setTheme(theme);
@@ -217,4 +191,4 @@
   public void setContentTypeItems(SelectItem[] contentTypeItems) {
     this.contentTypeItems = contentTypeItems;
   }
-}
+}
\ No newline at end of file

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml?rev=802029&r1=802028&r2=802029&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml Fri Aug  7 14:55:13 2009
@@ -35,6 +35,19 @@
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
 
+  <managed-bean>
+    <managed-bean-name>clientConfig</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.test.ClientConfigController</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+  </managed-bean>
+
+  <navigation-rule>
+    <navigation-case>
+      <from-outcome>navigation</from-outcome>
+      <to-view-id>/navigation.xhtml</to-view-id>
+    </navigation-case>
+  </navigation-rule>
+
   <lifecycle>
     <phase-listener>
       org.apache.myfaces.tobago.example.test.DebugModePhaseListener

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/tobago-config.xml?rev=802029&r1=802028&r2=802029&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/tobago-config.xml Fri Aug  7 14:55:13 2009
@@ -23,5 +23,8 @@
 <tobago-config>
   <theme-config>
     <default-theme>speyside</default-theme>
+    <supported-theme>scarborough</supported-theme>
+    <supported-theme>richmond</supported-theme>
+    <supported-theme>charlotteville</supported-theme>
   </theme-config>
 </tobago-config>

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml?rev=802029&r1=802028&r2=802029&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/navigation.xhtml Fri Aug  7 14:55:13 2009
@@ -13,14 +13,32 @@
     </f:facet>
     <tc:gridLayoutConstraint width="1000px" height="700px"/>
 
-    <tc:tree>
-      <tc:treeData  value="#{browser.tree}" var="node">
-        <tc:treeNode link="#{node.resource}" label="#{node.label}" target="page:content"/>
-      </tc:treeData>
-    </tc:tree>
+    <tc:panel>
+      <f:facet name="layout">
+        <!--todo replace 20px with "auto" -->
+        <tc:gridLayout rows="20px;*"/>
+      </f:facet>
+
+      <tc:panel>
+        <f:facet name="layout">
+          <tc:gridLayout columns="*;30px"/>
+        </f:facet>
+
+        <tx:selectOneChoice value="#{clientConfig.theme}" label="Theme">
+          <f:selectItems value="#{clientConfig.themeItems}"/>
+        </tx:selectOneChoice>
+        <tc:button action="#{clientConfig.submit}" label="OK"/>
+      </tc:panel>
+
+      <tc:tree>
+        <tc:treeData value="#{browser.tree}" var="node">
+          <tc:treeNode link="#{node.resource}" label="#{node.label}" target="page:content"/>
+        </tc:treeData>
+      </tc:tree>
+    </tc:panel>
 
     <!-- src will be set via tc:treeNode -->
-    <tc:object id="content" />
+    <tc:object id="content"/>
 
     <!--<tc:script file="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"/>-->