1 18 package org.apache.batik.dom.svg; 19 20 import org.apache.batik.dom.AbstractDocument; 21 import org.apache.batik.dom.util.XLinkSupport; 22 import org.apache.batik.dom.util.XMLSupport; 23 import org.w3c.dom.Node ; 24 import org.w3c.dom.svg.SVGAnimatedLength; 25 import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio; 26 import org.w3c.dom.svg.SVGImageElement; 27 28 34 public class SVGOMImageElement 35 extends SVGURIReferenceGraphicsElement 36 implements SVGImageElement { 37 38 41 protected final static AttributeInitializer attributeInitializer; 42 static { 43 attributeInitializer = new AttributeInitializer(5); 44 attributeInitializer.addAttribute(null, null, 45 SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, 46 "xMidYMid meet"); 47 attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI, 48 null, "xmlns:xlink", 49 XLinkSupport.XLINK_NAMESPACE_URI); 50 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 51 "xlink", "type", "simple"); 52 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 53 "xlink", "show", "embed"); 54 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 55 "xlink", "actuate", "onLoad"); 56 } 57 58 61 protected SVGOMImageElement() { 62 } 63 64 69 public SVGOMImageElement(String prefix, AbstractDocument owner) { 70 super(prefix, owner); 71 } 72 73 76 public String getLocalName() { 77 return SVG_IMAGE_TAG; 78 } 79 80 83 public SVGAnimatedLength getX() { 84 return getAnimatedLengthAttribute 85 (null, SVG_X_ATTRIBUTE, SVG_IMAGE_X_DEFAULT_VALUE, 86 SVGOMAnimatedLength.HORIZONTAL_LENGTH); 87 } 88 89 92 public SVGAnimatedLength getY() { 93 return getAnimatedLengthAttribute 94 (null, SVG_Y_ATTRIBUTE, SVG_IMAGE_Y_DEFAULT_VALUE, 95 SVGOMAnimatedLength.VERTICAL_LENGTH); 96 } 97 98 101 public SVGAnimatedLength getWidth() { 102 return getAnimatedLengthAttribute 103 (null, SVG_WIDTH_ATTRIBUTE, "", 104 SVGOMAnimatedLength.HORIZONTAL_LENGTH); 105 } 106 107 110 public SVGAnimatedLength getHeight() { 111 return getAnimatedLengthAttribute 112 (null, SVG_HEIGHT_ATTRIBUTE, "", 113 SVGOMAnimatedLength.VERTICAL_LENGTH); 114 } 115 116 119 public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() { 120 return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this); 121 } 122 123 127 protected AttributeInitializer getAttributeInitializer() { 128 return attributeInitializer; 129 } 130 131 134 protected Node newNode() { 135 return new SVGOMImageElement(); 136 } 137 } 138 | Popular Tags |