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.SVGAnimatedBoolean; 25 import org.w3c.dom.svg.SVGAnimatedEnumeration; 26 import org.w3c.dom.svg.SVGAnimatedLength; 27 import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio; 28 import org.w3c.dom.svg.SVGAnimatedRect; 29 import org.w3c.dom.svg.SVGAnimatedString; 30 import org.w3c.dom.svg.SVGAnimatedTransformList; 31 import org.w3c.dom.svg.SVGPatternElement; 32 import org.w3c.dom.svg.SVGStringList; 33 34 40 public class SVGOMPatternElement 41 extends SVGStylableElement 42 implements SVGPatternElement { 43 44 47 protected final static AttributeInitializer attributeInitializer; 48 static { 49 attributeInitializer = new AttributeInitializer(5); 50 attributeInitializer.addAttribute(null, null, 51 SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, 52 "xMidYMid meet"); 53 attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI, 54 null, "xmlns:xlink", 55 XLinkSupport.XLINK_NAMESPACE_URI); 56 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 57 "xlink", "type", "simple"); 58 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 59 "xlink", "show", "other"); 60 attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI, 61 "xlink", "actuate", "onLoad"); 62 } 63 64 67 protected final static String [] UNITS_VALUES = { 68 "", 69 SVG_USER_SPACE_ON_USE_VALUE, 70 SVG_OBJECT_BOUNDING_BOX_VALUE 71 }; 72 73 76 protected SVGOMPatternElement() { 77 } 78 79 84 public SVGOMPatternElement(String prefix, 85 AbstractDocument owner) { 86 super(prefix, owner); 87 } 88 89 92 public String getLocalName() { 93 return SVG_PATTERN_TAG; 94 } 95 96 99 public SVGAnimatedTransformList getPatternTransform() { 100 throw new RuntimeException (" !!! TODO: getPatternTransform()"); 101 } 102 103 106 public SVGAnimatedEnumeration getPatternUnits() { 107 return getAnimatedEnumerationAttribute 108 (null, SVG_PATTERN_UNITS_ATTRIBUTE, UNITS_VALUES, 109 (short)2); 110 } 111 112 116 public SVGAnimatedEnumeration getPatternContentUnits() { 117 return getAnimatedEnumerationAttribute 118 (null, SVG_PATTERN_CONTENT_UNITS_ATTRIBUTE, UNITS_VALUES, 119 (short)1); 120 } 121 122 125 public SVGAnimatedLength getX() { 126 return getAnimatedLengthAttribute 127 (null, SVG_X_ATTRIBUTE, SVG_PATTERN_X_DEFAULT_VALUE, 128 SVGOMAnimatedLength.HORIZONTAL_LENGTH); 129 } 130 131 134 public SVGAnimatedLength getY() { 135 return getAnimatedLengthAttribute 136 (null, SVG_Y_ATTRIBUTE, SVG_PATTERN_Y_DEFAULT_VALUE, 137 SVGOMAnimatedLength.VERTICAL_LENGTH); 138 } 139 140 143 public SVGAnimatedLength getWidth() { 144 return getAnimatedLengthAttribute 145 (null, SVG_WIDTH_ATTRIBUTE, SVG_PATTERN_WIDTH_DEFAULT_VALUE, 146 SVGOMAnimatedLength.HORIZONTAL_LENGTH); 147 } 148 149 153 public SVGAnimatedLength getHeight() { 154 return getAnimatedLengthAttribute 155 (null, SVG_HEIGHT_ATTRIBUTE, SVG_PATTERN_HEIGHT_DEFAULT_VALUE, 156 SVGOMAnimatedLength.VERTICAL_LENGTH); 157 } 158 159 161 165 public SVGAnimatedString getHref() { 166 return SVGURIReferenceSupport.getHref(this); 167 } 168 169 171 175 public SVGAnimatedRect getViewBox() { 176 throw new RuntimeException (" !!! TODO: getViewBox()"); 177 } 178 179 183 public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() { 184 return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this); 185 } 186 187 189 193 public SVGAnimatedBoolean getExternalResourcesRequired() { 194 return SVGExternalResourcesRequiredSupport. 195 getExternalResourcesRequired(this); 196 } 197 198 200 203 public String getXMLlang() { 204 return XMLSupport.getXMLLang(this); 205 } 206 207 210 public void setXMLlang(String lang) { 211 setAttributeNS(XMLSupport.XML_NAMESPACE_URI, 212 XMLSupport.XML_LANG_ATTRIBUTE, 213 lang); 214 } 215 216 219 public String getXMLspace() { 220 return XMLSupport.getXMLSpace(this); 221 } 222 223 226 public void setXMLspace(String space) { 227 setAttributeNS(XMLSupport.XML_NAMESPACE_URI, 228 XMLSupport.XML_SPACE_ATTRIBUTE, 229 space); 230 } 231 232 234 238 public SVGStringList getRequiredFeatures() { 239 return SVGTestsSupport.getRequiredFeatures(this); 240 } 241 242 246 public SVGStringList getRequiredExtensions() { 247 return SVGTestsSupport.getRequiredExtensions(this); 248 } 249 250 254 public SVGStringList getSystemLanguage() { 255 return SVGTestsSupport.getSystemLanguage(this); 256 } 257 258 262 public boolean hasExtension(String extension) { 263 return SVGTestsSupport.hasExtension(this, extension); 264 } 265 266 270 protected AttributeInitializer getAttributeInitializer() { 271 return attributeInitializer; 272 } 273 274 277 protected Node newNode() { 278 return new SVGOMPatternElement(); 279 } 280 } 281 | Popular Tags |