You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/01/27 21:58:52 UTC

cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding RepeaterJXPathBinding.java

vgritsenko    2004/01/27 12:58:52

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
                        RepeaterJXPathBinding.java
  Log:
  During binding, reuse rows created if initial size is not zero
  
  Revision  Changes    Path
  1.17      +8 -2      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- RepeaterJXPathBinding.java	27 Jan 2004 05:50:08 -0000	1.16
  +++ RepeaterJXPathBinding.java	27 Jan 2004 20:58:52 -0000	1.17
  @@ -141,6 +141,7 @@
           // Find the repeater
           Repeater repeater = (Repeater) frmModel.getWidget(this.repeaterId);
           repeater.removeRows();
  +        int initialSize = repeater.getSize();
   
           // build a jxpath iterator for pointers
           JXPathContext repeaterContext = jxpc.getRelativeContext(jxpc.getPointer(this.repeaterPath));
  @@ -149,7 +150,12 @@
           //iterate through it
           while (rowPointers.hasNext()) {
               // create a new row, take that as the frmModelSubContext
  -            Repeater.RepeaterRow thisRow = repeater.addRow();
  +            Repeater.RepeaterRow thisRow;
  +            if (initialSize > 0) {
  +                thisRow = repeater.getRow(--initialSize);
  +            } else {
  +                thisRow = repeater.addRow();
  +            }
   
               // make a jxpath ObjectModelSubcontext on the iterated element
               Pointer jxp = (Pointer) rowPointers.next();