bruno 2003/11/06 01:13:07
Modified: src/blocks/woody/java/org/apache/cocoon/woody/binding
RepeaterJXPathBinding.java
Log:
New rows added to the repeater who's identification widget value is not null
were not detected as new rows during the binding.
Reported by Antonio Gallardo.
Revision Changes Path
1.9 +8 -0
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBinding.java
Index: RepeaterJXPathBinding.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBinding.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- RepeaterJXPathBinding.java 29 Oct 2003 09:36:04 -0000 1.8
+++ RepeaterJXPathBinding.java 6 Nov 2003 09:13:07 -0000 1.9
@@ -179,6 +179,7 @@
//if rowIdValue != null --> iterate nodes to find match
Iterator rowPointers =
repeaterContext.iteratePointers(this.rowPath);
+ boolean found = false;
while (rowPointers.hasNext()) {
Pointer jxp = (Pointer) rowPointers.next();
JXPathContext rowContext =
@@ -198,8 +199,15 @@
this.rowBinding.saveFormToModel(thisRow, rowContext);
// --> store rowIdValue in list of
updatedRowIds
updatedRowIds.add(rowIdValue);
+ found = true;
break;
}
+ }
+ if (!found) {
+ // this is a new row
+ rowsToInsert.add(thisRow);
+ // also add it to the updated row id's so that this row
doesn't get deleted
+ updatedRowIds.add(rowIdValue);
}
} else {
//if rowId == null --> remember to insert this one later