Coverage Report - net.wotonomy.web.WOImageButton
 
Classes in this File Line Coverage Branch Coverage Complexity
WOImageButton
0% 
0% 
1.75
 
 1  
 
 2  
 package net.wotonomy.web;
 3  
 
 4  
 import net.wotonomy.foundation.NSArray;
 5  
 import net.wotonomy.foundation.NSDictionary;
 6  
 
 7  
 /**
 8  
  * WOImageButton renders a dynamically generated IMG tag or an INPUT tag, depending on whether the
 9  
  * element is inside a WOForm (in which case an INPUT of type IMAGE is generated) or not (in which
 10  
  * case the equivalent of a WOActiveImage)
 11  
  *
 12  
  * Bindings are:
 13  
  * <UL>
 14  
  * <LI>src: A static URL for the image source.</li>
 15  
  * <li>data: A NSData object with the image content. Must be used with mimeType.</li>
 16  
  * <li>mimeType: The MIME type for the image data. Can be used with filename or data bindings.</li>
 17  
  * <li>filename: The path to a file containing an image.</li>
 18  
  * <li>framework: The framework where the image should be retrieved from (used in conjunction with filename).</li>
 19  
  *
 20  
  * @author ezamudio@nasoft.com
 21  
  * @author $Author: cgruber $
 22  
  * @version $Revision: 905 $
 23  
  */
 24  
 public class WOImageButton extends WOImage {
 25  
 
 26  
     protected WOImageButton() {
 27  0
         super();
 28  0
     }
 29  
 
 30  
     public WOImageButton(String aName, NSDictionary aMap, WOElement template) {
 31  0
         super(aName, aMap, template);
 32  0
     }
 33  
 
 34  
     public String buttonName(WOContext c) {
 35  0
         String x = (String)valueForProperty("name", c.component());
 36  0
         if (x != null)
 37  0
             return x;
 38  0
         return c.elementID();
 39  
     }
 40  
 
 41  
     public void appendToResponse(WOResponse r, WOContext c) {
 42  0
         if (c.isInForm()) {
 43  
             //generate an INPUT
 44  0
             r.appendContentString("<INPUT TYPE=IMAGE NAME=\"");
 45  0
             r.appendContentString(buttonName(c));
 46  0
             r.appendContentString("\" SRC=\"");
 47  0
             r.appendContentString(sourceURL(c));
 48  0
             r.appendContentString("\"");
 49  0
             r.appendContentString(additionalHTMLProperties(c.component(), new NSArray(new Object[]{
 50  0
                 "name", "action", "src", "filename", "framework", "data", "mimeType" })));
 51  0
             r.appendContentString(">");
 52  0
         } else {
 53  
             //generate a WOActiveImage
 54  0
             new WOActiveImage(name, associations, rootElement).appendToResponse(r, c);
 55  
         }
 56  0
     }
 57  
 
 58  
 }