cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r154564 - in cocoon/trunk/src/blocks/forms: java/org/apache/cocoon/forms/binding/ java/org/apache/cocoon/forms/flow/javascript/ java/org/apache/cocoon/forms/flow/javascript/v2/ java/org/apache/cocoon/forms/flow/javascript/v3/ java/org/apache/cocoon/forms/formmodel/ java/org/apache/cocoon/forms/transformation/ java/org/apache/cocoon/forms/util/ samples/ samples/forms/ samples/forms/binding/ samples/swan/forms/ test/org/apache/cocoon/forms/datatype/convertor/
Date Sun, 20 Feb 2005 21:46:45 GMT
Author: sylvain
Date: Sun Feb 20 13:46:41 2005
New Revision: 154564

URL: http://svn.apache.org/viewcvs?view=rev&rev=154564
Log:
Merge branches

Added:
    cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml   (with props)
    cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-data.xml   (with props)
    cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml   (with props)
Modified:
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/Form.js
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java
    cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java
    cocoon/trunk/src/blocks/forms/samples/forms/registration_template.xml
    cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml
    cocoon/trunk/src/blocks/forms/samples/welcome.xml
    cocoon/trunk/src/blocks/forms/test/org/apache/cocoon/forms/datatype/convertor/EnumConvertorBuilderTestCase.java

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/ContextJXPathBinding.java
Sun Feb 20 13:46:41 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/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBase.java
Sun Feb 20 13:46:41 2005
@@ -16,6 +16,7 @@
 package org.apache.cocoon.forms.binding;
 
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.avalon.framework.logger.LogEnabled;
@@ -155,6 +156,7 @@
             throws BindingException {
         boolean inheritedLeniency = jxpc.isLenient();
         applyLeniency(jxpc);
+        applyNSDeclarations(jxpc);
         if (this.commonAtts.loadEnabled) {
             doLoad(frmModel, jxpc);
         }
@@ -194,6 +196,7 @@
             throws BindingException{
         boolean inheritedLeniency = jxpc.isLenient();
         applyLeniency(jxpc);
+        applyNSDeclarations(jxpc);
         if (this.commonAtts.saveEnabled) {
             doSave(frmModel, jxpc);
         }
@@ -219,6 +222,20 @@
     private void applyLeniency(JXPathContext jxpc) {
         if (this.commonAtts.leniency != null) {
             jxpc.setLenient(this.commonAtts.leniency.booleanValue());
+        }
+    }
+
+    private void applyNSDeclarations(JXPathContext jxpc)
+    {
+        if (this.commonAtts.nsDeclarations != null)
+        {
+            Iterator keysIter = this.commonAtts.nsDeclarations.keySet().iterator();
+            while (keysIter.hasNext())
+            {
+                String nsuri = (String) keysIter.next();
+                String pfx = (String) this.commonAtts.nsDeclarations.get(nsuri);
+                jxpc.registerNamespace(pfx, nsuri);
+            }
         }
     }
 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/JXPathBindingBuilderBase.java
Sun Feb 20 13:46:41 2005
@@ -15,6 +15,8 @@
  */
 package org.apache.cocoon.forms.binding;
 
+import java.util.Map;
+
 import org.apache.avalon.framework.logger.LogEnabled;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.cocoon.forms.util.DomHelper;
@@ -111,7 +113,22 @@
 
             String leniency = DomHelper.getAttribute(bindingElm, "lenient", null);
 
-            return new CommonAttributes(location, direction, leniency);
+            //TODO: current jxpath is not inheriting registered namespaces over to 
+            // child-relative jxpath contexts --> because of that we can't just 
+            // remember the getLocalNSDeclarations but need the full set from 
+            // getInheritedNSDeclarations
+            // IMPORTANT NOTE: if jxpath would change this behaviour we would however
+            // still need to be able to unregister namespace-declarations 
+            // (in a smart way: unhide what is possably available from your parent.   
+            // So both changes to jxpath need to be available before changing the below.
+            Map nsDeclarationMap = DomHelper.getInheritedNSDeclarations(bindingElm);
+            // we (actually jxpath) doesn't support un-prefixed namespace-declarations:
+            // so we decide to break on those above silently ignoring them
+            if (nsDeclarationMap != null && nsDeclarationMap.values().contains(null))
+                throw new BindingException("Error in binding file " + location
+                                + "\nBinding doesn't support having namespace-declarations
without explicit prefixes.");
+            
+            return new CommonAttributes(location, direction, leniency, nsDeclarationMap);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {
@@ -143,18 +160,23 @@
          * should be operating in lenient mode or not 
          */
         final Boolean leniency;
+        /**
+         * Array of namespace-declarations (prefix-uri pairs) that need to be set on the
jxpath 
+         */
+        final Map nsDeclarations;
 
-        final static CommonAttributes DEFAULT = new CommonAttributes("location unknown",
true, true, null);
+        final static CommonAttributes DEFAULT = new CommonAttributes("location unknown",
true, true, null, null);
 
-        CommonAttributes(String location, String direction, String leniency){
-            this(location, isLoadEnabled(direction), isSaveEnabled(direction), decideLeniency(leniency));
+        CommonAttributes(String location, String direction, String leniency, Map nsDeclarations){
+            this(location, isLoadEnabled(direction), isSaveEnabled(direction), decideLeniency(leniency),
nsDeclarations);
         }
 
-        CommonAttributes(String location, boolean loadEnabled, boolean saveEnabled, Boolean
leniency){
+        CommonAttributes(String location, boolean loadEnabled, boolean saveEnabled, Boolean
leniency, Map nsDeclarations){
             this.location = location;
             this.loadEnabled = loadEnabled;
             this.saveEnabled = saveEnabled;
             this.leniency = leniency;
+            this.nsDeclarations = nsDeclarations;
         }
 
         /**

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
Sun Feb 20 13:46:41 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 $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() +
"]";
     }
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/Form.js Sun
Feb 20 13:46:41 2005
@@ -115,9 +115,6 @@
         throw "Forms do not support custom javascript validators anymore. Declare your validators
in the form model file.";
     }
 
-    // Fire any events pending from binding, etc.
-    this.form.fireEvents();
-
     do {
         var k = cocoon.sendPageAndWait(uri, bizData);
         if (result == null) result = k;

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js
Sun Feb 20 13:46:41 2005
@@ -113,10 +113,6 @@
     var FormContext = Packages.org.apache.cocoon.forms.FormContext;
     // this is needed by the FormTemplateTransformer:
     var javaWidget = this.formWidget_.unwrap();
-
-    // Fire any events pending from binding, etc.
-    javaWidget.fireEvents();
-
     this.formWidget_["CocoonFormsInstance"] = javaWidget;
     cocoon.request.setAttribute(Packages.org.apache.cocoon.forms.transformation.CFORMSKEY,
javaWidget);
     var wk = cocoon.sendPageAndWait(uri, this.formWidget_, fun, ttl); 

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/ScriptableWidget.java
Sun Feb 20 13:46:41 2005
@@ -683,12 +683,6 @@
         }
     }
 
-    public void jsFunction_removeSelectionList() {
-    	if (delegate instanceof SelectableWidget) {
-    		((SelectableWidget)delegate).removeSelectionList();
-    	}
-    }
-
     static final Object[] WIDGET_CLASS_MAP = {
         Form.class, "Form",
         Field.class, "Field",

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/Form.js
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/Form.js?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/Form.js
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/Form.js
Sun Feb 20 13:46:41 2005
@@ -83,9 +83,6 @@
         viewData = new Object();
     viewData["CocoonFormsInstance"] = this.form;
 
-    // Fire any events pending from binding, etc.
-    this.form.fireEvents();
-
     var webCont;
     var finished = false;
     while (!finished) {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v3/ScriptableWidget.java
Sun Feb 20 13:46:41 2005
@@ -390,7 +390,7 @@
             delegate.setValue(value);
         } else if (delegate instanceof BooleanField) {
             BooleanField field = (BooleanField)delegate;
-            field.setValue(new Boolean(Context.toBoolean(value)));
+            field.setValue(Boolean.valueOf(Context.toBoolean(value)));
         } else if (delegate instanceof Repeater) {
             Repeater repeater = (Repeater)delegate;
             if (value instanceof NativeArray) {
@@ -752,12 +752,6 @@
                 }
             }
         }
-    }
-
-    public void jsFunction_removeSelectionList() {
-    	if (delegate instanceof SelectableWidget) {
-    		((SelectableWidget)delegate).removeSelectionList();
-    	}
     }
 
     static final Object[] WIDGET_CLASS_MAP = {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
Sun Feb 20 13:46:41 2005
@@ -45,16 +45,6 @@
     private Widget parent;
 
     /**
-     * Process request parameters for this widget?
-     */
-    private boolean processMyRequests = true;
-
-    /**
-     * Process request parameters for children of this widget?
-     */
-    private boolean processChildRequests = true;
-
-    /**
      * The widget's own state
      */
     private WidgetState state = WidgetState.ACTIVE;
@@ -241,31 +231,6 @@
 
     public void setValue(Object object) {
         throw new RuntimeException("Cannot set the value of widget " + getRequestParameterName());
-    }
-
-    /**
-     * Controls whether {@link #readFromRequest(FormContext formContext)}
-     * processes the request parameter(s) for this widget and its children.
-     */
-    public void setProcessRequests(boolean processRequests) {
-      this.processMyRequests = processRequests;
-      this.processChildRequests = processRequests;
-    }
-
-    /**
-     * Controls whether {@link #readFromRequest(FormContext formContext)}
-     * processes the request parameter(s) for this widget.
-     */
-    public void setProcessMyRequests(boolean processMyRequests) {
-      this.processMyRequests = processMyRequests;
-    }
-
-    /**
-     * Controls whether {@link #readFromRequest(FormContext formContext)}
-     * processes the request parameter(s) for children of this widget.
-     */
-    public void setProcessChildRequests(boolean processChildRequests) {
-      this.processChildRequests = processChildRequests;
     }
 
     public boolean isRequired() {

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/BooleanField.java
Sun Feb 20 13:46:41 2005
@@ -69,12 +69,8 @@
         validationError = null;
         Object oldValue = value;
         String param = formContext.getRequest().getParameter(getRequestParameterName());
-        if (param != null && param.equalsIgnoreCase("true"))
-            value = Boolean.TRUE;
-        else
-            value = Boolean.FALSE;
-
-        if (value != oldValue) {
+        value = Boolean.valueOf(param);
+        if (!value.equals(oldValue)) {
             getForm().addWidgetEvent(new ValueChangedEvent(this, oldValue, value));
         }
     }
@@ -148,7 +144,7 @@
 
         Object oldValue = value;
         value = (Boolean)object;
-        if (value != oldValue) {
+        if (!value.equals(oldValue)) {
             getForm().addWidgetEvent(new ValueChangedEvent(this, oldValue, value));
         }
     }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Field.java Sun Feb
20 13:46:41 2005
@@ -453,14 +453,6 @@
         setSelectionList(getFieldDefinition().buildSelectionListFromModel(model, valuePath,
labelPath));
     }
 
-    /**
-     * Delete this field's selection list.
-     */
-    public void removeSelectionList() {
-    	this.selectionList = null;
-    	getFieldDefinition().setSelectionList(null);
-    }
-
     public Datatype getDatatype() {
         return getFieldDefinition().getDatatype();
     }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Form.java Sun Feb
20 13:46:41 2005
@@ -86,7 +86,7 @@
      * Fire the events that have been queued.
      * Note that event handling can fire new events.
      */
-    public void fireEvents() {
+    private void fireEvents() {
         if (this.events != null) {
             CursorableLinkedList.Cursor cursor = this.events.cursor();
             while(cursor.hasNext()) {
@@ -248,7 +248,7 @@
      * @param redisplayForm indicates if the form should be redisplayed to the user.
      */
     public void endProcessing(boolean redisplayForm) {
-        this.endProcessing = new Boolean(!redisplayForm);
+        this.endProcessing = Boolean.valueOf(!redisplayForm);
     }
 
     /**

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/MultiValueField.java
Sun Feb 20 13:46:41 2005
@@ -213,16 +213,6 @@
     }
 
     /**
-     * Delete this field's selection list.
-     */
-    public void removeSelectionList() {
-    	this.selectionList = null;
-    	if(this.definition != null) {
-    		this.definition.setSelectionList(null);
-    	}
-    }
-
-    /**
      * Set this field's selection list using values from an in-memory
      * object. The <code>object</code> parameter should point to a collection
      * (Java collection or array, or Javascript array) of objects. Each object

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/SelectableWidget.java
Sun Feb 20 13:46:41 2005
@@ -28,6 +28,4 @@
     public void setSelectionList(String uri);
 
     public void setSelectionList(Object model, String valuePath, String labelPath);
-
-    public void removeSelectionList();
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Widget.java Sun Feb
20 13:46:41 2005
@@ -146,24 +146,6 @@
     public Widget lookupWidget(String path);
 
     /**
-     * Controls whether {@link #readFromRequest(FormContext formContext)}
-     * processes the request parameter(s) for this widget and its children.
-     */
-    public void setProcessRequests(boolean processRequests);
-
-    /**
-     * Controls whether {@link #readFromRequest(FormContext formContext)}
-     * processes the request parameter(s) for this widget.
-     */
-    public void setProcessMyRequests(boolean processMyRequests);
-
-    /**
-     * Controls whether {@link #readFromRequest(FormContext formContext)}
-     * processes the request parameter(s) for children of this widget.
-     */
-    public void setProcessChildRequests(boolean processChildRequests);
-
-    /**
      * Lets this widget read its data from a request. At this point the Widget
      * may try to convert the request parameter to its native datatype (if it
      * is not a string), but it should not yet generate any validation errors.

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectPipe.java
Sun Feb 20 13:46:41 2005
@@ -59,7 +59,7 @@
     protected static final int EVENT_END_CDATA              =17;
     protected static final int EVENT_COMMENT                =18;
 
-    protected class Element {
+    protected static class Element {
         public final String prefix;
         public final String uri;
         public final String loc;

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
(original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/transformation/EffectWidgetReplacingPipe.java
Sun Feb 20 13:46:41 2005
@@ -610,13 +610,19 @@
                 if (isVisible(widget)) {
                     contextWidgets.addFirst(contextWidget);
                     contextWidget = widget;
-                    return this;
+                    //Don't output fi:struct
+                    // out.element(Constants.INSTANCE_PREFIX, Constants.INSTANCE_NS, "union");
+                    // out.attributes();
+                    // out.startElement();      
+                   return this;
                 } else {
                     return nullHandler;
                 }
             case EVENT_ELEMENT:
                 return nestedTemplate();
             case EVENT_END_ELEMENT:
+                // don't output fi:struct
+                // out.endElement();
                 contextWidget = (Widget)contextWidgets.removeFirst();
                 return this;
             default:
@@ -822,7 +828,7 @@
             case EVENT_START_ELEMENT:
                 // Insert the continuation id
                 // FIXME(SW) we could avoid costly JXPath evaluation if we had the objectmodel
here.
-                Object idObj = pipeContext.evaluateExpression("$continuation/id");
+                Object idObj = pipeContext.evaluateExpression("$cocoon/continuation/id");
                 if (idObj == null) {
                     throwSAXException("No continuation found");
                 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java Sun Feb
20 13:46:41 2005
@@ -17,6 +17,11 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
 
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
@@ -33,9 +38,11 @@
 import org.apache.xerces.xni.XMLAttributes;
 import org.apache.xerces.xni.XMLLocator;
 import org.apache.xerces.xni.XNIException;
+import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
@@ -58,6 +65,8 @@
  */
 public class DomHelper {
 
+    public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
+
     /**
      * Retrieves the location of an element node in the source file from which
      * the Document was created. This will only work for Document's created
@@ -118,8 +127,7 @@
      * Returns all Element children of an Element that belong to the given
      * namespace.
      */
-    public static Element[] getChildElements(Element element,
-            String namespace) {
+    public static Element[] getChildElements(Element element, String namespace) {
         ArrayList elements = new ArrayList();
         NodeList nodeList = element.getChildNodes();
         for (int i = 0; i < nodeList.getLength(); i++) {
@@ -128,7 +136,7 @@
                     && namespace.equals(node.getNamespaceURI()))
                 elements.add(node);
         }
-        return (Element[])elements.toArray(new Element[0]);
+        return (Element[])elements.toArray(new Element[elements.size()]);
     }
 
     /**
@@ -147,7 +155,7 @@
                 elements.add(node);
             }
         }
-        return (Element[])elements.toArray(new Element[0]);
+        return (Element[])elements.toArray(new Element[elements.size()]);
     }
 
     /**
@@ -390,5 +398,54 @@
                 node.setUserData("location", location, null);
             }
         }
+    }
+
+    public static Map getLocalNSDeclarations(Element elm)
+    {
+        return addLocalNSDeclarations(elm, null);
+    }
+    
+    private static Map addLocalNSDeclarations(Element elm, Map nsDeclarations)
+    {
+        NamedNodeMap atts = elm.getAttributes();
+        int attsSize = atts.getLength();
+
+        for (int i = 0; i < attsSize; i++)
+        {
+            Attr attr = (Attr)atts.item(i);
+            if (XMLNS_URI.equals(attr.getNamespaceURI()))
+            {
+                String nsUri = attr.getValue();
+                String pfx = attr.getLocalName();
+                if (nsDeclarations == null)
+                    nsDeclarations = new HashMap();
+                nsDeclarations.put(nsUri, pfx);
+            }
+        }        
+        return nsDeclarations;    }
+    
+    public static Map getInheritedNSDeclarations(Element elm)
+    {
+        List ancestorsAndSelf = new LinkedList();
+        Element current = elm;
+        while (current != null) 
+        {
+            ancestorsAndSelf.add(current);
+            Node parent = current.getParentNode();
+            if (parent.getNodeType() == Node.ELEMENT_NODE)
+                current = (Element)parent;
+            else 
+                current = null;
+        }
+        
+        Map nsDeclarations = null;
+        ListIterator iter = ancestorsAndSelf.listIterator(ancestorsAndSelf.size());
+        while (iter.hasPrevious())
+        {
+            Element element = (Element) iter.previous();
+            nsDeclarations = addLocalNSDeclarations(element, nsDeclarations);
+        }
+        
+        return nsDeclarations;
     }
 }

Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/util/XMLAdapter.java Sun Feb
20 13:46:41 2005
@@ -307,7 +307,7 @@
             // FIXME: BooleanField should implement DataWidget, which
             // would make this case unnecessary
             if (widget.getValue() != null) {
-                data((Boolean)widget.getValue() == Boolean.TRUE ? "true" : "false");
+                data(widget.getValue().toString());
             }
         } else if (widget instanceof MultiValueField) {
             Datatype datatype = ((MultiValueField)widget).getDatatype();

Added: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml?view=auto&rev=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml (added)
+++ cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml Sun Feb 20 13:46:41
2005
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" 
+            xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
+            xmlns:h="http://www.w3.org/1999/xhtml"
+	    path="/" >
+
+<!-- 
+   | This file binds form data to a namespaced XML
+   -->
+   
+  <fb:context path="h:html/h:head" >
+    <fb:value id="title" path="html:title" lenient="true" />
+  </fb:context>
+            
+  <fb:context path="x:stylesheet" xmlns:x="http://www.w3.org/1999/XSL/Transform">
+    <fb:value id="template" path="x:template/@name" lenient="true"/>
+  </fb:context>
+            
+  <fb:context path="." xmlns:f="http://www.w3.org/1999/XSL/Format">
+    <fb:value id="flowname" path="f:root/f:page-sequence/f:flow/@flow-name" lenient="true"/>
+  </fb:context>
+
+</fb:context>

Propchange: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-bind.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-data.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-data.xml?view=auto&rev=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-data.xml (added)
+++ cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-data.xml Sun Feb 20 13:46:41
2005
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<test>
+    <html:html xmlns:html="http://www.w3.org/1999/xhtml">
+        <html:head>
+            <html:title>some title</html:title>
+        </html:head>
+    </html:html>
+    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+        <xsl:template name="template-name"/>
+    </xsl:stylesheet>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+        <fo:page-sequence><fo:flow flow-name="flow-name" /></fo:page-sequence>
+    </fo:root>
+</test>

Propchange: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-data.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml?view=auto&rev=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml (added)
+++ cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml Sun Feb 20 13:46:41
2005
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<fd:form
+  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+  <fd:widgets>
+    <fd:field id="title">
+      <fd:label>Enter an HTML title</fd:label>
+      <fd:datatype base="string" />
+    </fd:field>
+    <fd:field id="template">
+      <fd:label>Enter an XSL template name</fd:label>
+      <fd:datatype base="string" />
+    </fd:field>  
+    <fd:field id="flowname">
+      <fd:label>And now a XSL:FO flow name</fd:label>
+      <fd:datatype base="string" />
+    </fd:field>  
+  </fd:widgets>
+</fd:form>

Propchange: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/src/blocks/forms/samples/forms/binding/06namespaced-def.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/src/blocks/forms/samples/forms/registration_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/samples/forms/registration_template.xml?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/samples/forms/registration_template.xml (original)
+++ cocoon/trunk/src/blocks/forms/samples/forms/registration_template.xml Sun Feb 20 13:46:41
2005
@@ -18,7 +18,8 @@
   xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
   <title>Registration</title>
   <content>
-    <ft:form-template action="#{$cocoon/continuation/id}.continue" method="POST">
+    <ft:form-template action="continue" method="POST">
+      <ft:continuation-id/>
       <fi:group>
         <fi:styling layout="columns"/>
         <fi:items>

Modified: cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml (original)
+++ cocoon/trunk/src/blocks/forms/samples/swan/forms/xreport_model.xml Sun Feb 20 13:46:41
2005
@@ -82,11 +82,11 @@
               var union = widget.lookupWidget("../union");
               var type = widget.lookupWidget("../type-selector");
               if(widget.getValue().equals("edit")) {
-                union.setProcessRequests(true);
-                type.setProcessRequests(true);
+	        union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+		type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
               } else {
-                union.setProcessRequests(false);
-                type.setProcessRequests(false);
+	        union.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
+		type.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);
               }
             </javascript>
           </fd:on-value-changed>

Modified: cocoon/trunk/src/blocks/forms/samples/welcome.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/samples/welcome.xml?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/samples/welcome.xml (original)
+++ cocoon/trunk/src/blocks/forms/samples/welcome.xml Sun Feb 20 13:46:41 2005
@@ -37,6 +37,7 @@
   <sample name="Various (Flowscript)" href="form1.flow">The same sample as above using
Flowscript.</sample>
   <sample name="Registration" href="registration">A simple registration form.</sample>
   <sample name="Car selector" href="carselector">Illustrates programmatically changing
selectionlists.</sample>
+  <sample name="XHR Car selector" href="xhr_carselector">Same sample, using XmlHttpRequest
to reduce client/server roundtrips.</sample>
   <sample name="Country selector" href="countryselector">Illustrates programmatically
changing flow-jxpath selectionlists.</sample>
   <sample name="Upload" href="upload">Shows an upload widget used with Flowscript</sample>
   <sample name="Form Model GUI" href="form_model_gui.flow">Illustrates the use of Class,
New, Struct, and Union.</sample>
@@ -60,6 +61,7 @@
   <sample name="3. Aggregate Binding" href="binding-03aggregate.flow">fb:aggregate</sample>
   <sample name="4. Heavy Form" href="binding-04heavy-XML.flow">Form with lots of select
boxes - test memory utilization, performance</sample>
   <sample name="5. Custom Bindings using Java or Javascript" href="binding-05custom.flow">fb:javascript
and fb:custom</sample>
+  <sample name="6. XML binding using namespaces" href="binding-06namespaced-XML.flow">Using
XML binding with complex namespaced XML</sample>
   <!-- TODO: provide more tutorial samples like these:
   <sample name="6. MultiValue/Repeater Binding" href="binding-03multi.flow">fb:multi-value</sample>
   <sample name="7. Repeater Binding" href="binding-06repeater.flow">fb:repeater</sample>

Modified: cocoon/trunk/src/blocks/forms/test/org/apache/cocoon/forms/datatype/convertor/EnumConvertorBuilderTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/forms/test/org/apache/cocoon/forms/datatype/convertor/EnumConvertorBuilderTestCase.java?view=diff&r1=154563&r2=154564
==============================================================================
--- cocoon/trunk/src/blocks/forms/test/org/apache/cocoon/forms/datatype/convertor/EnumConvertorBuilderTestCase.java
(original)
+++ cocoon/trunk/src/blocks/forms/test/org/apache/cocoon/forms/datatype/convertor/EnumConvertorBuilderTestCase.java
Sun Feb 20 13:46:41 2005
@@ -39,16 +39,12 @@
      * @see junit.framework.TestCase#setUp()
      */
     protected void setUp() throws Exception {
+        super.setUp();
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setNamespaceAware(true);
         parser = factory.newDocumentBuilder();
     }
 
-    /* (non-Javadoc)
-     * @see junit.framework.TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-    }
 
     public EnumConvertorBuilderTestCase(String name) {
         super(name);



Mime
View raw message