You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jh...@apache.org on 2005/09/09 01:05:35 UTC

svn commit: r279668 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/forms: conf/ java/org/apache/cocoon/forms/event/ java/org/apache/cocoon/forms/formmodel/ java/org/apache/cocoon/forms/resources/ samples/ samples/flow/ samples/forms/

Author: jheymans
Date: Thu Sep  8 16:05:21 2005
New Revision: 279668

URL: http://svn.apache.org/viewcvs?rev=279668&view=rev
Log:
ImageMap widget, contributed by Luca Morandini (#35462)

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/event/ImageMapEvent.java   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMap.java   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinition.java   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/imagemap.js   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_success_jx.xml   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_template.xml   (with props)
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/conf/forms-form.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/conf/forms-form.xconf
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/conf/forms-form.xconf?rev=279668&r1=279667&r2=279668&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/conf/forms-form.xconf (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/conf/forms-form.xconf Thu Sep  8 16:05:21 2005
@@ -42,6 +42,7 @@
       <widget name="union" src="org.apache.cocoon.forms.formmodel.UnionDefinitionBuilder"/>
       <widget name="group" src="org.apache.cocoon.forms.formmodel.GroupDefinitionBuilder"/>
       <widget name="captcha" src="org.apache.cocoon.forms.formmodel.CaptchaDefinitionBuilder"/>
+      <widget name="imagemap" src="org.apache.cocoon.forms.formmodel.ImageMapDefinitionBuilder"/>
     </widgets>
   </forms-formmanager>
 </xconf>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/event/ImageMapEvent.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/event/ImageMapEvent.java?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/event/ImageMapEvent.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/event/ImageMapEvent.java Thu Sep  8 16:05:21 2005
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.forms.event;
+
+import org.apache.cocoon.forms.formmodel.Widget;
+import org.apache.cocoon.forms.formmodel.ImageMap;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.forms.FormContext;
+
+/**
+ * Currently this event originates from a {@link org.apache.cocoon.forms.formmodel.ImageMap}
+ * widget.
+ * 
+ * @author Luca Morandini 
+ */
+public class ImageMapEvent extends ActionEvent {
+
+    public ImageMapEvent(Widget source, String actionCommand) {
+        super(source, actionCommand);
+    }
+    
+    public int getX() {
+    	return ((ImageMap)(source)).getX();
+    }
+
+    public int getY() {
+    	return ((ImageMap)(source)).getY();
+    }
+
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/event/ImageMapEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMap.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMap.java?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMap.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMap.java Thu Sep  8 16:05:21 2005
@@ -0,0 +1,191 @@
+/*
+ * 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.
+ */package org.apache.cocoon.forms.formmodel;
+
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.forms.FormContext;
+import org.apache.cocoon.forms.event.*;
+import org.apache.cocoon.xml.AttributesImpl;
+
+/**
+ * A server-side map widget. An ImageMap widget can cause a {@link ImageMapEvent} to be triggered
+ * on the server side, which will be handled by either the event handlers defined in the
+ * form definition, and/or by the {@link org.apache.cocoon.forms.event.FormHandler FormHandler}
+ * registered with the form, if any. An ImageMap widget is basically an Action widget
+ * displayed as an image and with mouse coordinates stored uòon clicking.
+ * The image's URI can be set or get, or bind via the binding framework, mouse coordinates
+ * can be either retrieved from the ImageMapEvent triggered or from the widget itself.
+ * 
+ * @author Luca Morandini
+ */
+public class ImageMap extends AbstractWidget implements ActionListenerEnabled {
+
+	private final ImageMapDefinition definition;
+    private ActionListener listener;
+    private String imgURI; // URI of widget's image
+	private int x; // Mouse x coordinate
+	private int y; // Mouse y coordinate
+
+	// XML element and attributes
+	public static final String COMMAND_AT = "command";
+	public static final String VALUE_EL = "imageuri";
+	public static final String ONACTION_EL = "on-action";
+	public static final String IMAGEMAP_EL = "imagemap";
+
+    public ImageMap(ImageMapDefinition definition) {
+        super(definition);
+        this.definition = definition;
+    	this.imgURI= definition.getImageURI();
+    	this.x= 0;
+    	this.y= 0;
+    }
+
+    public WidgetDefinition getDefinition() {
+        return this.definition;
+    }
+
+    // Retrieves mouse coordinates
+    public int getX() {
+    	return this.x;
+    }
+    
+    public int getY() {
+    	return this.y;
+    }
+    
+    // Get/set image URI
+    public String getImageURI() {
+    	if ( this.imgURI != null ) {
+    		return this.imgURI;
+   		} else {
+   			return "";
+   	    }
+    }
+
+    public void setImageURI(String newImgURI) {
+    	this.imgURI= newImgURI;
+    }
+
+    // The set/getValue methods are used to set the widget's image URI during binding 
+    public void setValue(Object newImgURI) {
+    	this.setImageURI(newImgURI.toString());
+    }
+
+    public Object getValue() {
+    	return this.getImageURI();
+    }
+
+    public void readFromRequest(final FormContext formContext) {
+        if (!getCombinedState().isAcceptingInputs())
+            return;
+
+        Form form = getForm();
+
+        // Set the submit widget if we can determine it from the request
+        String fullId = getRequestParameterName();
+        Request request = formContext.getRequest();
+
+        // Extracts mouse coordinates from request (ignores malformed numbers)
+        try {
+        	this.x= (new Integer(formContext.getRequest().getParameter(fullId + ".x"))).intValue();
+        	this.y= (new Integer(formContext.getRequest().getParameter(fullId + ".y"))).intValue();
+        } catch (java.lang.NumberFormatException e) {
+        	this.x= 0;
+        	this.y= 0;
+       	}
+        
+        String value = request.getParameter(fullId);
+        if (value != null && value.length() > 0) {
+            form.setSubmitWidget(this);
+
+        } else {
+            // Special workaround an IE bug for <input type="image" name="foo"> :
+            // in that case, IE only sends "foo.x" and "foo.y" and not "foo" whereas
+            // standards-compliant browsers such as Mozilla do send the "foo" parameter.
+            //
+            // Note that since actions are terminal widgets, there's no chance of conflict
+            // with a child "x" or "y" widget.
+            value = request.getParameter(fullId + ".x");
+            if ((value != null) && value.length() > 0) {
+                form.setSubmitWidget(this);
+            }
+        }
+
+        if (form.getSubmitWidget() == this) {
+            form.addWidgetEvent(new ImageMapEvent(this, definition.getActionCommand()));
+
+            handleActivate();
+        }
+    }
+
+    /**
+     * Adds the @imageuri attribute to the XML element
+     */
+    public AttributesImpl getXMLElementAttributes() {
+        AttributesImpl attrs = super.getXMLElementAttributes();
+        attrs.addCDATAAttribute("imageuri", this.imgURI);
+        return attrs;
+    }
+    
+    /**
+     * Handle the fact that this action was activated. The default here is to end the
+     * current form processing and redisplay the form, which means that actual behaviour
+     * should be implemented in event listeners.
+     */
+    protected void handleActivate() {
+        getForm().endProcessing(true);
+    }
+
+    /**
+     * Always return <code>true</code> (an action has no validation)
+     */
+    public boolean validate() {
+        return true;
+    }
+
+    public String getXMLElementName() {        
+        return IMAGEMAP_EL;
+    }  
+
+    /**
+     * Adds an ActionListener to this widget instance. Listeners defined
+     * on the widget instance will be executed in addtion to any listeners
+     * that might have been defined in the widget definition.
+     */
+    public void addActionListener(ActionListener listener) {
+        this.listener = WidgetEventMulticaster.add(this.listener, listener);
+    }
+
+    public void removeActionListener(ActionListener listener) {
+        this.listener = WidgetEventMulticaster.remove(this.listener, listener);
+    }
+
+    private void fireActionEvent(ActionEvent event) {
+        if (this.listener != null) {
+            this.listener.actionPerformed(event);
+        }
+    }
+
+    public void broadcastEvent(WidgetEvent event) {
+        if (event instanceof ActionEvent) {
+            this.definition.fireActionEvent((ActionEvent)event);
+            fireActionEvent((ActionEvent)event);
+        } else {
+            // Other kinds of events
+            super.broadcastEvent(event);
+        }
+    }
+
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinition.java?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinition.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinition.java Thu Sep  8 16:05:21 2005
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.apache.cocoon.forms.event.ActionEvent;
+import org.apache.cocoon.forms.event.ActionListener;
+import org.apache.cocoon.forms.event.WidgetEventMulticaster;
+
+/**
+ * The {@link WidgetDefinition} part of an ImageMap widget, see {@link ImageMap} 
+ * for more information.
+ * 
+ * @author Luca Morandini
+ */
+public class ImageMapDefinition extends AbstractWidgetDefinition {
+	
+    private String actionCommand;
+    private String imgURI; // URI of widget's image
+    private ActionListener listener;
+
+    public void setActionCommand(String actionCommand) {
+        this.actionCommand = actionCommand;
+    }
+
+    public String getActionCommand() {
+        return actionCommand;
+    }
+
+    public Widget createInstance() {
+        return new ImageMap(this);
+    }
+
+    public void addActionListener(ActionListener listener) {
+        checkMutable();
+        this.listener = WidgetEventMulticaster.add(this.listener, listener);
+    }
+    
+    public void fireActionEvent(ActionEvent event) {
+        if (this.listener != null) {
+            this.listener.actionPerformed(event);
+        }
+    }
+
+    public boolean hasActionListeners() {
+        return this.listener != null;
+    }
+
+    // Set/get image's URI
+    public String getImageURI() {
+        return imgURI;
+    }
+
+    public void setImageURI(String newImgURI) {
+    	this.imgURI= newImgURI;
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java Thu Sep  8 16:05:21 2005
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.Iterator;
+
+import org.apache.cocoon.forms.Constants;
+import org.apache.cocoon.forms.event.ActionListener;
+import org.apache.cocoon.forms.util.DomHelper;
+import org.apache.cocoon.util.Deprecation;
+import org.w3c.dom.Element;
+
+/**
+ * Builds {@link ImageMapDefinition}s.
+ * 
+ * @author Luca Morandini
+ */
+public class ImageMapDefinitionBuilder extends AbstractWidgetDefinitionBuilder {
+    
+    public WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception {
+    	ImageMapDefinition definition = new ImageMapDefinition();
+        setupDefinition(widgetElement, definition);
+        definition.makeImmutable();
+        return definition;
+    }
+    
+    protected void setupDefinition(Element widgetElement, ImageMapDefinition definition) throws Exception {
+        super.setupDefinition(widgetElement, definition);
+
+        setDisplayData(widgetElement, definition);
+
+        // Get the "command" optional attribute
+        String actionCommand = DomHelper.getAttribute(widgetElement, ImageMap.COMMAND_AT, null);
+        definition.setActionCommand(actionCommand);
+
+        Iterator iter = buildEventListeners(widgetElement, ImageMap.ONACTION_EL, ActionListener.class).iterator();
+        while (iter.hasNext()) {
+            definition.addActionListener((ActionListener)iter.next());
+        }
+
+        // Sets image map source
+        Element imageURIEl= DomHelper.getChildElement(widgetElement, Constants.DEFINITION_NS, ImageMap.VALUE_EL);
+        if ( imageURIEl != null ) {
+            definition.setImageURI(DomHelper.getElementText(imageURIEl));
+       	} 
+    }
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ImageMapDefinitionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl?rev=279668&r1=279667&r2=279668&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl Thu Sep  8 16:05:21 2005
@@ -483,7 +483,15 @@
   <xsl:template match="fi:upload[@state='output']" priority="3">
       <span id="{@id}"><xsl:copy-of select="fi:value/node()"/></span>
   </xsl:template>
-
+  
+  <!--+
+      | fi:imagemap
+      +-->
+  <xsl:template match="fi:imagemap">
+      <input type ="image" name="{@id}" src="{@imageuri}" title="{fi:hint}" ismap="true">
+          <xsl:apply-templates select="." mode="styling"/>
+      </input>
+  </xsl:template>  
   <!--+
       | fi:repeater
       +-->

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/imagemap.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/imagemap.js?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/imagemap.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/imagemap.js Thu Sep  8 16:05:21 2005
@@ -0,0 +1,37 @@
+/*
+* 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.
+*/
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+
+var form = new Form("forms/imagemap.xml");
+
+function imagemap() {
+    
+    form.showForm("imagemap-display-pipeline");
+
+    var model = form.getModel();
+    var bizdata = { "x" : model.x, "y" : model.y }
+    cocoon.sendPage("imagemap-success-pipeline.jx", bizdata);
+   
+}
+
+function onClickMap (event) {
+    var x= event.getX();
+    var y= event.getY();
+    
+    form.getWidget().lookupWidget("x").setValue(x.toString());
+    form.getWidget().lookupWidget("y").setValue(y.toString());
+
+}

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/flow/imagemap.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap.xml?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap.xml Thu Sep  8 16:05:21 2005
@@ -0,0 +1,37 @@
+<?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:output id="x">
+            <fd:label>x:</fd:label>
+            <fd:datatype base="string">
+            </fd:datatype>
+        </fd:output>
+        <fd:output id="y">
+            <fd:label>y:</fd:label>
+            <fd:datatype base="string">
+            </fd:datatype>
+        </fd:output>
+        <fd:imagemap id="map">
+            <fd:imageuri>/images/cocoon.gif</fd:imageuri>
+            <fd:hint>Click to show coordinates</fd:hint>
+            <fd:on-action>
+                <javascript>onClickMap(event);</javascript>
+            </fd:on-action>
+        </fd:imagemap>
+    </fd:widgets>
+</fd:form>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_success_jx.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_success_jx.xml?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_success_jx.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_success_jx.xml Thu Sep  8 16:05:21 2005
@@ -0,0 +1,27 @@
+<?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.
+-->
+<page>
+    <title>Imagemap result</title>
+    <content>
+    x:  ${x}
+    <br/>
+    y:  ${y}
+    <p>
+      <a href="./imagemap">Restart this sample</a><br/><a href="./">Back to Forms samples</a>
+    </p>
+    </content>
+</page>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_success_jx.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_template.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_template.xml?rev=279668&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_template.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_template.xml Thu Sep  8 16:05:21 2005
@@ -0,0 +1,43 @@
+<?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.
+-->
+<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+    <title>Image map</title>
+    <content>
+        <p>Click on Cocoon logo.</p>
+        <ft:form-template action="continue" method="POST">
+            <ft:continuation-id/>
+            <ft:widget id="map">
+                <fi:styling xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" border="2"/>
+            </ft:widget>
+            <br/>
+            <fieldset>
+                <legend>Coordinates</legend>
+                <fi:group>
+                    <fi:styling layout="columns"/>
+                    <fi:items>
+                        <ft:widget id="x"/>
+                        <ft:widget id="y"/>
+                    </fi:items>
+                </fi:group>
+            </fieldset>
+            <input type="submit"/>
+        </ft:form-template>
+    <p>
+      <a href="./">Back to Forms samples</a>
+    </p>
+    </content>
+</page>

Propchange: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/forms/imagemap_template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap?rev=279668&r1=279667&r2=279668&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sitemap.xmap Thu Sep  8 16:05:21 2005
@@ -75,6 +75,7 @@
     <map:script src="flow/binding_example.js"/>
     <map:script src="flow/upload_example.js"/>
     <map:script src="flow/registration.js"/>
+    <map:script src="flow/imagemap.js"/>
     <map:script src="flow/bindings.js"/>
     <map:script src="flow/form_model_gui.js"/>
     <map:script src="flow/htmlarea.js"/>
@@ -225,7 +226,6 @@
        <map:serialize/>
      </map:match>
 
-
     <!-- Upload Widget Sample -->
 
      <map:match pattern="upload">
@@ -302,7 +302,15 @@
      <map:match pattern="registration">
        <map:call function="registration"/>
      </map:match>
+     
+     <!--
+        | ImageMap form example
+        -->
 
+     <map:match pattern="imagemap">
+       <map:call function="imagemap"/>
+     </map:match>
+    
      <!--
          | Car selector sample.
          -->

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml?rev=279668&r1=279667&r2=279668&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml Thu Sep  8 16:05:21 2005
@@ -52,6 +52,7 @@
   <sample name="Aggregate" href="aggregate/example">Aggregate field examples</sample>
   <sample name="Multipage wizard" href="do-multipage.flow">A multipage wizard, using widget states and actions to move between pages.</sample>
   <sample name="CAPTCHA validation" href="captcha/">CAPTCHA validation (requires <a href="/samples/blocks/batik/">Batik block</a>)</sample>
+  <sample name="ImageMap" href="imagemap">A simple form using the Image Map widget</sample>
  </group>
 
  <group name="Binding Samples">