cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r149076 - /cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java /cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
Date Sat, 29 Jan 2005 22:09:46 GMT
Author: sylvain
Date: Sat Jan 29 14:09:46 2005
New Revision: 149076

URL: http://svn.apache.org/viewcvs?view=rev&rev=149076
Log:
fix fb:struct binding: a non-existent path was not created properly
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java?view=diff&rev=149076&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java&r1=149075&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java&r2=149076
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
Sat Jan 29 14:09:46 2005
@@ -76,6 +76,11 @@
             getLogger().debug("done saving " + toString());
         }
     }
+    
+    /** To allow child classes to know which path they bind to */
+    protected String getXPath() {
+        return this.xpath;
+    }
 
     public String toString() {
         return "ContextJXPathBinding [xpath=" + this.xpath + "]";

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java?view=diff&rev=149076&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java&r1=149075&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java&r2=149076
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
Sat Jan 29 14:09:46 2005
@@ -18,6 +18,7 @@
 import org.apache.cocoon.forms.formmodel.Struct;
 import org.apache.cocoon.forms.formmodel.Widget;
 import org.apache.commons.jxpath.JXPathContext;
+import org.apache.commons.jxpath.Pointer;
 
 /**
  * StructJXPathBinding provides an implementation of a {@link Binding}
@@ -30,9 +31,7 @@
  *
  * @version CVS $Id$
  */
-public class StructJXPathBinding extends ComposedJXPathBindingBase {
-
-    private final String xpath;
+public class StructJXPathBinding extends ContextJXPathBinding {
 
     private final String widgetId;
 
@@ -43,9 +42,8 @@
      * @param childBindings
      */
     public StructJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String
widgetId, String xpath, JXPathBindingBase[] childBindings) {
-        super(commonAtts, childBindings);
+        super(commonAtts, xpath, childBindings);
         this.widgetId = widgetId;
-        this.xpath = xpath;
     }
 
     /**
@@ -55,11 +53,7 @@
      */
     public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
         Struct structWidget = (Struct)selectWidget(frmModel, this.widgetId);
-        JXPathContext subContext = jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
-        super.doLoad(structWidget, subContext);
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("done loading " + toString());
-        }
+        super.doLoad(structWidget, jxpc);
     }
 
     /**
@@ -69,14 +63,10 @@
      */
     public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
         Struct structWidget = (Struct)selectWidget(frmModel, this.widgetId);
-        JXPathContext subContext = jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
-        super.doSave(structWidget, subContext);
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("done saving " + toString());
-        }
+        super.doSave(structWidget, jxpc);
     }
 
     public String toString() {
-        return "StructJXPathBinding [widget=" + this.widgetId + ", xpath=" + this.xpath +
"]";
+        return "StructJXPathBinding [widget=" + this.widgetId + ", xpath=" + getXPath() +
"]";
     }
 }

Mime
View raw message