cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r157291 - cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
Date Sat, 12 Mar 2005 22:50:08 GMT
Author: sylvain
Date: Sat Mar 12 14:50:07 2005
New Revision: 157291

URL: http://svn.apache.org/viewcvs?view=rev&rev=157291
Log:
Do not clear selection after adding rows

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java?view=diff&r1=157290&r2=157291
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/RepeaterActionDefinition.java
Sat Mar 12 14:50:07 2005
@@ -118,7 +118,8 @@
     //---------------------------------------------------------------------------------------------
 
     /**
-     * The definition of a repeater action that insert rows before the selected rows in a
sibling repeater.
+     * The definition of a repeater action that insert rows before the selected rows in a
sibling repeater,
+     * or at the end of the repeater if no row is selected.
      */
     public static class InsertRowsActionDefinition extends RepeaterActionDefinition {
         
@@ -131,14 +132,20 @@
             this.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent event) {
                     Repeater repeater = ((RepeaterAction)event.getSource()).getRepeater();
+                    boolean foundSelection = false;
                     for (int i = repeater.getSize() - 1; i >= 0; i--) {
                         Repeater.RepeaterRow row = repeater.getRow(i);
                         Widget selectWidget = row.getChild(selectName);
                         if (Boolean.TRUE.equals(selectWidget.getValue())) {
-                            // Clear selection and add a row
-                            selectWidget.setValue(Boolean.FALSE);
+                            // Add a row
                             repeater.addRow(i);
+                            foundSelection = true;
                         }
+                    }
+                    
+                    if (!foundSelection) {
+                        // Add a row at the end
+                        repeater.addRow();
                     }
                 }
             });



Mime
View raw message