mpo         2003/12/05 06:06:23

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
                        RepeaterJXPathBindingBuilder.java
                        RepeaterJXPathBinding.java
  Log:
  Adding support for a different row-path-insert attribute on row-repeating.
  This allows for the row-path to hold xpath-predicates. 
  (e.g. row-path="item[not(@status='deleted']"  row-path-insert="item")
  
  Revision  Changes    Path
  1.6       +2 -1      
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBindingBuilder.java
  
  Index: RepeaterJXPathBindingBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBindingBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RepeaterJXPathBindingBuilder.java 18 Sep 2003 20:16:13 -0000      1.5
  +++ RepeaterJXPathBindingBuilder.java 5 Dec 2003 14:06:23 -0000       1.6
  @@ -106,6 +106,7 @@
               String parentPath =
                   DomHelper.getAttribute(bindingElm, "parent-path");
               String rowPath = DomHelper.getAttribute(bindingElm, "row-path");
  +            String rowPathForInsert = DomHelper.getAttribute(bindingElm, 
"row-path-insert", rowPath);
               String uniqueRowId =
                   DomHelper.getAttribute(bindingElm, "unique-row-id");
               String uniqueRowIdPath =
  @@ -156,7 +157,7 @@
   
               RepeaterJXPathBinding repeaterBinding =
                   new RepeaterJXPathBinding(
  -                    repeaterId, parentPath, rowPath,
  +                    repeaterId, parentPath, rowPath, rowPathForInsert,
                       uniqueRowId, uniqueRowIdPath,
                       convertor, convertorLocale, 
                       childBindings, insertBinding, deleteBindings);
  
  
  
  1.10      +9 -5      
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RepeaterJXPathBinding.java        6 Nov 2003 09:13:07 -0000       1.9
  +++ RepeaterJXPathBinding.java        5 Dec 2003 14:06:23 -0000       1.10
  @@ -74,6 +74,7 @@
       private final String repeaterId;
       private final String repeaterPath;
       private final String rowPath;
  +    private final String rowPathForInsert;
       private final String uniqueRowId;
       private final String uniqueRowIdPath;
       private final Convertor uniqueRowIdConvertor;
  @@ -86,17 +87,19 @@
       /**
        * Constructs RepeaterJXPathBinding
        */
  -    public RepeaterJXPathBinding(String repeaterId, String repeaterPath, 
String rowPath, 
  +    public RepeaterJXPathBinding(String repeaterId, String repeaterPath, 
  +                                 String rowPath, String rowPathForInsert,
                                    String uniqueRowId, String uniqueRowPath, 
                                    JXPathBindingBase[] childBindings,
                                    JXPathBindingBase insertBinding, 
JXPathBindingBase[] deleteBindings) {
  -        this(repeaterId, repeaterPath, rowPath, uniqueRowId, uniqueRowPath, 
null, null, childBindings, insertBinding, deleteBindings);
  +        this(repeaterId, repeaterPath, rowPath, rowPathForInsert, 
uniqueRowId, uniqueRowPath, null, null, childBindings, insertBinding, 
deleteBindings);
       }
   
       /**
        * Constructs RepeaterJXPathBinding
        */
  -    public RepeaterJXPathBinding(String repeaterId, String repeaterPath, 
String rowPath, 
  +    public RepeaterJXPathBinding(String repeaterId, String repeaterPath, 
  +                                 String rowPath, String rowPathForInsert,
                                    String uniqueRowId, String uniqueRowPath, 
                                    Convertor convertor, Locale 
convertorLocale, 
                                    JXPathBindingBase[] childBindings,
  @@ -104,6 +107,7 @@
           this.repeaterId = repeaterId;
           this.repeaterPath = repeaterPath;
           this.rowPath = rowPath;
  +        this.rowPathForInsert = rowPathForInsert;
           this.uniqueRowId = uniqueRowId;
           this.uniqueRowIdPath = uniqueRowPath;
           this.uniqueFieldBinding =
  @@ -251,7 +255,7 @@
   
           // count how many we have now
           int indexCount = 1;
  -        rowPointers = repeaterContext.iteratePointers(this.rowPath);
  +        rowPointers = repeaterContext.iteratePointers(this.rowPathForInsert);
           while (rowPointers.hasNext()) {
               rowPointers.next();
               indexCount++;
  @@ -266,7 +270,7 @@
                   while (rowIterator.hasNext()) {
                       Repeater.RepeaterRow thisRow = (Repeater.RepeaterRow) 
rowIterator.next();
                       // -->  create the path to let the context be created
  -                    Pointer newRowContextPointer = 
repeaterContext.createPath(this.rowPath + "[" + indexCount + "]");
  +                    Pointer newRowContextPointer = 
repeaterContext.createPath(this.rowPathForInsert + "[" + indexCount + "]");
                       JXPathContext newRowContext = 
repeaterContext.getRelativeContext(newRowContextPointer);
                       if (getLogger().isDebugEnabled())
                           getLogger().debug("inserted row at " + 
newRowContextPointer.asPath());
  
  
  

Reply via email to