cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r384761 - in /cocoon: branches/BRANCH_2_1_X/ trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/ trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/
Date Fri, 10 Mar 2006 10:42:27 GMT
Author: jbq
Date: Fri Mar 10 02:42:24 2006
New Revision: 384761

URL: http://svn.apache.org/viewcvs?rev=384761&view=rev
Log:
<action dev="JBQ" type="add" fixes-bug="COCOON-1729" due-to="Rolf Metternich" due-to-email="rolf.metternich@ahafabrik.de">
  Allow to add multiple rows at once to a Repeater using <fd:repeater-action command="add-row"
number-of-rows="5" ...>
</action>

Modified:
    cocoon/branches/BRANCH_2_1_X/status.xml
    cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
    cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
    cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1.xml
    cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1_template.xml
    cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_model.xml
    cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_template.xml

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Fri Mar 10 02:42:24 2006
@@ -180,6 +180,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.9" date="TBD">
+    <action dev="JBQ" type="add" fixes-bug="COCOON-1729" due-to="Rolf Metternich" due-to-email="rolf.metternich@ahafabrik.de">
+      Allow to add multiple rows at once to a Repeater using &lt;fd:repeater-action command="add-row"
number-of-rows="5" ...&gt;
+    </action>
     <action dev="AG" type="fix" fixes-bug="COCOON-1799" due-to="Simone Gianni" due-to-email="s.gianni@thebug.it">
        Threads waste when reading a not found resource.
     </action>

Modified: cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
(original)
+++ cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
Fri Mar 10 02:42:24 2006
@@ -133,14 +133,18 @@
      * The definition of a repeater action that adds a row to a sibling repeater.
      */
     public static class AddRowActionDefinition extends RepeaterActionDefinition {
-        
-        public AddRowActionDefinition(String repeaterName) {
+        private int insertRows;
+
+        public AddRowActionDefinition(String repeaterName, int insertRows) {
             super(repeaterName);
-            
+            this.insertRows = insertRows;
+
             this.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent event) {
                     Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater();
-                    repeater.addRow();
+                    for (int i=0; i<AddRowActionDefinition.this.insertRows; i++) {
+                        repeater.addRow(); 
+                    }
                 }
             });
         }

Modified: cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
(original)
+++ cocoon/trunk/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
Fri Mar 10 02:42:24 2006
@@ -100,7 +100,8 @@
             return new RepeaterActionDefinition.DeleteRowsActionDefinition(repeater, select);
 
         } else if ("add-row".equals(actionCommand)) {
-            return new RepeaterActionDefinition.AddRowActionDefinition(repeater);
+            int insertRows = DomHelper.getAttributeAsInteger(element,"number-of-rows",1);
+            return new RepeaterActionDefinition.AddRowActionDefinition(repeater,insertRows);
 
         } else if ("insert-rows".equals(actionCommand)) {
             String select = DomHelper.getAttribute(element, "select");

Modified: cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1.xml?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1.xml
(original)
+++ cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1.xml
Fri Mar 10 02:42:24 2006
@@ -336,6 +336,10 @@
       <fd:label>Add contact</fd:label>
     </fd:repeater-action>
   
+    <fd:repeater-action id="addtwocontacts" command="add-row" repeater="contacts" number-of-rows="2">
+      <fd:label>Add two contacts</fd:label>
+    </fd:repeater-action>
+  
     <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts"
select="select">
       <fd:label>Remove selected contacts</fd:label>
     </fd:repeater-action>

Modified: cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1_template.xml?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1_template.xml
(original)
+++ cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form1_template.xml
Fri Mar 10 02:42:24 2006
@@ -134,6 +134,7 @@
           </jx:choose>
           <tr>
             <td colspan="6">
+              <ft:widget id="addtwocontacts"/>
               <ft:widget id="addcontact"/>
               <jx:if test="${widget.getChild('contacts').getSize() > 0}">
                 <ft:widget id="removecontacts"/>

Modified: cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_model.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_model.xml?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_model.xml
(original)
+++ cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_model.xml
Fri Mar 10 02:42:24 2006
@@ -167,6 +167,10 @@
       <fd:label>Add contact</fd:label>
     </fd:repeater-action>
   
+    <fd:repeater-action id="addtwocontacts" command="add-row" repeater="contacts" number-of-rows="2">
+      <fd:label>Add two contacts</fd:label>
+    </fd:repeater-action>
+  
     <fd:repeater-action id="removecontacts" command="delete-rows" repeater="contacts"
select="select">
       <fd:label>Remove selected contacts</fd:label>
     </fd:repeater-action>

Modified: cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_template.xml?rev=384761&r1=384760&r2=384761&view=diff
==============================================================================
--- cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_template.xml
(original)
+++ cocoon/trunk/cocoon-forms/cocoon-forms-sample/src/main/resources/samples/forms/form2_template.xml
Fri Mar 10 02:42:24 2006
@@ -107,6 +107,7 @@
 
         <tr>
           <td colspan="4" align="right">
+            <ft:widget id="addtwocontacts"/>
             <ft:widget id="addcontact"/>
             <ft:widget id="removecontacts"/>
           </td>



Mime
View raw message