1 18 package org.apache.batik.dom.svg; 19 20 import org.apache.batik.dom.AbstractDocument; 21 import org.apache.batik.util.SVGConstants; 22 import org.w3c.dom.Node ; 23 import org.w3c.dom.svg.SVGAnimatedLengthList; 24 import org.w3c.dom.svg.SVGAnimatedTransformList; 25 import org.w3c.dom.svg.SVGElement; 26 import org.w3c.dom.svg.SVGException; 27 import org.w3c.dom.svg.SVGMatrix; 28 import org.w3c.dom.svg.SVGRect; 29 import org.w3c.dom.svg.SVGTextElement; 30 31 37 public class SVGOMTextElement 38 extends SVGOMTextPositioningElement 39 implements SVGTextElement { 40 41 public static final String X_DEFAULT_VALUE = "0"; 43 public static final String Y_DEFAULT_VALUE = "0"; 44 45 48 protected SVGOMTextElement() { 49 } 50 51 56 public SVGOMTextElement(String prefix, AbstractDocument owner) { 57 super(prefix, owner); 58 } 59 60 63 public String getLocalName() { 64 return SVG_TEXT_TAG; 65 } 66 67 69 73 public SVGElement getNearestViewportElement() { 74 return SVGLocatableSupport.getNearestViewportElement(this); 75 } 76 77 81 public SVGElement getFarthestViewportElement() { 82 return SVGLocatableSupport.getFarthestViewportElement(this); 83 } 84 85 88 public SVGRect getBBox() { 89 return SVGLocatableSupport.getBBox(this); 90 } 91 92 95 public SVGMatrix getCTM() { 96 return SVGLocatableSupport.getCTM(this); 97 } 98 99 103 public SVGMatrix getScreenCTM() { 104 return SVGLocatableSupport.getScreenCTM(this); 105 } 106 107 111 public SVGMatrix getTransformToElement(SVGElement element) 112 throws SVGException { 113 return SVGLocatableSupport.getTransformToElement(this, element); 114 } 115 116 118 122 public SVGAnimatedTransformList getTransform() { 123 return SVGTransformableSupport.getTransform(this); 124 } 125 126 129 protected Node newNode() { 130 return new SVGOMTextElement(); 131 } 132 133 135 139 public SVGAnimatedLengthList getX() { 140 SVGOMAnimatedLengthList result = (SVGOMAnimatedLengthList) 141 getLiveAttributeValue(null, SVGConstants.SVG_X_ATTRIBUTE); 142 if (result == null) { 143 result = new SVGOMAnimatedLengthList(this, null, 144 SVGConstants.SVG_X_ATTRIBUTE, 145 X_DEFAULT_VALUE, 146 AbstractSVGLength.HORIZONTAL_LENGTH); 147 putLiveAttributeValue(null, 148 SVGConstants.SVG_X_ATTRIBUTE, result); 149 } 150 return result; 151 } 152 153 157 public SVGAnimatedLengthList getY() { 158 SVGOMAnimatedLengthList result = (SVGOMAnimatedLengthList) 159 getLiveAttributeValue(null, SVGConstants.SVG_Y_ATTRIBUTE); 160 if (result == null) { 161 result = new SVGOMAnimatedLengthList(this, null, 162 SVGConstants.SVG_Y_ATTRIBUTE, 163 Y_DEFAULT_VALUE, 164 AbstractSVGLength.VERTICAL_LENGTH); 165 putLiveAttributeValue(null, 166 SVGConstants.SVG_Y_ATTRIBUTE, result); 167 } 168 return result; 169 } 170 } 171 | Popular Tags |