You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2010/10/19 02:07:35 UTC

svn commit: r1024069 - in /myfaces/trinidad/trunk: trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ trinidad-examples/trinidad-demo/src/main/webap...

Author: gcrawford
Date: Tue Oct 19 00:07:35 2010
New Revision: 1024069

URL: http://svn.apache.org/viewvc?rev=1024069&view=rev
Log:
TRINIDAD-1943 subform default not working

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SubformBean.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/components/subform.jspx

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java?rev=1024069&r1=1024068&r2=1024069&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java Tue Oct 19 00:07:35 2010
@@ -66,7 +66,10 @@ abstract public class UIXSubformTemplate
     boolean submitted = isSubmitted();
 
     if (!submitted && isDefault() && !_isSomethingSubmitted(context))
+    {
+	  submitted = true;
       setSubmitted(true);
+    }
 
     if (submitted)
       super.processValidators(context);

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SubformBean.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SubformBean.java?rev=1024069&r1=1024068&r2=1024069&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SubformBean.java (original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SubformBean.java Tue Oct 19 00:07:35 2010
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -24,28 +24,76 @@ import java.util.List;
 import javax.faces.event.ActionEvent;
 
 
-public class SubformBean 
+public class SubformBean
 {
 
   public SubformBean()
   {
- 
+
   }
+
   public List<MyItem> getTexts2()
   {
     return sItems2;
   }
-  
+
   public List<MyItem> getTexts()
   {
     return sItems;
   }
 
-  private static final List<MyItem> sItems = Arrays.asList(new MyItem(null),
-                                                           new MyItem(null), new MyItem(null));
 
-  private static final List<MyItem> sItems2 = Arrays.asList(new MyItem(null),
-                                                           new MyItem(null), new MyItem(null));
+  public void setSubformValue1(String _subformValue1)
+  {
+    this._subformValue1 = _subformValue1;
+  }
+
+  public String getSubformValue1()
+  {
+    return _subformValue1;
+  }
+
+  public void setSubformValue2(String _subformValue2)
+  {
+    this._subformValue2 = _subformValue2;
+  }
+
+  public String getSubformValue2()
+  {
+    return _subformValue2;
+  }
+
+  public void setSubformValue3(String _subformValue3)
+  {
+    this._subformValue3 = _subformValue3;
+  }
+
+  public String getSubformValue3()
+  {
+    return _subformValue3;
+  }
+
+  public void setSubformValue4(String _subformValue4)
+  {
+    this._subformValue4 = _subformValue4;
+  }
+
+  public String getSubformValue4()
+  {
+    return _subformValue4;
+  }
+
+
+  private String _subformValue1;
+  private String _subformValue2;
+  private String _subformValue3;
+  private String _subformValue4;
+
+  private static final List<MyItem> sItems =
+    Arrays.asList(new MyItem(null), new MyItem(null), new MyItem(null));
+
+  private static final List<MyItem> sItems2 =
+    Arrays.asList(new MyItem(null), new MyItem(null), new MyItem(null));
 
 
   public static class MyItem
@@ -54,23 +102,23 @@ public class SubformBean 
     {
       mText = text;
     }
-    
+
     public String getText()
     {
       return mText;
     }
-    
+
     public void setText(String text)
     {
       System.out.println("setter called with " + text);
       mText = text;
     }
-    
+
     public void doSomething(ActionEvent event)
     {
       System.out.println("in doSomething(), value is" + mText);
     }
-    
+
     private String mText;
   }
 }

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/components/subform.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/components/subform.jspx?rev=1024069&r1=1024068&r2=1024069&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/components/subform.jspx (original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/components/subform.jspx Tue Oct 19 00:07:35 2010
@@ -27,21 +27,28 @@
       <tr:messages/>
       <tr:form>
         <tr:subform>
-          <tr:inputText required="true" label="Sub 1:"/>
+          <tr:inputText required="true" label="Sub 1:" value="#{subformBean.subformValue1}"/>
+          <tr:inputText label="Sub 1 Value" value="#{subformBean.subformValue1}" readOnly="true"/>
           <tr:commandButton text="Submit 1"/>
         </tr:subform>
         <tr:subform>
-          <tr:inputText required="true" label="Sub 2:"/>
+          <tr:inputText required="true" label="Sub 2:" value="#{subformBean.subformValue2}"/>
+          <tr:inputText label="Sub 2 Value" value="#{subformBean.subformValue2}" readOnly="true"/>
           <tr:commandButton text="Submit 2"/>
         </tr:subform>
         <tr:subform default="true">
-          <tr:inputText required="true" label="Sub Default:"/>
+          <tr:inputText required="true" label="Sub Default:" value="#{subformBean.subformValue3}"/>
+          <tr:inputText label="Sub Default Value" value="#{subformBean.subformValue3}"
+                        readOnly="true"/>
           <tr:commandButton text="Submit Default"/>
         </tr:subform>
+        <tr:inputText required="true" label="Outside Subform" id="it4"
+                      value="#{subformBean.subformValue4}"/>
+        <tr:inputText label="Outside Subform Value" id="it4a" value="#{subformBean.subformValue4}"
+                      readOnly="true"/>
         <tr:commandButton text="Submit Outside"/>
         <tr:separator/>
         <tr:outputText value="The fields in the 2 tables below will throw an error if they contain a string where the length is greater than 2. "/>
-        
         <tr:spacer height="10"/>
         <tr:outputText value="Enter 'cat' in all the field of the first table, then hit one of the 'go' buttons. Note that you only see an error for the row where you hit the go button, even though all the rows contain a string where the length is greater than 2. This is because each row of the first column is in its own subform, so only the row in which the button was pressed is running the full lifecycle"/>
         <tr:table id="i1" value="#{subformBean.texts}" var="row">
@@ -56,22 +63,22 @@
             </tr:subform>
           </tr:column>
           <tr:column>
-            <tr:outputText id="ot1" value="#{row.text}" />
+            <tr:outputText id="ot1" value="#{row.text}"/>
           </tr:column>
         </tr:table>
         <tr:spacer height="10"/>
         <tr:outputText value="Enter 'cat' in all the field of the second table, then hit one of the 'go' buttons. Note that you see an error for all the rows. There is no subform in this table, therefore regardless of which button you hit, the full table is processed."/>
         <tr:table id="t2" value="#{subformBean.texts2}" var="row">
           <tr:column>
-              <tr:panelGroupLayout id="pgl1" layout="horizontal">
-                <tr:inputText label="Enter text" id="it2" value="#{row.text}">
-                  <tr:validateLength maximum="2"/>
-                </tr:inputText>
-                <tr:commandButton text="Go" id="go2" actionListener="#{row.doSomething}"/>
-              </tr:panelGroupLayout>
+            <tr:panelGroupLayout id="pgl1" layout="horizontal">
+              <tr:inputText label="Enter text" id="it2" value="#{row.text}">
+                <tr:validateLength maximum="2"/>
+              </tr:inputText>
+              <tr:commandButton text="Go" id="go2" actionListener="#{row.doSomething}"/>
+            </tr:panelGroupLayout>
           </tr:column>
           <tr:column>
-            <tr:outputText id="ot2" value="#{row.text}" />
+            <tr:outputText id="ot2" value="#{row.text}"/>
           </tr:column>
         </tr:table>
       </tr:form>