Coverage Report - net.wotonomy.web.WOActiveImage
 
Classes in this File Line Coverage Branch Coverage Complexity
WOActiveImage
0% 
0% 
4.4
 
 1  
 
 2  
 package net.wotonomy.web;
 3  
 
 4  
 import java.util.Enumeration;
 5  
 
 6  
 import net.wotonomy.foundation.NSDictionary;
 7  
 import net.wotonomy.foundation.NSMutableDictionary;
 8  
 
 9  
 /**
 10  
  * WOActiveImage renders a dynamically generated IMG tag, enclosed in a hyperlink.
 11  
  * Internally, it uses a WOImage and a WOHyperlink to do the actual work.
 12  
  *
 13  
  * The bindings are those of WOImage and WOHyperlink combined.
 14  
  *
 15  
  * @author ezamudio@nasoft.com
 16  
  * @author $Author: cgruber $
 17  
  * @version $Revision: 905 $
 18  
  */
 19  
 public class WOActiveImage extends WODynamicElement {
 20  
 
 21  
     protected WOActiveImage() {
 22  0
         super();
 23  0
     }
 24  
 
 25  
     public WOActiveImage(String aName, NSDictionary aMap, WOElement template) {
 26  0
         super(aName, aMap, template);
 27  0
     }
 28  
 
 29  
     public void appendToResponse(WOResponse r, WOContext c) {
 30  0
         NSMutableDictionary atribs = new NSMutableDictionary(5);
 31  0
         if (associations.objectForKey("mimeType") != null)
 32  0
             atribs.setObjectForKey(associations.objectForKey("mimeType"), "mimeType");
 33  0
         if (associations.objectForKey("data") != null)
 34  0
             atribs.setObjectForKey(associations.objectForKey("data"), "data");
 35  0
         if (associations.objectForKey("src") != null)
 36  0
             atribs.setObjectForKey(associations.objectForKey("src"), "src");
 37  0
         if (associations.objectForKey("framework") != null)
 38  0
             atribs.setObjectForKey(associations.objectForKey("framework"), "framework");
 39  0
         if (associations.objectForKey("filename") != null)
 40  0
             atribs.setObjectForKey(associations.objectForKey("filename"), "filename");
 41  0
         if (associations.objectForKey("alt") != null)
 42  0
             atribs.setObjectForKey(associations.objectForKey("alt"), "alt");
 43  0
         if (associations.objectForKey("border") != null)
 44  0
             atribs.setObjectForKey(associations.objectForKey("border"), "border");
 45  0
         if (associations.objectForKey("width") != null)
 46  0
             atribs.setObjectForKey(associations.objectForKey("width"), "width");
 47  0
         if (associations.objectForKey("height") != null)
 48  0
             atribs.setObjectForKey(associations.objectForKey("height"), "height");
 49  0
         WODynamicElement img = new WOImage("WOImage_" + name, atribs, null);
 50  0
         NSMutableDictionary uf = new NSMutableDictionary();
 51  0
         Enumeration enumeration = associations.keyEnumerator();
 52  0
         while (enumeration.hasMoreElements()) {
 53  0
             String key = (String)enumeration.nextElement();
 54  0
             if (key.startsWith("?"))
 55  0
                 uf.setObjectForKey(associations.objectForKey(key), key);
 56  0
         }
 57  0
         createLink(img).appendToResponse(r, c);
 58  0
     }
 59  
 
 60  
     public WOActionResults invokeAction(WORequest r, WOContext c) {
 61  0
         return createLink(null).invokeAction(r, c);
 62  
     }
 63  
 
 64  
     protected WOHyperlink createLink(WOElement e) {
 65  0
         NSMutableDictionary atribs = new NSMutableDictionary(5);
 66  0
         if (associations.objectForKey("href") != null)
 67  0
             atribs.setObjectForKey(associations.objectForKey("href"), "href");
 68  0
         if (associations.objectForKey("pageName") != null)
 69  0
             atribs.setObjectForKey(associations.objectForKey("pageName"), "pageName");
 70  0
         if (associations.objectForKey("action") != null)
 71  0
             atribs.setObjectForKey(associations.objectForKey("action"), "action");
 72  0
         if (associations.objectForKey("directActionName") != null)
 73  0
             atribs.setObjectForKey(associations.objectForKey("directActionName"), "directActionName");
 74  0
         if (associations.objectForKey("actionClass") != null)
 75  0
             atribs.setObjectForKey(associations.objectForKey("actionClass"), "actionClass");
 76  0
         if (associations.objectForKey("target") != null)
 77  0
             atribs.setObjectForKey(associations.objectForKey("target"), "target");
 78  0
         return new WOHyperlink(name, atribs, e);
 79  
     }
 80  
 
 81  
 }