cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject svn commit: r111426 - cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding
Date Thu, 09 Dec 2004 20:08:37 GMT
Author: tim
Date: Thu Dec  9 12:08:37 2004
New Revision: 111426

URL: http://svn.apache.org/viewcvs?view=rev&rev=111426
Log:
CForms binding: minor touchups (javadocs, whitespace, wording, error reporting)
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBinding.java
Thu Dec  9 12:08:37 2004
@@ -20,7 +20,7 @@
 
 /**
  * ClassJXPathBinding provides an implementation of a {@link Binding}
- * that that allows the specification of a class of reusable bindings.
+ * which allows the specification of a class of reusable bindings.
  * <p>
  * NOTES: <ol>
  * <li>This Binding uses the provided widget-id as the name for the class.</li>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/ClassJXPathBindingBuilder.java
Thu Dec  9 12:08:37 2004
@@ -26,7 +26,7 @@
  * <pre><code>
  * &lt;fb:class id="<i>widget-id</i>"&gt;
  *   &lt;fb:field id="<i>sub-widget-id</i>" path="<i>relative-xpath</i>"
- *       direction="<i>load|save</i>" lenient="<i>true|false</i>"
/>
+ *       direction="<i>load|save</i>" lenient="<i>true|false</i>"/&gt;
  * &lt;/fb:class&gt;
  * </code></pre>
  *

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
Thu Dec  9 12:08:37 2004
@@ -89,7 +89,7 @@
                 classBinding = parent.getClass(id);
                 // Cache result
                 if (classes == null) {
-                   classes = new HashMap();
+                    classes = new HashMap();
                 }
                 classes.put(id, classBinding);
             } else {

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingManager.java
Thu Dec  9 12:08:37 2004
@@ -101,7 +101,7 @@
                 Element rootElm = doc.getDocumentElement();
                 if (BindingManager.NAMESPACE.equals(rootElm.getNamespaceURI())) {
                     binding = getBuilderAssistant()
-                            .getBindingForConfigurationElement(rootElm);
+                        .getBindingForConfigurationElement(rootElm);
                     ((JXPathBindingBase) binding).enableLogging(getLogger());
                     if (getLogger().isDebugEnabled()) {
                         getLogger().debug("Creation of new binding finished. " + binding);
@@ -191,15 +191,14 @@
         }
 
         /**
-         * Creates a {@link Binding}following the specification in the
+         * Creates a {@link Binding} following the specification in the
          * provided config element.
          */
         public JXPathBindingBase getBindingForConfigurationElement(
                 Element configElm) throws BindingException {
             String bindingType = configElm.getLocalName();
             JXPathBindingBuilderBase bindingBuilder = getBindingBuilder(bindingType);
-            JXPathBindingBase childBinding = bindingBuilder.buildBinding(
-                    configElm, this);
+            JXPathBindingBase childBinding = bindingBuilder.buildBinding(configElm, this);
             return childBinding;
         }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/JavaScriptJXPathBindingBuilder.java
Thu Dec  9 12:08:37 2004
@@ -69,11 +69,11 @@
  */
 public class JavaScriptJXPathBindingBuilder extends JXPathBindingBuilderBase implements Contextualizable
{
 
-	private Context avalonContext;
-	
-	public void contextualize(Context context) throws ContextException {
-		this.avalonContext = context;
-	}
+    private Context avalonContext;
+
+    public void contextualize(Context context) throws ContextException {
+        this.avalonContext = context;
+    }
 
