001/********************************************** 002 * Copyright (C) 2010 Lukas Laag 003 * This file is part of lib-gwt-svg. 004 * 005 * libgwtsvg is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Lesser General Public License as published by 007 * the Free Software Foundation, either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * libgwtsvg is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public License 016 * along with libgwtsvg. If not, see http://www.gnu.org/licenses/ 017 **********************************************/ 018/* 019 * Copyright (c) 2004 World Wide Web Consortium, 020 * 021 * (Massachusetts Institute of Technology, European Research Consortium for 022 * Informatics and Mathematics, Keio University). All Rights Reserved. This 023 * work is distributed under the W3C(r) Software License [1] in the hope that 024 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 025 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 026 * 027 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 028 */ 029 030package org.vectomatic.dom.svg; 031 032import org.vectomatic.dom.svg.events.HasDocumentHandlers; 033import org.vectomatic.dom.svg.events.SVGZoomEvent; 034import org.vectomatic.dom.svg.events.SVGZoomHandler; 035import org.vectomatic.dom.svg.impl.SVGAElement; 036import org.vectomatic.dom.svg.impl.SVGAltGlyphDefElement; 037import org.vectomatic.dom.svg.impl.SVGAltGlyphElement; 038import org.vectomatic.dom.svg.impl.SVGAltGlyphItemElement; 039import org.vectomatic.dom.svg.impl.SVGAnimateColorElement; 040import org.vectomatic.dom.svg.impl.SVGAnimateElement; 041import org.vectomatic.dom.svg.impl.SVGAnimateMotionElement; 042import org.vectomatic.dom.svg.impl.SVGAnimateTransformElement; 043import org.vectomatic.dom.svg.impl.SVGCircleElement; 044import org.vectomatic.dom.svg.impl.SVGClipPathElement; 045import org.vectomatic.dom.svg.impl.SVGColorProfileElement; 046import org.vectomatic.dom.svg.impl.SVGCursorElement; 047import org.vectomatic.dom.svg.impl.SVGDefsElement; 048import org.vectomatic.dom.svg.impl.SVGDescElement; 049import org.vectomatic.dom.svg.impl.SVGDocument; 050import org.vectomatic.dom.svg.impl.SVGEllipseElement; 051import org.vectomatic.dom.svg.impl.SVGFEBlendElement; 052import org.vectomatic.dom.svg.impl.SVGFEColorMatrixElement; 053import org.vectomatic.dom.svg.impl.SVGFEComponentTransferElement; 054import org.vectomatic.dom.svg.impl.SVGFECompositeElement; 055import org.vectomatic.dom.svg.impl.SVGFEConvolveMatrixElement; 056import org.vectomatic.dom.svg.impl.SVGFEDiffuseLightingElement; 057import org.vectomatic.dom.svg.impl.SVGFEDisplacementMapElement; 058import org.vectomatic.dom.svg.impl.SVGFEDistantLightElement; 059import org.vectomatic.dom.svg.impl.SVGFEFloodElement; 060import org.vectomatic.dom.svg.impl.SVGFEFuncAElement; 061import org.vectomatic.dom.svg.impl.SVGFEFuncBElement; 062import org.vectomatic.dom.svg.impl.SVGFEFuncGElement; 063import org.vectomatic.dom.svg.impl.SVGFEFuncRElement; 064import org.vectomatic.dom.svg.impl.SVGFEGaussianBlurElement; 065import org.vectomatic.dom.svg.impl.SVGFEImageElement; 066import org.vectomatic.dom.svg.impl.SVGFEMergeElement; 067import org.vectomatic.dom.svg.impl.SVGFEMergeNodeElement; 068import org.vectomatic.dom.svg.impl.SVGFEMorphologyElement; 069import org.vectomatic.dom.svg.impl.SVGFEOffsetElement; 070import org.vectomatic.dom.svg.impl.SVGFEPointLightElement; 071import org.vectomatic.dom.svg.impl.SVGFESpecularLightingElement; 072import org.vectomatic.dom.svg.impl.SVGFESpotLightElement; 073import org.vectomatic.dom.svg.impl.SVGFETileElement; 074import org.vectomatic.dom.svg.impl.SVGFETurbulenceElement; 075import org.vectomatic.dom.svg.impl.SVGFilterElement; 076import org.vectomatic.dom.svg.impl.SVGFontElement; 077import org.vectomatic.dom.svg.impl.SVGFontFaceElement; 078import org.vectomatic.dom.svg.impl.SVGFontFaceFormatElement; 079import org.vectomatic.dom.svg.impl.SVGFontFaceNameElement; 080import org.vectomatic.dom.svg.impl.SVGFontFaceSrcElement; 081import org.vectomatic.dom.svg.impl.SVGFontFaceUriElement; 082import org.vectomatic.dom.svg.impl.SVGForeignObjectElement; 083import org.vectomatic.dom.svg.impl.SVGGElement; 084import org.vectomatic.dom.svg.impl.SVGGlyphElement; 085import org.vectomatic.dom.svg.impl.SVGGlyphRefElement; 086import org.vectomatic.dom.svg.impl.SVGHKernElement; 087import org.vectomatic.dom.svg.impl.SVGImageElement; 088import org.vectomatic.dom.svg.impl.SVGLineElement; 089import org.vectomatic.dom.svg.impl.SVGLinearGradientElement; 090import org.vectomatic.dom.svg.impl.SVGMPathElement; 091import org.vectomatic.dom.svg.impl.SVGMarkerElement; 092import org.vectomatic.dom.svg.impl.SVGMaskElement; 093import org.vectomatic.dom.svg.impl.SVGMetadataElement; 094import org.vectomatic.dom.svg.impl.SVGMissingGlyphElement; 095import org.vectomatic.dom.svg.impl.SVGPathElement; 096import org.vectomatic.dom.svg.impl.SVGPatternElement; 097import org.vectomatic.dom.svg.impl.SVGPolygonElement; 098import org.vectomatic.dom.svg.impl.SVGPolylineElement; 099import org.vectomatic.dom.svg.impl.SVGRadialGradientElement; 100import org.vectomatic.dom.svg.impl.SVGRectElement; 101import org.vectomatic.dom.svg.impl.SVGSVGElement; 102import org.vectomatic.dom.svg.impl.SVGScriptElement; 103import org.vectomatic.dom.svg.impl.SVGSetElement; 104import org.vectomatic.dom.svg.impl.SVGStopElement; 105import org.vectomatic.dom.svg.impl.SVGStyleElement; 106import org.vectomatic.dom.svg.impl.SVGSwitchElement; 107import org.vectomatic.dom.svg.impl.SVGSymbolElement; 108import org.vectomatic.dom.svg.impl.SVGTRefElement; 109import org.vectomatic.dom.svg.impl.SVGTSpanElement; 110import org.vectomatic.dom.svg.impl.SVGTextElement; 111import org.vectomatic.dom.svg.impl.SVGTextPathElement; 112import org.vectomatic.dom.svg.impl.SVGTitleElement; 113import org.vectomatic.dom.svg.impl.SVGUseElement; 114import org.vectomatic.dom.svg.impl.SVGVKernElement; 115import org.vectomatic.dom.svg.impl.SVGViewElement; 116import org.vectomatic.dom.svg.utils.DOMHelper; 117import org.vectomatic.dom.svg.utils.SVGConstants; 118 119import com.google.gwt.dom.client.Document; 120import com.google.gwt.event.dom.client.ScrollEvent; 121import com.google.gwt.event.dom.client.ScrollHandler; 122import com.google.gwt.event.logical.shared.ResizeEvent; 123import com.google.gwt.event.logical.shared.ResizeHandler; 124import com.google.gwt.event.shared.HandlerRegistration; 125 126/** 127 * <p>When an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 128 * title='svg element specification'>svg</a> element is embedded inline as 129 * a component of a document from another namespace, such as when an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 130 * title='svg element specification'>svg</a> element is embedded inline within 131 * an XHTML document [<a href="refs.html#ref-XHTML">XHTML</a>], then an {@link 132 * org.vectomatic.dom.svg.OMSVGDocument} object will not exist; instead, the 133 * root object in the document object hierarchy will be a Document object 134 * of a different type, such as an HTMLDocument object.</p> <p>However, an 135 * {@link org.vectomatic.dom.svg.OMSVGDocument} object will indeed exist when 136 * the root element of the XML document hierarchy is an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 137 * title='svg element specification'>svg</a> element, such as when viewing 138 * a stand-alone SVG file (i.e., a file with MIME type "image/svg+xml"). In 139 * this case, the {@link org.vectomatic.dom.svg.OMSVGDocument} object will 140 * be the root object of the document object model hierarchy.</p> <p>In the 141 * case where an SVG document is embedded by reference, such as when an XHTML 142 * document has an <span class="element-name">'object'</span> element whose 143 * <span class="attr-name">'href'</span> attribute references an SVG document 144 * (i.e., a document whose MIME type is "image/svg+xml" and whose root element 145 * is thus an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 146 * title='svg element specification'>svg</a> element), there will exist two 147 * distinct DOM hierarchies. The first DOM hierarchy will be for the referencing 148 * document (e.g., an XHTML document). The second DOM hierarchy will be for 149 * the referenced SVG document. In this second DOM hierarchy, the root object 150 * of the document object model hierarchy is an {@link org.vectomatic.dom.svg.OMSVGDocument} 151 * object.</p> <p>The {@link org.vectomatic.dom.svg.OMSVGDocument} interface 152 * contains a similar list of attributes and methods to the HTMLDocument interface 153 * described in the <a href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html">Document 154 * Object Model (HTML) Level 1</a> chapter of the [<a href="refs.html#ref-DOM1">DOM1</a>] 155 * specification.</p> 156 */ 157public class OMSVGDocument extends OMDocument implements HasDocumentHandlers { 158 protected OMSVGDocument(SVGDocument ot) { 159 super(ot); 160 } 161 162 // Implementation of the svg::SVGDocument W3C IDL interface 163 /** 164 * The root <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 165 * element specification'>svg</a> in the document hierarchy. 166 */ 167 public final OMSVGSVGElement getRootElement() { 168 return (OMSVGSVGElement)convert(((SVGDocument)ot).getRootElement()); 169 } 170 171 @Override 172 public final HandlerRegistration addScrollHandler(ScrollHandler handler) { 173 return addDomHandler(handler, ScrollEvent.getType()); 174 } 175 @Override 176 public final HandlerRegistration addResizeHandler(ResizeHandler handler) { 177 return addHandler(handler, ResizeEvent.getType()); 178 } 179 @Override 180 public final HandlerRegistration addSVGZoomHandler(SVGZoomHandler handler) { 181 return addDomHandler(handler, SVGZoomEvent.getType()); 182 } 183 public final OMSVGSVGElement createSVGSVGElement() { 184 return (OMSVGSVGElement)convert((SVGSVGElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SVG_TAG).cast()); 185 } 186 public final OMSVGGElement createSVGGElement() { 187 return (OMSVGGElement)convert((SVGGElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_G_TAG).cast()); 188 } 189 public final OMSVGDefsElement createSVGDefsElement() { 190 return (OMSVGDefsElement)convert((SVGDefsElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_DEFS_TAG).cast()); 191 } 192 public final OMSVGDescElement createSVGDescElement() { 193 return (OMSVGDescElement)convert((SVGDescElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_DESC_TAG).cast()); 194 } 195 public final OMSVGTitleElement createSVGTitleElement() { 196 return (OMSVGTitleElement)convert((SVGTitleElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_TITLE_TAG).cast()); 197 } 198 public final OMSVGSymbolElement createSVGSymbolElement() { 199 return (OMSVGSymbolElement)convert((SVGSymbolElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SYMBOL_TAG).cast()); 200 } 201 public final OMSVGUseElement createSVGUseElement() { 202 return (OMSVGUseElement)convert((SVGUseElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_USE_TAG).cast()); 203 } 204 public final OMSVGImageElement createSVGImageElement() { 205 return (OMSVGImageElement)convert((SVGImageElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_IMAGE_TAG).cast()); 206 } 207 public final OMSVGSwitchElement createSVGSwitchElement() { 208 return (OMSVGSwitchElement)convert((SVGSwitchElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SWITCH_TAG).cast()); 209 } 210 public final OMSVGStyleElement createSVGStyleElement() { 211 return (OMSVGStyleElement)convert((SVGStyleElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_STYLE_TAG).cast()); 212 } 213 public final OMSVGPathElement createSVGPathElement() { 214 return (OMSVGPathElement)convert((SVGPathElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_PATH_TAG).cast()); 215 } 216 public final OMSVGRectElement createSVGRectElement() { 217 return (OMSVGRectElement)convert((SVGRectElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_RECT_TAG).cast()); 218 } 219 public final OMSVGCircleElement createSVGCircleElement() { 220 return (OMSVGCircleElement)convert((SVGCircleElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_CIRCLE_TAG).cast()); 221 } 222 public final OMSVGEllipseElement createSVGEllipseElement() { 223 return (OMSVGEllipseElement)convert((SVGEllipseElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ELLIPSE_TAG).cast()); 224 } 225 public final OMSVGLineElement createSVGLineElement() { 226 return (OMSVGLineElement)convert((SVGLineElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_LINE_TAG).cast()); 227 } 228 public final OMSVGPolylineElement createSVGPolylineElement() { 229 return (OMSVGPolylineElement)convert((SVGPolylineElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_POLYLINE_TAG).cast()); 230 } 231 public final OMSVGPolygonElement createSVGPolygonElement() { 232 return (OMSVGPolygonElement)convert((SVGPolygonElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_POLYGON_TAG).cast()); 233 } 234 public final OMSVGTextElement createSVGTextElement() { 235 return (OMSVGTextElement)convert((SVGTextElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_TEXT_TAG).cast()); 236 } 237 public final OMSVGTSpanElement createSVGTSpanElement() { 238 return (OMSVGTSpanElement)convert((SVGTSpanElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_T_SPAN_TAG).cast()); 239 } 240 public final OMSVGTRefElement createSVGTRefElement() { 241 return (OMSVGTRefElement)convert((SVGTRefElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_T_REF_TAG).cast()); 242 } 243 public final OMSVGTextPathElement createSVGTextPathElement() { 244 return (OMSVGTextPathElement)convert((SVGTextPathElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_TEXT_PATH_TAG).cast()); 245 } 246 public final OMSVGAltGlyphElement createSVGAltGlyphElement() { 247 return (OMSVGAltGlyphElement)convert((SVGAltGlyphElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ALT_GLYPH_TAG).cast()); 248 } 249 public final OMSVGAltGlyphDefElement createSVGAltGlyphDefElement() { 250 return (OMSVGAltGlyphDefElement)convert((SVGAltGlyphDefElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ALT_GLYPH_DEF_TAG).cast()); 251 } 252 public final OMSVGAltGlyphItemElement createSVGAltGlyphItemElement() { 253 return (OMSVGAltGlyphItemElement)convert((SVGAltGlyphItemElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ALT_GLYPH_ITEM_TAG).cast()); 254 } 255 public final OMSVGGlyphRefElement createSVGGlyphRefElement() { 256 return (OMSVGGlyphRefElement)convert((SVGGlyphRefElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_REF_TAG).cast()); 257 } 258 public final OMSVGMarkerElement createSVGMarkerElement() { 259 return (OMSVGMarkerElement)convert((SVGMarkerElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_MARKER_TAG).cast()); 260 } 261 public final OMSVGColorProfileElement createSVGColorProfileElement() { 262 return (OMSVGColorProfileElement)convert((SVGColorProfileElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_COLOR_PROFILE_TAG).cast()); 263 } 264 public final OMSVGLinearGradientElement createSVGLinearGradientElement() { 265 return (OMSVGLinearGradientElement)convert((SVGLinearGradientElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_LINEAR_GRADIENT_TAG).cast()); 266 } 267 public final OMSVGRadialGradientElement createSVGRadialGradientElement() { 268 return (OMSVGRadialGradientElement)convert((SVGRadialGradientElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_RADIAL_GRADIENT_TAG).cast()); 269 } 270 public final OMSVGStopElement createSVGStopElement() { 271 return (OMSVGStopElement)convert((SVGStopElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_STOP_TAG).cast()); 272 } 273 public final OMSVGPatternElement createSVGPatternElement() { 274 return (OMSVGPatternElement)convert((SVGPatternElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_PATTERN_TAG).cast()); 275 } 276 public final OMSVGClipPathElement createSVGClipPathElement() { 277 return (OMSVGClipPathElement)convert((SVGClipPathElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_CLIP_PATH_TAG).cast()); 278 } 279 public final OMSVGMaskElement createSVGMaskElement() { 280 return (OMSVGMaskElement)convert((SVGMaskElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_MASK_TAG).cast()); 281 } 282 public final OMSVGFilterElement createSVGFilterElement() { 283 return (OMSVGFilterElement)convert((SVGFilterElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FILTER_TAG).cast()); 284 } 285 public final OMSVGFEBlendElement createSVGFEBlendElement() { 286 return (OMSVGFEBlendElement)convert((SVGFEBlendElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_BLEND_TAG).cast()); 287 } 288 public final OMSVGFEColorMatrixElement createSVGFEColorMatrixElement() { 289 return (OMSVGFEColorMatrixElement)convert((SVGFEColorMatrixElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_COLOR_MATRIX_TAG).cast()); 290 } 291 public final OMSVGFEComponentTransferElement createSVGFEComponentTransferElement() { 292 return (OMSVGFEComponentTransferElement)convert((SVGFEComponentTransferElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_COMPONENT_TRANSFER_TAG).cast()); 293 } 294 public final OMSVGFEFuncRElement createSVGFEFuncRElement() { 295 return (OMSVGFEFuncRElement)convert((SVGFEFuncRElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_FUNC_R_TAG).cast()); 296 } 297 public final OMSVGFEFuncGElement createSVGFEFuncGElement() { 298 return (OMSVGFEFuncGElement)convert((SVGFEFuncGElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_FUNC_G_TAG).cast()); 299 } 300 public final OMSVGFEFuncBElement createSVGFEFuncBElement() { 301 return (OMSVGFEFuncBElement)convert((SVGFEFuncBElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_FUNC_B_TAG).cast()); 302 } 303 public final OMSVGFEFuncAElement createSVGFEFuncAElement() { 304 return (OMSVGFEFuncAElement)convert((SVGFEFuncAElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_FUNC_A_TAG).cast()); 305 } 306 public final OMSVGFECompositeElement createSVGFECompositeElement() { 307 return (OMSVGFECompositeElement)convert((SVGFECompositeElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_COMPOSITE_TAG).cast()); 308 } 309 public final OMSVGFEConvolveMatrixElement createSVGFEConvolveMatrixElement() { 310 return (OMSVGFEConvolveMatrixElement)convert((SVGFEConvolveMatrixElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_CONVOLVE_MATRIX_TAG).cast()); 311 } 312 public final OMSVGFEDiffuseLightingElement createSVGFEDiffuseLightingElement() { 313 return (OMSVGFEDiffuseLightingElement)convert((SVGFEDiffuseLightingElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_DIFFUSE_LIGHTING_TAG).cast()); 314 } 315 public final OMSVGFEDistantLightElement createSVGFEDistantLightElement() { 316 return (OMSVGFEDistantLightElement)convert((SVGFEDistantLightElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_DISTANT_LIGHT_TAG).cast()); 317 } 318 public final OMSVGFEPointLightElement createSVGFEPointLightElement() { 319 return (OMSVGFEPointLightElement)convert((SVGFEPointLightElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_POINT_LIGHT_TAG).cast()); 320 } 321 public final OMSVGFESpotLightElement createSVGFESpotLightElement() { 322 return (OMSVGFESpotLightElement)convert((SVGFESpotLightElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_SPOT_LIGHT_TAG).cast()); 323 } 324 public final OMSVGFEDisplacementMapElement createSVGFEDisplacementMapElement() { 325 return (OMSVGFEDisplacementMapElement)convert((SVGFEDisplacementMapElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_DISPLACEMENT_MAP_TAG).cast()); 326 } 327 public final OMSVGFEFloodElement createSVGFEFloodElement() { 328 return (OMSVGFEFloodElement)convert((SVGFEFloodElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_FLOOD_TAG).cast()); 329 } 330 public final OMSVGFEGaussianBlurElement createSVGFEGaussianBlurElement() { 331 return (OMSVGFEGaussianBlurElement)convert((SVGFEGaussianBlurElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_GAUSSIAN_BLUR_TAG).cast()); 332 } 333 public final OMSVGFEImageElement createSVGFEImageElement() { 334 return (OMSVGFEImageElement)convert((SVGFEImageElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_IMAGE_TAG).cast()); 335 } 336 public final OMSVGFEMergeElement createSVGFEMergeElement() { 337 return (OMSVGFEMergeElement)convert((SVGFEMergeElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_MERGE_TAG).cast()); 338 } 339 public final OMSVGFEMergeNodeElement createSVGFEMergeNodeElement() { 340 return (OMSVGFEMergeNodeElement)convert((SVGFEMergeNodeElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_MERGE_NODE_TAG).cast()); 341 } 342 public final OMSVGFEMorphologyElement createSVGFEMorphologyElement() { 343 return (OMSVGFEMorphologyElement)convert((SVGFEMorphologyElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_MORPHOLOGY_TAG).cast()); 344 } 345 public final OMSVGFEOffsetElement createSVGFEOffsetElement() { 346 return (OMSVGFEOffsetElement)convert((SVGFEOffsetElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_OFFSET_TAG).cast()); 347 } 348 public final OMSVGFESpecularLightingElement createSVGFESpecularLightingElement() { 349 return (OMSVGFESpecularLightingElement)convert((SVGFESpecularLightingElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_SPECULAR_LIGHTING_TAG).cast()); 350 } 351 public final OMSVGFETileElement createSVGFETileElement() { 352 return (OMSVGFETileElement)convert((SVGFETileElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_TILE_TAG).cast()); 353 } 354 public final OMSVGFETurbulenceElement createSVGFETurbulenceElement() { 355 return (OMSVGFETurbulenceElement)convert((SVGFETurbulenceElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FE_TURBULENCE_TAG).cast()); 356 } 357 public final OMSVGCursorElement createSVGCursorElement() { 358 return (OMSVGCursorElement)convert((SVGCursorElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_CURSOR_TAG).cast()); 359 } 360 public final OMSVGAElement createSVGAElement() { 361 return (OMSVGAElement)convert((SVGAElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_A_TAG).cast()); 362 } 363 public final OMSVGViewElement createSVGViewElement() { 364 return (OMSVGViewElement)convert((SVGViewElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_VIEW_TAG).cast()); 365 } 366 public final OMSVGScriptElement createSVGScriptElement() { 367 return (OMSVGScriptElement)convert((SVGScriptElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SCRIPT_TAG).cast()); 368 } 369 public final OMSVGAnimateElement createSVGAnimateElement() { 370 return (OMSVGAnimateElement)convert((SVGAnimateElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ANIMATE_TAG).cast()); 371 } 372 public final OMSVGSetElement createSVGSetElement() { 373 return (OMSVGSetElement)convert((SVGSetElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SET_TAG).cast()); 374 } 375 public final OMSVGAnimateMotionElement createSVGAnimateMotionElement() { 376 return (OMSVGAnimateMotionElement)convert((SVGAnimateMotionElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ANIMATE_MOTION_TAG).cast()); 377 } 378 public final OMSVGMPathElement createSVGMPathElement() { 379 return (OMSVGMPathElement)convert((SVGMPathElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_M_PATH_TAG).cast()); 380 } 381 public final OMSVGAnimateColorElement createSVGAnimateColorElement() { 382 return (OMSVGAnimateColorElement)convert((SVGAnimateColorElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ANIMATE_COLOR_TAG).cast()); 383 } 384 public final OMSVGAnimateTransformElement createSVGAnimateTransformElement() { 385 return (OMSVGAnimateTransformElement)convert((SVGAnimateTransformElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_ANIMATE_TRANSFORM_TAG).cast()); 386 } 387 public final OMSVGFontElement createSVGFontElement() { 388 return (OMSVGFontElement)convert((SVGFontElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FONT_TAG).cast()); 389 } 390 public final OMSVGGlyphElement createSVGGlyphElement() { 391 return (OMSVGGlyphElement)convert((SVGGlyphElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_GLYPH_TAG).cast()); 392 } 393 public final OMSVGMissingGlyphElement createSVGMissingGlyphElement() { 394 return (OMSVGMissingGlyphElement)convert((SVGMissingGlyphElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_MISSING_GLYPH_TAG).cast()); 395 } 396 public final OMSVGHKernElement createSVGHKernElement() { 397 return (OMSVGHKernElement)convert((SVGHKernElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_H_KERN_TAG).cast()); 398 } 399 public final OMSVGVKernElement createSVGVKernElement() { 400 return (OMSVGVKernElement)convert((SVGVKernElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_V_KERN_TAG).cast()); 401 } 402 public final OMSVGFontFaceElement createSVGFontFaceElement() { 403 return (OMSVGFontFaceElement)convert((SVGFontFaceElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FONT_FACE_TAG).cast()); 404 } 405 public final OMSVGFontFaceSrcElement createSVGFontFaceSrcElement() { 406 return (OMSVGFontFaceSrcElement)convert((SVGFontFaceSrcElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FONT_FACE_SRC_TAG).cast()); 407 } 408 public final OMSVGFontFaceUriElement createSVGFontFaceUriElement() { 409 return (OMSVGFontFaceUriElement)convert((SVGFontFaceUriElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FONT_FACE_URI_TAG).cast()); 410 } 411 public final OMSVGFontFaceFormatElement createSVGFontFaceFormatElement() { 412 return (OMSVGFontFaceFormatElement)convert((SVGFontFaceFormatElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FONT_FACE_FORMAT_TAG).cast()); 413 } 414 public final OMSVGFontFaceNameElement createSVGFontFaceNameElement() { 415 return (OMSVGFontFaceNameElement)convert((SVGFontFaceNameElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FONT_FACE_NAME_TAG).cast()); 416 } 417 public final OMSVGMetadataElement createSVGMetadataElement() { 418 return (OMSVGMetadataElement)convert((SVGMetadataElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_METADATA_TAG).cast()); 419 } 420 public final OMSVGForeignObjectElement createSVGForeignObjectElement() { 421 return (OMSVGForeignObjectElement)convert((SVGForeignObjectElement)DOMHelper.createElementNS((Document)ot.cast(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_FOREIGN_OBJECT_TAG).cast()); 422 } 423 // Helper methods 424 /** 425 * Creates an {@link org.vectomatic.dom.svg.OMSVGCircleElement} object in this 426 * document but does not attach it to the document tree. 427 * The object is initialized to the specified coordinates 428 * and radius. 429 * @param cx the X coordinate of the circle center 430 * @param cy the Y coordinate of the circle center 431 * @param r the circle radius 432 * @return An {@link org.vectomatic.dom.svg.OMSVGCircleElement} object. 433 */ 434 public final OMSVGCircleElement createSVGCircleElement(float cx, float cy, float r) { 435 return new OMSVGCircleElement(cx, cy, r); 436 } 437 /** 438 * Creates an {@link org.vectomatic.dom.svg.OMSVGEllipseElement} object in this 439 * document but does not attach it to the document tree. 440 * The object is initialized to the specified coordinates 441 * and radii. 442 * @param cx the X coordinate of the ellipse center 443 * @param cy the Y coordinate of the ellipse center 444 * @param rx the X-axis radius of the ellipse 445 * @param ry the Y-axis radius of the ellipse 446 * @return An {@link org.vectomatic.dom.svg.OMSVGEllipseElement} object. 447 */ 448 public final OMSVGEllipseElement createSVGEllipseElement(float cx, float cy, float rx, float ry) { 449 return new OMSVGEllipseElement(cx, cy, rx, ry); 450 } 451 /** 452 * Creates an {@link org.vectomatic.dom.svg.OMSVGLineElement} object in this 453 * document but does not attach it to the document tree. 454 * The object is initialized to the specified endpoint coordinates. 455 * @param x1 the X coordinate of the first endpoint 456 * @param y1 the Y coordinate of the first endpoint 457 * @param x2 the X coordinate of the second endpoint 458 * @param y2 the Y coordinate of the second endpoint 459 * @return An {@link org.vectomatic.dom.svg.OMSVGLineElement} object. 460 */ 461 public final OMSVGLineElement createSVGLineElement(float x1, float y1, float x2, float y2) { 462 return new OMSVGLineElement(x1, y1, x2, y2); 463 } 464 /** 465 * Creates an {@link org.vectomatic.dom.svg.OMSVGLineElement} object in this 466 * document but does not attach it to the document tree. 467 * The object is initialized to the specified endpoints. 468 * @param p1 the first endpoint 469 * @param p2 the the second endpoint 470 * @return An {@link org.vectomatic.dom.svg.OMSVGLineElement} object. 471 */ 472 public final OMSVGLineElement createSVGLineElement(OMSVGPoint p1, OMSVGPoint p2) { 473 return new OMSVGLineElement(p1, p2); 474 } 475 /** 476 * Creates an {@link org.vectomatic.dom.svg.OMSVGRectElement} object in this 477 * document but does not attach it to the document tree. 478 * The object is initialized to the specified coordinates, size and 479 * corner radii. 480 * @param x the X coordinate of the upper left corner 481 * @param y the Y coordinate of the upper left corner 482 * @param width the width of the rectangle 483 * @param height the width of the rectangle 484 * @param rx the X-axis radius of the rectangle corner 485 * @param ry the Y-axis radius of the rectangle corner 486 * @return An {@link org.vectomatic.dom.svg.OMSVGRectElement} object. 487 */ 488 public final OMSVGRectElement createSVGRectElement(float x, float y, float width, float height, float rx, float ry) { 489 return new OMSVGRectElement(x, y, width, height, rx, ry); 490 } 491 /** 492 * Creates an {@link org.vectomatic.dom.svg.OMSVGRectElement} object in this 493 * document but does not attach it to the document tree. 494 * The object is initialized with the specified SVG rect and zero 495 * corner radii. 496 * @param rect The SVG rect to use to initialize this rect. 497 * @return An {@link org.vectomatic.dom.svg.OMSVGRectElement} object. 498 */ 499 public final OMSVGRectElement createSVGRectElement(OMSVGRect rect) { 500 return new OMSVGRectElement(rect); 501 } 502 /** 503 * Creates an {@link org.vectomatic.dom.svg.OMSVGTextElement} object in this 504 * document but does not attach it to the document tree. 505 * The object is initialized to the specified coordinates and string data. 506 * @param x the X coordinate of the text in specified units 507 * @param y the Y coordinate of the text in specified units 508 * @param unitType the unit type used to specify the text coordinates 509 * @param data the string represented by the text object. 510 * @return An {@link org.vectomatic.dom.svg.OMSVGTextElement} object. 511 */ 512 public final OMSVGTextElement createSVGTextElement(float x, float y, short unitType, String data) { 513 return new OMSVGTextElement(x, y, unitType, data); 514 } 515 /** 516 * Creates an {@link org.vectomatic.dom.svg.OMSVGImageElement} object in this 517 * document but does not attach it to the document tree. 518 * The object is initialized to the specified coordinates, size and 519 * image reference. 520 * @param x the X coordinate of the image 521 * @param y the Y coordinate of the image 522 * @param width the width of the image 523 * @param height the width of the image 524 * @param href the bitmap image referenced by this image element 525 * @return An {@link org.vectomatic.dom.svg.OMSVGImageElement} object. 526 */ 527 public final OMSVGImageElement createSVGImageElement(float x, float y, float width, float height, String href) { 528 return new OMSVGImageElement(x, y, width, height, href); 529 } 530 /** 531 * Creates an {@link org.vectomatic.dom.svg.OMSVGTitleElement} object in this 532 * document but does not attach it to the document tree. 533 * The object is initialized to the specified text. 534 * @param text the title text 535 * @return An {@link org.vectomatic.dom.svg.OMSVGTitleElement} object. 536 */ 537 public final OMSVGTitleElement createSVGTitleElement(String text) { 538 return new OMSVGTitleElement(text); 539 } 540 /** 541 * Creates an {@link org.vectomatic.dom.svg.OMSVGDescElement} object in this 542 * document but does not attach it to the document tree. 543 * The object is initialized to the specified text. 544 * @param text the description text 545 * @return An {@link org.vectomatic.dom.svg.OMSVGDescElement} object. 546 */ 547 public final OMSVGDescElement createSVGDescElement(String text) { 548 return new OMSVGDescElement(text); 549 } 550}