1 15 package org.apache.tapestry.html; 16 17 import org.apache.tapestry.AbstractComponent; 18 import org.apache.tapestry.IAsset; 19 import org.apache.tapestry.IMarkupWriter; 20 import org.apache.tapestry.IRequestCycle; 21 import org.apache.tapestry.Tapestry; 22 23 34 35 public abstract class Image extends AbstractComponent 36 { 37 42 43 protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) 44 { 45 48 if (cycle.isRewinding()) 49 return; 50 51 IAsset imageAsset = getImage(); 52 53 if (imageAsset == null) 54 throw Tapestry.createRequiredParameterException(this, "image"); 55 56 String imageURL = imageAsset.buildURL(cycle); 57 58 writer.beginEmpty("img"); 59 60 writer.attribute("src", imageURL); 61 62 writer.attribute("border", getBorder()); 63 64 renderInformalParameters(writer, cycle); 65 66 writer.closeTag(); 67 68 } 69 70 public abstract IAsset getImage(); 71 72 public abstract int getBorder(); 73 } | Popular Tags |