blob: 754f832b4d0de9512bb0556e96a2af899e7360f7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- $Id$ -->
<html>
<head>
<title>ImageSubmit</title>
<link rel="stylesheet" type="text/css" href="Tapestry.css" title="style">
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><A href="Image.html"><IMG alt=Image src="common-images/prev.png"></A></td>
<td align="middle"><A href="index.html"><IMG alt="Component Index" src="common-images/home.png" ></A></td>
<td align="right"><A href="Insert.html"><IMG alt=Insert src="common-images/next.png"></A></td>
<tr>
<tr>
<td colspan="3"><hr></td>
</tr>
<tr>
<td colspan="3">
<table border="0" cellpadding="4" cellspacing="4" width="100%">
<TBODY>
<tr valign="top">
<td>
<table>
<tr>
<td><font size="+2"><b>ImageSubmit</b></font></td>
</tr>
<tr>
<td>
<A href="../api/org/apache/tapestry/form/ImageSubmit.html">
org.apache.tapestry.form.ImageSubmit</A>
</td>
</tr>
</table>
</td>
<td>
<table align="right" valign="middle" bgcolor="#c0c0c0" cellpadding="8">
<tr>
<td><A href="ImageSubmit.html"><IMG alt=Submit src="images/intray.png"></A></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2">
<b>Description</b>
<br>
Provides an image button inside a <A href="Form.html">Form</A>. Clicking the
button submits the form and may notify a configured
<A href="../api/org/apache/tapestry/IActionListener.html">listener</A>
or select property.
<p>
The <a href="http://java.sun.com/products/jdk/1.2/docs/api/java/awt/Point.html">
<tt>Point</tt></a> parameter can be used to determine where on the image
the user clicked.
<p>
In typical use, the application needs to know which ImageSubmit
was the one clicked by the user. This can be accomplished in two ways:
<ul>
<li>Use the <b>selected</b> and <b>tag</b> parameters to identify
the button.
<li>Use the <b>listener</b> to perform an operation directly</li>
</ul>
<p>
If a listener is used, it will be invoked as the ImageSubmit
component is rewound. In addition, the <A href="Form.html">Form</A>'s
listener will invoked if it is defined.
<p>
Use the first method if you need to be sure that the entire form has rewound
before any logic specific to the ImageSubmit is triggered.
</p>
</td>
</tr>
<tr>
<td colspan="2">
<b>See Also</b>
<br>
<A href="Form.html">Form</A>,
<A href="Image.html">Image</A>,
<A href="Submit.html">Submit</A>
</td>
</tr>
<tr>
<td colspan="2">
<b>Parameters</b>
<br>
<table border="1" cellpadding="4" cellspacing="4" class="parameters">
<tr>
<th>Name</th>
<th>Type</th>
<th>Direction</th>
<th>Required</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<td>image</td>
<td><A href="../api/org/apache/tapestry/IAsset.html"><tt>IAsset</tt></A></td>
<td>in</td>
<td>yes</td>
<td>&nbsp;</td>
<td>The image to show.</td>
</tr>
<tr>
<td>name</td>
<td>String</td>
<td>in</td>
<td>no</td>
<td>&nbsp;</td>
<td>
The name to use for the form element. Under Netscape Navigator 4, this name
becomes the tooltip. The name may be modified (by adding a number to the
end) to ensure that it is unique within the form.
</td>
</tr>
<tr>
<td>disabled</td>
<td>boolean</td>
<td>in</td>
<td>no</td>
<td>false</td>
<td>
If set to true, the button will be disabled (will not respond to the mouse).
If an alternate image is defined, it will be displayed (typically a
greyed-out version of the normal image).
</td>
</tr>
<tr>
<td>disabledImage</td>
<td><A href="../api/org/apache/tapestry/IAsset.html"><tt>IAsset</tt></A></td>
<td>in</td>
<td>no</td>
<td>&nbsp;</td>
<td>
An alternate image to display if the component is disabled. If the component
is disabled and this parameter is not specified, the normal image is used.
</td>
</tr>
<tr>
<td>point</td>
<td>
<a href="http://java.sun.com/products/jdk/1.2/docs/api/java/awt/Point.html">
<tt>Point</tt></a>
</td>
<td>out</td>
<td>no</td>
<td>&nbsp;</td>
<td>
The point at which the image was clicked; used for rare components that
actually need to know (typically, using the image button list a simple image
map).
</td>
</tr>
<tr>
<td>selected</td>
<td>Object</td>
<td>out</td>
<td>no</td>
<td>&nbsp;</td>
<td>
This parameter is bound to a property that is updated when the image button
is clicked by the user (submitting the form). The property is updated to
match the tag parameter.
</td>
</tr>
<tr>
<td>tag</td>
<td>Object</td>
<td>in</td>
<td>no</td>
<td>&nbsp;</td>
<td>
Tag used with the selected parameter to indicate which image button on a
form was clicked. This parameter is required if the selected paremeter is
used.
</td>
</tr>
<tr>
<td>listener</td>
<td>
<A href="../api/org/apache/tapestry/IActionListener.html">
<tt>IActionListener</tt></A>
</td>
<td>in</td>
<td>no</td>
<td>&nbsp;</td>
<td>
If specified, the listener is notified. This notification occurs as the
component is rewound, i.e., prior to the <A href="Form.html">form</A>'s
listener. In addition, the selected property (if bound) will be updated
before the listener is notified.
</td>
</tr>
</table>
<P>
Body: <STRONG>removed</STRONG><BR>
Informal parameters: <STRONG>allowed</STRONG><br>
Reserved parameters: "src", "type", "border"
</P>
</td>
</tr>
<tr>
<td colspan="2">
<b>Examples</b>
<p>
This example uses the ImageSubmit to provide two form processing priority
image buttons.
</p>
<table cellspacing="12" bgcolor="#c0c0c0">
<form>
<tr>
<td>
<img alt="Standard Submit" src="images/intray-green.png"/>
<img alt="Urgent Submit" src="images/intray-red.png"/>
</td>
</tr>
</form>
</table>
<pre>
&lt;form jwcid="@<a href="Form.html">Form</a>"&gt;
&lt;img jwcid="<span class="jwcid">@<a href="ImageSubmit.html">ImageSubmit</a></span>" image="ognl:assets.standardImage" listener="ognl:listeners.standardSubmit" alt="Standard Submit"/&gt;
&lt;img jwcid="<span class="jwcid">@<a href="ImageSubmit.html">ImageSubmit</a></span>" image="ognl:assets.urgentImage" listener="ognl:listeners.urgentSubmit" alt="Urgent Submit"/&gt;
&lt;/form&gt;
&lt;private-asset name="standardImage" resource-path="/com/mycorp/intray-green.png"/&gt;
&lt;private-asset name="urgentImage" resource-path="/com/mycorp/intray-red.png"/&gt;
package com.mycorp;
public class FormPage extends BasePage {
public void standardSubmit(IRequesCycle cycle) {
// Process standard priority submit.
..
}
public void urgentSubmit(IRequesCycle cycle) {
// Process urgent priority submit.
..
}
}
</pre>
</td>
</tr>
</TBODY>
</table></tr>
<tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2">
<table width="100%">
<tr>
<td align="left">
<A href="Image.html"><IMG alt=Previous src="common-images/prev.png"></A>
</td>
<td align="middle">
<A href="index.html"><IMG alt=Home src="common-images/home.png"></A>
</td>
<td align="right">
<A href="Insert.html"><IMG alt=Next src="common-images/next.png"></A>
</td>
<tr></tr>
</table>
</td>
</tr>
</table>
</body>
</html>