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.DOMException ; 24 import org.w3c.dom.Node ; 25 import org.w3c.dom.svg.SVGAnimatedString; 26 import org.w3c.dom.svg.SVGGlyphRefElement; 27 28 34 public class SVGOMGlyphRefElement 35 extends SVGStylableElement 36 implements SVGGlyphRefElement { 37 38 41 protected final static AttributeInitializer attributeInitializer; 42 static { 43 attributeInitializer = new AttributeInitializer(4); 44 attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI, 45 null, "xmlns:xlink", 46 XLinkSupport.XLINK_NAMESPACE_URI); 47 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 48 "xlink", "type", "simple"); 49 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 50 "xlink", "show", "other"); 51 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 52 "xlink", "actuate", "onLoad"); 53 } 54 55 58 protected SVGOMGlyphRefElement() { 59 } 60 61 66 public SVGOMGlyphRefElement(String prefix, AbstractDocument owner) { 67 super(prefix, owner); 68 } 69 70 73 public String getLocalName() { 74 return SVG_GLYPH_REF_TAG; 75 } 76 77 80 public SVGAnimatedString getHref() { 81 return SVGURIReferenceSupport.getHref(this); 82 } 83 84 87 public String getGlyphRef() { 88 return getAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE); 89 } 90 91 94 public void setGlyphRef(String glyphRef) throws DOMException { 95 setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef); 96 } 97 98 101 public String getFormat() { 102 return getAttributeNS(null, SVG_FORMAT_ATTRIBUTE); 103 } 104 105 108 public void setFormat(String format) throws DOMException { 109 setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format); 110 } 111 112 115 public float getX() { 116 return Float.parseFloat(getAttributeNS(null, SVG_X_ATTRIBUTE)); 117 } 118 119 122 public void setX(float x) throws DOMException { 123 setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf(x)); 124 } 125 126 129 public float getY() { 130 return Float.parseFloat(getAttributeNS(null, SVG_Y_ATTRIBUTE)); 131 } 132 133 136 public void setY(float y) throws DOMException { 137 setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf(y)); 138 } 139 140 143 public float getDx() { 144 return Float.parseFloat(getAttributeNS(null, SVG_DX_ATTRIBUTE)); 145 } 146 147 150 public void setDx(float dx) throws DOMException { 151 setAttributeNS(null, SVG_DX_ATTRIBUTE, String.valueOf(dx)); 152 } 153 154 157 public float getDy() { 158 return Float.parseFloat(getAttributeNS(null, SVG_DY_ATTRIBUTE)); 159 } 160 161 164 public void setDy(float dy) throws DOMException { 165 setAttributeNS(null, SVG_DY_ATTRIBUTE, String.valueOf(dy)); 166 } 167 168 172 protected AttributeInitializer getAttributeInitializer() { 173 return attributeInitializer; 174 } 175 176 179 protected Node newNode() { 180 return new SVGOMGlyphRefElement(); 181 } 182 } 183 | Popular Tags |