1 18 package org.apache.batik.dom.svg; 19 20 import org.apache.batik.css.engine.CSSImportNode; 21 import org.apache.batik.css.engine.CSSImportedElementRoot; 22 import org.apache.batik.dom.AbstractDocument; 23 import org.apache.batik.dom.util.XLinkSupport; 24 import org.apache.batik.dom.util.XMLSupport; 25 import org.w3c.dom.Node ; 26 import org.w3c.dom.svg.SVGAnimatedLength; 27 import org.w3c.dom.svg.SVGElementInstance; 28 import org.w3c.dom.svg.SVGUseElement; 29 30 36 public class SVGOMUseElement 37 extends SVGURIReferenceGraphicsElement 38 implements SVGUseElement, 39 CSSImportNode { 40 41 44 protected final static AttributeInitializer attributeInitializer; 45 static { 46 attributeInitializer = new AttributeInitializer(4); 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 CSSImportedElementRoot cssImportedElementRoot; 62 63 66 protected SVGOMUseElement() { 67 } 68 69 74 public SVGOMUseElement(String prefix, AbstractDocument owner) { 75 super(prefix, owner); 76 } 77 78 81 public String getLocalName() { 82 return SVG_USE_TAG; 83 } 84 85 88 public SVGAnimatedLength getX() { 89 return getAnimatedLengthAttribute 90 (null, SVG_X_ATTRIBUTE, SVG_USE_X_DEFAULT_VALUE, 91 SVGOMAnimatedLength.HORIZONTAL_LENGTH); 92 } 93 94 97 public SVGAnimatedLength getY() { 98 return getAnimatedLengthAttribute 99 (null, SVG_Y_ATTRIBUTE, SVG_USE_Y_DEFAULT_VALUE, 100 SVGOMAnimatedLength.VERTICAL_LENGTH); 101 } 102 103 106 public SVGAnimatedLength getWidth() { 107 return getAnimatedLengthAttribute 108 (null, SVG_WIDTH_ATTRIBUTE, SVG_USE_WIDTH_DEFAULT_VALUE, 109 SVGOMAnimatedLength.HORIZONTAL_LENGTH); 110 } 111 112 115 public SVGAnimatedLength getHeight() { 116 return getAnimatedLengthAttribute 117 (null, SVG_HEIGHT_ATTRIBUTE, SVG_USE_HEIGHT_DEFAULT_VALUE, 118 SVGOMAnimatedLength.VERTICAL_LENGTH); 119 } 120 121 124 public SVGElementInstance getInstanceRoot() { 125 throw new RuntimeException (" !!! TODO: getInstanceRoot()"); 126 } 127 128 131 public SVGElementInstance getAnimatedInstanceRoot() { 132 throw new RuntimeException (" !!! TODO: getAnimatedInstanceRoot()"); 133 } 134 135 137 140 public CSSImportedElementRoot getCSSImportedElementRoot() { 141 return cssImportedElementRoot; 142 } 143 144 147 public void setCSSImportedElementRoot(CSSImportedElementRoot r) { 148 cssImportedElementRoot = r; 149 } 150 151 155 protected AttributeInitializer getAttributeInitializer() { 156 return attributeInitializer; 157 } 158 159 162 protected Node newNode() { 163 return new SVGOMUseElement(); 164 } 165 } 166 | Popular Tags |