This page was generated using Webiyo. See its source code and unit tests.
|
org/webiyo/web/Image.javapackage org.webiyo.web; import org.webiyo.xml.AttributeSink; import org.webiyo.xml.AttributeSource; import org.webiyo.xml.dtds.Html; import java.io.IOException; public class Image implements AttributeSource { private final Link src; private final String width; private final String height; private final String altText; public Image(String src, int width, int height, String altText) { this(new Link(src), width, height, altText); } public Image(Link src, int width, int height, String altText) { this.src = src; this.width = String.valueOf(width); this.height = String.valueOf(height); this.altText = altText; } public void sendAttributes(AttributeSink sink) throws IOException { sink.putAttribute(Html.SRC.getName(), src.toString()); sink.putAttribute(Html.WIDTH.getName(), width); sink.putAttribute(Html.HEIGHT.getName(), height); sink.putAttribute(Html.ALT.getName(), altText); } } |