cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r484663 - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel: RepeaterActionDefinition.java RepeaterActionDefinitionBuilder.java
Date Fri, 08 Dec 2006 17:09:10 GMT
Author: simoneg
Date: Fri Dec  8 09:09:09 2006
New Revision: 484663

URL: http://svn.apache.org/viewvc?view=rev&rev=484663
Log:
COCOON-1966 Multiple row addition, thanks Jeroen Reijn

Modified:
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java?view=diff&rev=484663&r1=484662&r2=484663
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
Fri Dec  8 09:09:09 2006
@@ -147,11 +147,12 @@
      * The definition of a repeater action that adds a row to a sibling repeater.
      */
     public static class AddRowActionDefinition extends RepeaterActionDefinition {
-        private int insertRows = 1;
+        private int insertRows;
 
-        public AddRowActionDefinition(String repeaterName) {
+        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();
@@ -162,12 +163,13 @@
 							throw new CascadingRuntimeException("Error switching page", e);
 						}
                     }
-                    for (int i=0; i < AddRowActionDefinition.this.insertRows; i++) {
-                        repeater.addRow();
+                    for (int i=0; i<AddRowActionDefinition.this.insertRows; i++) {
+                        repeater.addRow(); 
                     }
                 }
             });
         }
+        
     }
 
     //---------------------------------------------------------------------------------------------

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java?view=diff&rev=484663&r1=484662&r2=484663
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinitionBuilder.java
Fri Dec  8 09:09:09 2006
@@ -105,7 +105,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");



Mime
View raw message