myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r918894 - in /myfaces/tobago/trunk/example/test/src/main: java/org/apache/myfaces/tobago/example/test/Hidden.java webapp/WEB-INF/faces-config.xml webapp/tc/hidden/hidden.xhtml
Date Thu, 04 Mar 2010 08:47:35 GMT
Author: lofwyr
Date: Thu Mar  4 08:47:35 2010
New Revision: 918894

URL: http://svn.apache.org/viewvc?rev=918894&view=rev
Log:
TOBAGO-858: tc:hidden misses attribute rendered
 - test page

Added:
    myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Hidden.java
      - copied, changed from r917992, myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java
Modified:
    myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/hidden/hidden.xhtml

Copied: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Hidden.java
(from r917992, myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Hidden.java?p2=myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Hidden.java&p1=myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java&r1=917992&r2=918894&rev=918894&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Immediate.java
(original)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/Hidden.java
Thu Mar  4 08:47:35 2010
@@ -20,58 +20,35 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.faces.context.FacesContext;
-import javax.faces.model.SelectItem;
+public class Hidden {
 
-public class Immediate {
+  private String value1 = "value 1";
+  private String value2 = "value 2";
+  private String value3 = "value 3";
 
-  private String in;
-  private int selectOne;
-  private Integer[] selectMany;
+  private static final Log LOG = LogFactory.getLog(Hidden.class);
 
-  private SelectItem[] selectItems = new SelectItem[] {
-        new SelectItem(0, "Zero"),
-        new SelectItem(1, "One"),
-        new SelectItem(2, "Two"),
-        new SelectItem(3, "Tree"),
-        new SelectItem(4, "Four"),
-    };
-
-  private static final Log LOG = LogFactory.getLog(Immediate.class);
-
-  public String test() {
-    FacesContext facesContext = FacesContext.getCurrentInstance();
-//    LOG.warn("user: " + facesContext.getExternalContext().getRemoteUser().hashCode());
-    LOG.warn("requ: " + facesContext.getExternalContext().getRequest().hashCode());
-    LOG.warn("sess: " + facesContext.getExternalContext().getSessionMap().hashCode());
-    return null;
-  }
-  
-  public String getIn() {
-    return in;
-  }
-
-  public void setIn(String in) {
-    this.in = in;
+  public String getValue1() {
+    return value1;
   }
 
-  public int getSelectOne() {
-    return selectOne;
+  public void setValue1(String value1) {
+    this.value1 = value1;
   }
 
-  public void setSelectOne(int selectOne) {
-    this.selectOne = selectOne;
+  public String getValue2() {
+    return value2;
   }
 
-  public SelectItem[] getSelectItems() {
-    return selectItems;
+  public void setValue2(String value2) {
+    this.value2 = value2;
   }
 
-  public void setSelectMany(Integer[] selectMany) {
-    this.selectMany = selectMany;
+  public String getValue3() {
+    return value3;
   }
 
-  public Integer[] getSelectMany() {
-    return selectMany;
+  public void setValue3(String value3) {
+    this.value3 = value3;
   }
-}
+}
\ 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=918894&r1=918893&r2=918894&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 Thu Mar  4
08:47:35 2010
@@ -54,6 +54,12 @@
   </managed-bean>
   
   <managed-bean>
+    <managed-bean-name>hidden</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.test.Hidden</managed-bean-class>
+    <managed-bean-scope>request</managed-bean-scope>
+  </managed-bean>
+  
+  <managed-bean>
     <managed-bean-name>upload</managed-bean-name>
     <managed-bean-class>org.apache.myfaces.tobago.example.test.Upload</managed-bean-class>
     <managed-bean-scope>session</managed-bean-scope>

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/tc/hidden/hidden.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/hidden/hidden.xhtml?rev=918894&r1=918893&r2=918894&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/hidden/hidden.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/hidden/hidden.xhtml Thu Mar  4 08:47:35
2010
@@ -7,15 +7,41 @@
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:f="http://java.sun.com/jsf/core">
 
-  <tc:page>
+  <tc:page id="page">
     <f:facet name="layout">
       <tc:gridLayout/>
     </f:facet>
     <tc:gridLayoutConstraint width="600px" height="300px"/>
 
-    <tc:hidden id="h1" value="h1-value"/>
-    <tc:hidden id="h2" value="h2-value" rendered="false"/>
-    <tc:hidden id="h3" value="h3-value" rendered="true"/>
+    <tc:out value="Click 'fill' and than 'submit' and check that the 2. field has not
modified, because the hidden field 2 has rendered=false"/>
+    
+    <tc:hidden id="h1" value="#{hidden.value1}"/>
+    <tx:in label="Value of the hidden field 1 on server" 
+           labelWidth="350px" value="#{hidden.value1}" disabled="true"/>
+    
+    <tc:hidden id="h2" value="#{hidden.value2}" rendered="false"/>
+    <tx:in label="Value of the hidden field 2 on server (rendered=false)" 
+           labelWidth="350px" value="#{hidden.value2}" disabled="true"/>
+    
+    <tc:hidden id="h3" value="#{hidden.value3}" rendered="true"/>
+    <tx:in label="Value of the hidden field 3 on server (rendered=true)" 
+           labelWidth="350px" value="#{hidden.value3}" disabled="true"/>
+    
+    <tc:button id="fill" label="1. fill hidden fields" onclick="fillHiddenFields();"/>
+    <tc:button label="2. submit hidden fields..."/>
+
+    <tc:cell/>
+    
+    <tc:script>
+
+      function fillHiddenFields() {
+        $('#page\\:h1').val("new " + $('#page\\:h1').val());
+        $('#page\\:h2').val("new " + $('#page\\:h2').val());
+        $('#page\\:h3').val("new " + $('#page\\:h3').val());
+      }
+      
+      // todo: the test code is not full automated
+    </tc:script>
 
   </tc:page>
 </f:view>



Mime
View raw message