     public JXPathBindingBase buildBinding(Element element, Assistant assistant) throws BindingException
{
         try {
@@ -93,7 +93,7 @@
                 loadScript = JavaScriptHelper.buildFunction(loadElem, JavaScriptJXPathBinding.LOAD_PARAMS);
             }
 
-            	// Build save script
+            // Build save script
             Function saveScript = null;
             if (commonAtts.saveEnabled) {
                 Element saveElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE,
"save-form");
@@ -108,37 +108,37 @@
             Map childBindings;
             Element[] children = DomHelper.getChildElements(element, BindingManager.NAMESPACE,
"child-binding");
             if (children.length == 0) {
-            		childBindings = Collections.EMPTY_MAP;
+                childBindings = Collections.EMPTY_MAP;
             } else {
-            		childBindings = new HashMap();
-            		for (int i = 0; i < children.length; i++) {
-            			Element child = children[i];
-
-            			// Get the binding name and check its uniqueness
-            			String name = DomHelper.getAttribute(child, "name");
-            			if (childBindings.containsKey(name)) {
-            				throw new BindingException("Duplicate name '" + name + "' at " + DomHelper.getLocation(child));
-            			}
-            			
-            			// Build the child binding
-            			JXPathBindingBase[] bindings = assistant.makeChildBindings(child);
-            			if (bindings == null) {
-            				bindings = new JXPathBindingBase[0];
-            			}
-            			
-            			ComposedJXPathBindingBase composedBinding = new ComposedJXPathBindingBase(commonAtts,
bindings);
-            			composedBinding.enableLogging(getLogger());
-            			childBindings.put(name, composedBinding);
-            		}
+                childBindings = new HashMap();
+                for (int i = 0; i < children.length; i++) {
+                    Element child = children[i];
+
+                    // Get the binding name and check its uniqueness
+                    String name = DomHelper.getAttribute(child, "name");
+                    if (childBindings.containsKey(name)) {
+                        throw new BindingException("Duplicate name '" + name + "' at " +
DomHelper.getLocation(child));
+                    }
+
+                    // Build the child binding
+                    JXPathBindingBase[] bindings = assistant.makeChildBindings(child);
+                    if (bindings == null) {
+                        bindings = new JXPathBindingBase[0];
+                    }
+
+                    ComposedJXPathBindingBase composedBinding = new ComposedJXPathBindingBase(commonAtts,
bindings);
+                    composedBinding.enableLogging(getLogger());
+                    childBindings.put(name, composedBinding);
+                }
             }
 
             JXPathBindingBase result = new JavaScriptJXPathBinding(this.avalonContext, commonAtts,
id, path, loadScript, saveScript,
-            		Collections.unmodifiableMap(childBindings));
+                Collections.unmodifiableMap(childBindings));
             result.enableLogging(getLogger());
             return result;
 
         } catch(BindingException be) {
-        	    throw be;
+            throw be;
         } catch(Exception e) {
             throw new BindingException("Cannot build binding at " + DomHelper.getLocation(element),
e);
         }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBinding.java
Thu Dec  9 12:08:37 2004
@@ -41,14 +41,18 @@
      * @param widgetId
      * @param childBindings
      */
-    public NewJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String
widgetId, JXPathBindingBase[] childBindings) {
+    public NewJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+            String widgetId, JXPathBindingBase[] childBindings) {
         super(commonAtts, childBindings);
         this.widgetId = widgetId;
         this.classBinding = null;
     }
 
-    private void resolve() {
+    private void resolve() throws BindingException {
         classBinding = getClass(widgetId);
+        if (classBinding == null) {
+            throw new BindingException("Class \"" + widgetId + "\" does not exist");
+        }
     }
 
     /**
@@ -59,16 +63,12 @@
     public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
         if (classBinding == null)
             resolve();
-        if (classBinding instanceof ClassJXPathBinding) {
-            Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
-            if (subBindings != null) {
-                int size = subBindings.length;
-                for (int i = 0; i < size; i++) {
-                    subBindings[i].loadFormFromModel(frmModel, jxpc);
-                }
+        Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
+        if (subBindings != null) {
+            int size = subBindings.length;
+            for (int i = 0; i < size; i++) {
+                subBindings[i].loadFormFromModel(frmModel, jxpc);
             }
-        } else {
-            classBinding.loadFormFromModel(frmModel, jxpc);
         }
     }
 
@@ -80,16 +80,12 @@
     public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
         if (classBinding == null)
             resolve();
-        if (classBinding instanceof ClassJXPathBinding) {
-            Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
-            if (subBindings != null) {
-                int size = subBindings.length;
-                for (int i = 0; i < size; i++) {
-                    subBindings[i].saveFormToModel(frmModel, jxpc);
-                }
+        Binding[] subBindings = ((ComposedJXPathBindingBase)classBinding).getChildBindings();
+        if (subBindings != null) {
+            int size = subBindings.length;
+            for (int i = 0; i < size; i++) {
+                subBindings[i].saveFormToModel(frmModel, jxpc);
             }
-        } else {
-            classBinding.saveFormToModel(frmModel, jxpc);
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java?view=diff&rev=111426&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java&r1=111425&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java&r2=111426
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/NewJXPathBindingBuilder.java
Thu Dec  9 12:08:37 2004
@@ -26,7 +26,7 @@
  * <pre><code>
  * &lt;fb:new id="<i>widget-id</i>"&gt;
  *   &lt;fb:field id="<i>sub-widget-id</i>" path="<i>relative-xpath</i>"
- *       direction="<i>load|save</i>" lenient="<i>true/false</i>"
/>
+ *       direction="<i>load|save</i>" lenient="<i>true/false</i>"/&gt;
  * &lt;/fb:new&gt;
  * </code></pre>
  *

Mime
View raw message