summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java
diff options
context:
space:
mode:
authorBenjamin Culkin <scorpress@gmail.com>2024-05-20 17:58:16 -0400
committerBenjamin Culkin <scorpress@gmail.com>2024-05-20 17:58:16 -0400
commit40a9d99496e098562f090fb7ffce9e749011b131 (patch)
tree437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java
parentff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff)
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java')
-rw-r--r--projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java78
1 files changed, 41 insertions, 37 deletions
diff --git a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java
index 7c9f22e..ebb9ae1 100644
--- a/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java
+++ b/projects/net.wotonomy.web/src/main/java/net/wotonomy/web/WOImageButton.java
@@ -5,17 +5,21 @@ import net.wotonomy.foundation.NSArray;
import net.wotonomy.foundation.NSDictionary;
/**
- * WOImageButton renders a dynamically generated IMG tag or an INPUT tag, depending on whether the
- * element is inside a WOForm (in which case an INPUT of type IMAGE is generated) or not (in which
- * case the equivalent of a WOActiveImage)
+ * WOImageButton renders a dynamically generated IMG tag or an INPUT tag,
+ * depending on whether the element is inside a WOForm (in which case an INPUT
+ * of type IMAGE is generated) or not (in which case the equivalent of a
+ * WOActiveImage)
*
* Bindings are:
* <UL>
* <LI>src: A static URL for the image source.</li>
- * <li>data: A NSData object with the image content. Must be used with mimeType.</li>
- * <li>mimeType: The MIME type for the image data. Can be used with filename or data bindings.</li>
+ * <li>data: A NSData object with the image content. Must be used with
+ * mimeType.</li>
+ * <li>mimeType: The MIME type for the image data. Can be used with filename or
+ * data bindings.</li>
* <li>filename: The path to a file containing an image.</li>
- * <li>framework: The framework where the image should be retrieved from (used in conjunction with filename).</li>
+ * <li>framework: The framework where the image should be retrieved from (used
+ * in conjunction with filename).</li>
*
* @author ezamudio@nasoft.com
* @author $Author: cgruber $
@@ -23,36 +27,36 @@ import net.wotonomy.foundation.NSDictionary;
*/
public class WOImageButton extends WOImage {
- protected WOImageButton() {
- super();
- }
-
- public WOImageButton(String aName, NSDictionary aMap, WOElement template) {
- super(aName, aMap, template);
- }
-
- public String buttonName(WOContext c) {
- String x = (String)valueForProperty("name", c.component());
- if (x != null)
- return x;
- return c.elementID();
- }
-
- public void appendToResponse(WOResponse r, WOContext c) {
- if (c.isInForm()) {
- //generate an INPUT
- r.appendContentString("<INPUT TYPE=IMAGE NAME=\"");
- r.appendContentString(buttonName(c));
- r.appendContentString("\" SRC=\"");
- r.appendContentString(sourceURL(c));
- r.appendContentString("\"");
- r.appendContentString(additionalHTMLProperties(c.component(), new NSArray(new Object[]{
- "name", "action", "src", "filename", "framework", "data", "mimeType" })));
- r.appendContentString(">");
- } else {
- //generate a WOActiveImage
- new WOActiveImage(name, associations, rootElement).appendToResponse(r, c);
- }
- }
+ protected WOImageButton() {
+ super();
+ }
+
+ public WOImageButton(String aName, NSDictionary aMap, WOElement template) {
+ super(aName, aMap, template);
+ }
+
+ public String buttonName(WOContext c) {
+ String x = (String) valueForProperty("name", c.component());
+ if (x != null)
+ return x;
+ return c.elementID();
+ }
+
+ public void appendToResponse(WOResponse r, WOContext c) {
+ if (c.isInForm()) {
+ // generate an INPUT
+ r.appendContentString("<INPUT TYPE=IMAGE NAME=\"");
+ r.appendContentString(buttonName(c));
+ r.appendContentString("\" SRC=\"");
+ r.appendContentString(sourceURL(c));
+ r.appendContentString("\"");
+ r.appendContentString(additionalHTMLProperties(c.component(), new NSArray(
+ new Object[] { "name", "action", "src", "filename", "framework", "data", "mimeType" })));
+ r.appendContentString(">");
+ } else {
+ // generate a WOActiveImage
+ new WOActiveImage(name, associations, rootElement).appendToResponse(r, c);
+ }
+ }
}