1 18 package org.apache.batik.dom.svg; 19 20 import java.net.URL ; 21 22 import org.apache.batik.css.dom.CSSOMSVGViewCSS; 23 import org.apache.batik.css.engine.CSSContext; 24 import org.apache.batik.css.engine.CSSEngine; 25 import org.apache.batik.css.engine.SVGCSSEngine; 26 import org.apache.batik.css.engine.value.ShorthandManager; 27 import org.apache.batik.css.engine.value.ValueManager; 28 import org.apache.batik.css.parser.ExtendedParser; 29 import org.apache.batik.css.parser.ExtendedParserWrapper; 30 import org.apache.batik.dom.AbstractDocument; 31 import org.apache.batik.dom.AbstractStylableDocument; 32 import org.apache.batik.dom.ExtensibleDOMImplementation; 33 import org.apache.batik.dom.GenericDocumentType; 34 import org.apache.batik.dom.GenericElement; 35 import org.apache.batik.dom.GenericElementNS; 36 import org.apache.batik.dom.StyleSheetFactory; 37 import org.apache.batik.dom.events.DocumentEventSupport; 38 import org.apache.batik.dom.util.CSSStyleDeclarationFactory; 39 import org.apache.batik.dom.util.DOMUtilities; 40 import org.apache.batik.dom.util.HashTable; 41 import org.apache.batik.i18n.LocalizableSupport; 42 import org.apache.batik.util.SVGConstants; 43 import org.apache.batik.util.XMLResourceDescriptor; 44 45 import org.w3c.css.sac.InputSource; 46 import org.w3c.css.sac.Parser; 47 import org.w3c.dom.DOMException ; 48 import org.w3c.dom.DOMImplementation ; 49 import org.w3c.dom.Document ; 50 import org.w3c.dom.DocumentType ; 51 import org.w3c.dom.Element ; 52 import org.w3c.dom.Node ; 53 import org.w3c.dom.css.CSSStyleDeclaration; 54 import org.w3c.dom.css.CSSStyleSheet; 55 import org.w3c.dom.css.DOMImplementationCSS; 56 import org.w3c.dom.css.ViewCSS; 57 import org.w3c.dom.events.Event ; 58 import org.w3c.dom.stylesheets.StyleSheet; 59 60 67 public class SVGDOMImplementation 68 extends ExtensibleDOMImplementation 69 implements CSSStyleDeclarationFactory { 70 71 74 public final static String SVG_NAMESPACE_URI = 75 SVGConstants.SVG_NAMESPACE_URI; 76 77 80 protected final static String RESOURCES = 81 "org.apache.batik.dom.svg.resources.Messages"; 82 83 protected HashTable factories; 84 85 88 public static DOMImplementation getDOMImplementation() { 89 return DOM_IMPLEMENTATION; 90 } 91 92 93 96 public SVGDOMImplementation() { 97 factories = svg11Factories; 98 registerFeature("CSS", "2.0"); 99 registerFeature("StyleSheets", "2.0"); 100 registerFeature("SVG", new String [] {"1.0", "1.1"}); 101 registerFeature("SVGEvents", new String [] {"1.0", "1.1"}); 102 } 103 104 protected void initLocalizable() { 105 localizableSupport = new LocalizableSupport 106 (RESOURCES, getClass().getClassLoader()); 107 } 108 109 public CSSEngine createCSSEngine(AbstractStylableDocument doc, 110 CSSContext ctx, 111 ExtendedParser ep, 112 ValueManager [] vms, 113 ShorthandManager [] sms) { 114 115 URL durl = ((SVGOMDocument)doc).getURLObject(); 116 CSSEngine result = new SVGCSSEngine(doc, durl, ep, vms, sms, ctx); 117 118 URL url = getClass().getResource("resources/UserAgentStyleSheet.css"); 119 if (url != null) { 120 InputSource is = new InputSource(url.toString()); 121 result.setUserAgentStyleSheet 122 (result.parseStyleSheet(is, url, "all")); 123 } 124 125 return result; 126 } 127 128 131 public ViewCSS createViewCSS(AbstractStylableDocument doc) { 132 return new CSSOMSVGViewCSS(doc.getCSSEngine()); 133 } 134 135 139 public DocumentType createDocumentType(String qualifiedName, 140 String publicId, 141 String systemId) { 142 return new GenericDocumentType(qualifiedName, publicId, systemId); 143 } 144 145 149 public Document createDocument(String namespaceURI, 150 String qualifiedName, 151 DocumentType doctype) 152 throws DOMException { 153 Document result = new SVGOMDocument(doctype, this); 154 if (qualifiedName != null) 156 result.appendChild(result.createElementNS(namespaceURI, 157 qualifiedName)); 158 return result; 159 } 160 161 163 167 public CSSStyleSheet createCSSStyleSheet(String title, String media) { 168 throw new InternalError ("Not implemented"); 169 } 170 171 173 177 public CSSStyleDeclaration createCSSStyleDeclaration() { 178 throw new InternalError ("Not implemented"); 179 } 180 181 183 187 public StyleSheet createStyleSheet(Node n, HashTable attrs) { 188 throw new InternalError ("Not implemented"); 189 } 190 191 194 public CSSStyleSheet getUserAgentStyleSheet() { 195 throw new InternalError ("Not implemented"); 196 } 197 198 202 public Element createElementNS(AbstractDocument document, 203 String namespaceURI, 204 String qualifiedName) { 205 if (SVGConstants.SVG_NAMESPACE_URI.equals(namespaceURI)) { 206 String name = DOMUtilities.getLocalName(qualifiedName); 207 ElementFactory ef = (ElementFactory)factories.get(name); 208 if (ef != null) 209 return ef.create(DOMUtilities.getPrefix(qualifiedName), 210 document); 211 throw document.createDOMException 212 (DOMException.NOT_FOUND_ERR, "invalid.element", 213 new Object [] { namespaceURI, qualifiedName }); 214 } 215 216 return super.createElementNS(document, namespaceURI, qualifiedName); 217 } 218 219 223 public DocumentEventSupport createDocumentEventSupport() { 224 DocumentEventSupport result = new DocumentEventSupport(); 225 result.registerEventFactory("SVGEvents", 226 new DocumentEventSupport.EventFactory() { 227 public Event createEvent() { 228 return new SVGOMEvent(); 229 } 230 }); 231 return result; 232 } 233 234 236 239 protected static HashTable svg11Factories = new HashTable(); 240 241 static { 242 svg11Factories.put(SVGConstants.SVG_A_TAG, 243 new AElementFactory()); 244 245 svg11Factories.put(SVGConstants.SVG_ALT_GLYPH_TAG, 246 new AltGlyphElementFactory()); 247 248 svg11Factories.put(SVGConstants.SVG_ALT_GLYPH_DEF_TAG, 249 new AltGlyphDefElementFactory()); 250 251 svg11Factories.put(SVGConstants.SVG_ALT_GLYPH_ITEM_TAG, 252 new AltGlyphItemElementFactory()); 253 254 svg11Factories.put(SVGConstants.SVG_ANIMATE_TAG, 255 new AnimateElementFactory()); 256 257 svg11Factories.put(SVGConstants.SVG_ANIMATE_COLOR_TAG, 258 new AnimateColorElementFactory()); 259 260 svg11Factories.put(SVGConstants.SVG_ANIMATE_MOTION_TAG, 261 new AnimateMotionElementFactory()); 262 263 svg11Factories.put(SVGConstants.SVG_ANIMATE_TRANSFORM_TAG, 264 new AnimateTransformElementFactory()); 265 266 svg11Factories.put(SVGConstants.SVG_CIRCLE_TAG, 267 new CircleElementFactory()); 268 269 svg11Factories.put(SVGConstants.SVG_CLIP_PATH_TAG, 270 new ClipPathElementFactory()); 271 272 svg11Factories.put(SVGConstants.SVG_COLOR_PROFILE_TAG, 273 new ColorProfileElementFactory()); 274 275 svg11Factories.put(SVGConstants.SVG_CURSOR_TAG, 276 new CursorElementFactory()); 277 278 svg11Factories.put(SVGConstants.SVG_DEFINITION_SRC_TAG, 279 new DefinitionSrcElementFactory()); 280 281 svg11Factories.put(SVGConstants.SVG_DEFS_TAG, 282 new DefsElementFactory()); 283 284 svg11Factories.put(SVGConstants.SVG_DESC_TAG, 285 new DescElementFactory()); 286 287 svg11Factories.put(SVGConstants.SVG_ELLIPSE_TAG, 288 new EllipseElementFactory()); 289 290 svg11Factories.put(SVGConstants.SVG_FE_BLEND_TAG, 291 new FeBlendElementFactory()); 292 293 svg11Factories.put(SVGConstants.SVG_FE_COLOR_MATRIX_TAG, 294 new FeColorMatrixElementFactory()); 295 296 svg11Factories.put(SVGConstants.SVG_FE_COMPONENT_TRANSFER_TAG, 297 new FeComponentTransferElementFactory()); 298 299 svg11Factories.put(SVGConstants.SVG_FE_COMPOSITE_TAG, 300 new FeCompositeElementFactory()); 301 302 svg11Factories.put(SVGConstants.SVG_FE_CONVOLVE_MATRIX_TAG, 303 new FeConvolveMatrixElementFactory()); 304 305 svg11Factories.put(SVGConstants.SVG_FE_DIFFUSE_LIGHTING_TAG, 306 new FeDiffuseLightingElementFactory()); 307 308 svg11Factories.put(SVGConstants.SVG_FE_DISPLACEMENT_MAP_TAG, 309 new FeDisplacementMapElementFactory()); 310 311 svg11Factories.put(SVGConstants.SVG_FE_DISTANT_LIGHT_TAG, 312 new FeDistantLightElementFactory()); 313 314 svg11Factories.put(SVGConstants.SVG_FE_FLOOD_TAG, 315 new FeFloodElementFactory()); 316 317 svg11Factories.put(SVGConstants.SVG_FE_FUNC_A_TAG, 318 new FeFuncAElementFactory()); 319 320 svg11Factories.put(SVGConstants.SVG_FE_FUNC_R_TAG, 321 new FeFuncRElementFactory()); 322 323 svg11Factories.put(SVGConstants.SVG_FE_FUNC_G_TAG, 324 new FeFuncGElementFactory()); 325 326 svg11Factories.put(SVGConstants.SVG_FE_FUNC_B_TAG, 327 new FeFuncBElementFactory()); 328 329 svg11Factories.put(SVGConstants.SVG_FE_GAUSSIAN_BLUR_TAG, 330 new FeGaussianBlurElementFactory()); 331 332 svg11Factories.put(SVGConstants.SVG_FE_IMAGE_TAG, 333 new FeImageElementFactory()); 334 335 svg11Factories.put(SVGConstants.SVG_FE_MERGE_TAG, 336 new FeMergeElementFactory()); 337 338 svg11Factories.put(SVGConstants.SVG_FE_MERGE_NODE_TAG, 339 new FeMergeNodeElementFactory()); 340 341 svg11Factories.put(SVGConstants.SVG_FE_MORPHOLOGY_TAG, 342 new FeMorphologyElementFactory()); 343 344 svg11Factories.put(SVGConstants.SVG_FE_OFFSET_TAG, 345 new FeOffsetElementFactory()); 346 347 svg11Factories.put(SVGConstants.SVG_FE_POINT_LIGHT_TAG, 348 new FePointLightElementFactory()); 349 350 svg11Factories.put(SVGConstants.SVG_FE_SPECULAR_LIGHTING_TAG, 351 new FeSpecularLightingElementFactory()); 352 353 svg11Factories.put(SVGConstants.SVG_FE_SPOT_LIGHT_TAG, 354 new FeSpotLightElementFactory()); 355 356 svg11Factories.put(SVGConstants.SVG_FE_TILE_TAG, 357 new FeTileElementFactory()); 358 359 svg11Factories.put(SVGConstants.SVG_FE_TURBULENCE_TAG, 360 new FeTurbulenceElementFactory()); 361 362 svg11Factories.put(SVGConstants.SVG_FILTER_TAG, 363 new FilterElementFactory()); 364 365 svg11Factories.put(SVGConstants.SVG_FONT_TAG, 366 new FontElementFactory()); 367 368 svg11Factories.put(SVGConstants.SVG_FONT_FACE_TAG, 369 new FontFaceElementFactory()); 370 371 svg11Factories.put(SVGConstants.SVG_FONT_FACE_FORMAT_TAG, 372 new FontFaceFormatElementFactory()); 373 374 svg11Factories.put(SVGConstants.SVG_FONT_FACE_NAME_TAG, 375 new FontFaceNameElementFactory()); 376 377 svg11Factories.put(SVGConstants.SVG_FONT_FACE_SRC_TAG, 378 new FontFaceSrcElementFactory()); 379 380 svg11Factories.put(SVGConstants.SVG_FONT_FACE_URI_TAG, 381 new FontFaceUriElementFactory()); 382 383 svg11Factories.put(SVGConstants.SVG_FOREIGN_OBJECT_TAG, 384 new ForeignObjectElementFactory()); 385 386 svg11Factories.put(SVGConstants.SVG_G_TAG, 387 new GElementFactory()); 388 389 svg11Factories.put(SVGConstants.SVG_GLYPH_TAG, 390 new GlyphElementFactory()); 391 392 svg11Factories.put(SVGConstants.SVG_GLYPH_REF_TAG, 393 new GlyphRefElementFactory()); 394 395 svg11Factories.put(SVGConstants.SVG_HKERN_TAG, 396 new HkernElementFactory()); 397 398 svg11Factories.put(SVGConstants.SVG_IMAGE_TAG, 399 new ImageElementFactory()); 400 401 svg11Factories.put(SVGConstants.SVG_LINE_TAG, 402 new LineElementFactory()); 403 404 svg11Factories.put(SVGConstants.SVG_LINEAR_GRADIENT_TAG, 405 new LinearGradientElementFactory()); 406 407 svg11Factories.put(SVGConstants.SVG_MARKER_TAG, 408 new MarkerElementFactory()); 409 410 svg11Factories.put(SVGConstants.SVG_MASK_TAG, 411 new MaskElementFactory()); 412 413 svg11Factories.put(SVGConstants.SVG_METADATA_TAG, 414 new MetadataElementFactory()); 415 416 svg11Factories.put(SVGConstants.SVG_MISSING_GLYPH_TAG, 417 new MissingGlyphElementFactory()); 418 419 svg11Factories.put(SVGConstants.SVG_MPATH_TAG, 420 new MpathElementFactory()); 421 422 svg11Factories.put(SVGConstants.SVG_PATH_TAG, 423 new PathElementFactory()); 424 425 svg11Factories.put(SVGConstants.SVG_PATTERN_TAG, 426 new PatternElementFactory()); 427 428 svg11Factories.put(SVGConstants.SVG_POLYGON_TAG, 429 new PolygonElementFactory()); 430 431 svg11Factories.put(SVGConstants.SVG_POLYLINE_TAG, 432 new PolylineElementFactory()); 433 434 svg11Factories.put(SVGConstants.SVG_RADIAL_GRADIENT_TAG, 435 new RadialGradientElementFactory()); 436 437 svg11Factories.put(SVGConstants.SVG_RECT_TAG, 438 new RectElementFactory()); 439 440 svg11Factories.put(SVGConstants.SVG_SET_TAG, 441 new SetElementFactory()); 442 443 svg11Factories.put(SVGConstants.SVG_SCRIPT_TAG, 444 new ScriptElementFactory()); 445 446 svg11Factories.put(SVGConstants.SVG_STOP_TAG, 447 new StopElementFactory()); 448 449 svg11Factories.put(SVGConstants.SVG_STYLE_TAG, 450 new StyleElementFactory()); 451 452 svg11Factories.put(SVGConstants.SVG_SVG_TAG, 453 new SvgElementFactory()); 454 455 svg11Factories.put(SVGConstants.SVG_SWITCH_TAG, 456 new SwitchElementFactory()); 457 458 svg11Factories.put(SVGConstants.SVG_SYMBOL_TAG, 459 new SymbolElementFactory()); 460 461 svg11Factories.put(SVGConstants.SVG_TEXT_TAG, 462 new TextElementFactory()); 463 464 svg11Factories.put(SVGConstants.SVG_TEXT_PATH_TAG, 465 new TextPathElementFactory()); 466 467 svg11Factories.put(SVGConstants.SVG_TITLE_TAG, 468 new TitleElementFactory()); 469 470 svg11Factories.put(SVGConstants.SVG_TREF_TAG, 471 new TrefElementFactory()); 472 473 svg11Factories.put(SVGConstants.SVG_TSPAN_TAG, 474 new TspanElementFactory()); 475 476 svg11Factories.put(SVGConstants.SVG_USE_TAG, 477 new UseElementFactory()); 478 479 svg11Factories.put(SVGConstants.SVG_VIEW_TAG, 480 new ViewElementFactory()); 481 482 svg11Factories.put(SVGConstants.SVG_VKERN_TAG, 483 new VkernElementFactory()); 484 } 485 486 489 protected static class AElementFactory implements ElementFactory { 490 public AElementFactory() {} 491 494 public Element create(String prefix, Document doc) { 495 return new SVGOMAElement(prefix, (AbstractDocument)doc); 496 } 497 } 498 499 502 protected static class AltGlyphElementFactory implements ElementFactory { 503 public AltGlyphElementFactory() {} 504 507 public Element create(String prefix, Document doc) { 508 return new SVGOMAltGlyphElement(prefix, (AbstractDocument)doc); 509 } 510 } 511 512 515 protected static class AltGlyphDefElementFactory 516 implements ElementFactory { 517 public AltGlyphDefElementFactory() {} 518 521 public Element create(String prefix, Document doc) { 522 return new SVGOMAltGlyphDefElement(prefix, (AbstractDocument)doc); 523 } 524 } 525 526 529 protected static class AltGlyphItemElementFactory 530 implements ElementFactory { 531 public AltGlyphItemElementFactory() {} 532 535 public Element create(String prefix, Document doc) { 536 return new SVGOMAltGlyphItemElement(prefix, (AbstractDocument)doc); 537 } 538 } 539 540 543 protected static class AnimateElementFactory implements ElementFactory { 544 public AnimateElementFactory() {} 545 548 public Element create(String prefix, Document doc) { 549 return new SVGOMAnimateElement(prefix, (AbstractDocument)doc); 550 } 551 } 552 553 556 protected static class AnimateColorElementFactory 557 implements ElementFactory { 558 public AnimateColorElementFactory() {} 559 562 public Element create(String prefix, Document doc) { 563 return new SVGOMAnimateColorElement(prefix, (AbstractDocument)doc); 564 } 565 } 566 567 570 protected static class AnimateMotionElementFactory 571 implements ElementFactory { 572 public AnimateMotionElementFactory() {} 573 576 public Element create(String prefix, Document doc) { 577 return new SVGOMAnimateMotionElement(prefix, 578 (AbstractDocument)doc); 579 } 580 } 581 582 585 protected static class AnimateTransformElementFactory 586 implements ElementFactory { 587 public AnimateTransformElementFactory() {} 588 591 public Element create(String prefix, Document doc) { 592 return new SVGOMAnimateTransformElement(prefix, 593 (AbstractDocument)doc); 594 } 595 } 596 597 600 protected static class CircleElementFactory implements ElementFactory { 601 public CircleElementFactory() {} 602 605 public Element create(String prefix, Document doc) { 606 return new SVGOMCircleElement(prefix, (AbstractDocument)doc); 607 } 608 } 609 610 613 protected static class ClipPathElementFactory implements ElementFactory { 614 public ClipPathElementFactory() {} 615 618 public Element create(String prefix, Document doc) { 619 return new SVGOMClipPathElement(prefix, (AbstractDocument)doc); 620 } 621 } 622 623 626 protected static class ColorProfileElementFactory 627 implements ElementFactory { 628 public ColorProfileElementFactory() {} 629 632 public Element create(String prefix, Document doc) { 633 return new SVGOMColorProfileElement(prefix, (AbstractDocument)doc); 634 } 635 } 636 637 640 protected static class CursorElementFactory implements ElementFactory { 641 public CursorElementFactory() {} 642 645 public Element create(String prefix, Document doc) { 646 return new SVGOMCursorElement(prefix, (AbstractDocument)doc); 647 } 648 } 649 650 653 protected static class DefinitionSrcElementFactory 654 implements ElementFactory { 655 public DefinitionSrcElementFactory() {} 656 659 public Element create(String prefix, Document doc) { 660 return new SVGOMDefinitionSrcElement(prefix, 661 (AbstractDocument)doc); 662 } 663 } 664 665 668 protected static class DefsElementFactory implements ElementFactory { 669 public DefsElementFactory() {} 670 673 public Element create(String prefix, Document doc) { 674 return new SVGOMDefsElement(prefix, (AbstractDocument)doc); 675 } 676 } 677 678 681 protected static class DescElementFactory implements ElementFactory { 682 public DescElementFactory() {} 683 686 public Element create(String prefix, Document doc) { 687 return new SVGOMDescElement(prefix, (AbstractDocument)doc); 688 } 689 } 690 691 694 protected static class EllipseElementFactory implements ElementFactory { 695 public EllipseElementFactory() {} 696 699 public Element create(String prefix, Document doc) { 700 return new SVGOMEllipseElement(prefix, (AbstractDocument)doc); 701 } 702 } 703 704 707 protected static class FeBlendElementFactory implements ElementFactory { 708 public FeBlendElementFactory() {} 709 712 public Element create(String prefix, Document doc) { 713 return new SVGOMFEBlendElement(prefix, (AbstractDocument)doc); 714 } 715 } 716 717 720 protected static class FeColorMatrixElementFactory 721 implements ElementFactory { 722 public FeColorMatrixElementFactory() {} 723 726 public Element create(String prefix, Document doc) { 727 return new SVGOMFEColorMatrixElement(prefix, 728 (AbstractDocument)doc); 729 } 730 } 731 732 735 protected static class FeComponentTransferElementFactory 736 implements ElementFactory { 737 public FeComponentTransferElementFactory() {} 738 741 public Element create(String prefix, Document doc) { 742 return new SVGOMFEComponentTransferElement(prefix, 743 (AbstractDocument)doc); 744 } 745 } 746 747 750 protected static class FeCompositeElementFactory 751 implements ElementFactory { 752 public FeCompositeElementFactory() {} 753 756 public Element create(String prefix, Document doc) { 757 return new SVGOMFECompositeElement(prefix, (AbstractDocument)doc); 758 } 759 } 760 761 764 protected static class FeConvolveMatrixElementFactory 765 implements ElementFactory { 766 public FeConvolveMatrixElementFactory() {} 767 770 public Element create(String prefix, Document doc) { 771 return new SVGOMFEConvolveMatrixElement(prefix, 772 (AbstractDocument)doc); 773 } 774 } 775 776 779 protected static class FeDiffuseLightingElementFactory 780 implements ElementFactory { 781 public FeDiffuseLightingElementFactory() {} 782 785 public Element create(String prefix, Document doc) { 786 return new SVGOMFEDiffuseLightingElement(prefix, 787 (AbstractDocument)doc); 788 } 789 } 790 791 794 protected static class FeDisplacementMapElementFactory 795 implements ElementFactory { 796 public FeDisplacementMapElementFactory() {} 797 800 public Element create(String prefix, Document doc) { 801 return new SVGOMFEDisplacementMapElement(prefix, 802 (AbstractDocument)doc); 803 } 804 } 805 806 809 protected static class FeDistantLightElementFactory 810 implements ElementFactory { 811 public FeDistantLightElementFactory() {} 812 815 public Element create(String prefix, Document doc) { 816 return new SVGOMFEDistantLightElement(prefix, 817 (AbstractDocument)doc); 818 } 819 } 820 821 824 protected static class FeFloodElementFactory implements ElementFactory { 825 public FeFloodElementFactory() {} 826 829 public Element create(String prefix, Document doc) { 830 return new SVGOMFEFloodElement(prefix, (AbstractDocument)doc); 831 } 832 } 833 834 837 protected static class FeFuncAElementFactory implements ElementFactory { 838 public FeFuncAElementFactory() {} 839 842 public Element create(String prefix, Document doc) { 843 return new SVGOMFEFuncAElement(prefix, (AbstractDocument)doc); 844 } 845 } 846 847 850 protected static class FeFuncRElementFactory implements ElementFactory { 851 public FeFuncRElementFactory() {} 852 855 public Element create(String prefix, Document doc) { 856 return new SVGOMFEFuncRElement(prefix, (AbstractDocument)doc); 857 } 858 } 859 860 863 protected static class FeFuncGElementFactory implements ElementFactory { 864 public FeFuncGElementFactory() {} 865 868 public Element create(String prefix, Document doc) { 869 return new SVGOMFEFuncGElement(prefix, (AbstractDocument)doc); 870 } 871 } 872 873 874 877 protected static class FeFuncBElementFactory 878 implements ElementFactory { 879 public FeFuncBElementFactory() {} 880 883 public Element create(String prefix, Document doc) { 884 return new SVGOMFEFuncBElement(prefix, (AbstractDocument)doc); 885 } 886 } 887 888 891 protected static class FeGaussianBlurElementFactory 892 implements ElementFactory { 893 public FeGaussianBlurElementFactory() {} 894 897 public Element create(String prefix, Document doc) { 898 return new SVGOMFEGaussianBlurElement(prefix, 899 (AbstractDocument)doc); 900 } 901 } 902 903 906 protected static class FeImageElementFactory implements ElementFactory { 907 public FeImageElementFactory() {} 908 911 public Element create(String prefix, Document doc) { 912 return new SVGOMFEImageElement(prefix, (AbstractDocument)doc); 913 } 914 } 915 916 919 protected static class FeMergeElementFactory 920 implements ElementFactory { 921 public FeMergeElementFactory() {} 922 925 public Element create(String prefix, Document doc) { 926 return new SVGOMFEMergeElement(prefix, (AbstractDocument)doc); 927 } 928 } 929 930 933 protected static class FeMergeNodeElementFactory 934 implements ElementFactory { 935 public FeMergeNodeElementFactory() {} 936 939 public Element create(String prefix, Document doc) { 940 return new SVGOMFEMergeNodeElement(prefix, (AbstractDocument)doc); 941 } 942 } 943 944 947 protected static class FeMorphologyElementFactory 948 implements ElementFactory { 949 public FeMorphologyElementFactory() {} 950 953 public Element create(String prefix, Document doc) { 954 return new SVGOMFEMorphologyElement(prefix, 955 (AbstractDocument)doc); 956 } 957 } 958 959 962 protected static class FeOffsetElementFactory implements ElementFactory { 963 public FeOffsetElementFactory() {} 964 967 public Element create(String prefix, Document doc) { 968 return new SVGOMFEOffsetElement(prefix, (AbstractDocument)doc); 969 } 970 } 971 972 975 protected static class FePointLightElementFactory 976 implements ElementFactory { 977 public FePointLightElementFactory() {} 978 981 public Element create(String prefix, Document doc) { 982 return new SVGOMFEPointLightElement(prefix, (AbstractDocument)doc); 983 } 984 } 985 986 989 protected static class FeSpecularLightingElementFactory 990 implements ElementFactory { 991 public FeSpecularLightingElementFactory() {} 992 995 public Element create(String prefix, Document doc) { 996 return new SVGOMFESpecularLightingElement(prefix, 997 (AbstractDocument)doc); 998 } 999 } 1000 1001 1004 protected static class FeSpotLightElementFactory 1005 implements ElementFactory { 1006 public FeSpotLightElementFactory() {} 1007 1010 public Element create(String prefix, Document doc) { 1011 return new SVGOMFESpotLightElement(prefix, (AbstractDocument)doc); 1012 } 1013 } 1014 1015 1018 protected static class FeTileElementFactory implements ElementFactory { 1019 public FeTileElementFactory() {} 1020 1023 public Element create(String prefix, Document doc) { 1024 return new SVGOMFETileElement(prefix, (AbstractDocument)doc); 1025 } 1026 } 1027 1028 1031 protected static class FeTurbulenceElementFactory 1032 implements ElementFactory{ 1033 public FeTurbulenceElementFactory() {} 1034 1037 public Element create(String prefix, Document doc) { 1038 return new SVGOMFETurbulenceElement(prefix, (AbstractDocument)doc); 1039 } 1040 } 1041 1042 1045 protected static class FilterElementFactory implements ElementFactory { 1046 public FilterElementFactory() {} 1047 1050 public Element create(String prefix, Document doc) { 1051 return new SVGOMFilterElement(prefix, (AbstractDocument)doc); 1052 } 1053 } 1054 1055 1058 protected static class FontElementFactory implements ElementFactory { 1059 public FontElementFactory() {} 1060 1063 public Element create(String prefix, Document doc) { 1064 return new SVGOMFontElement(prefix, (AbstractDocument)doc); 1065 } 1066 } 1067 1068 1071 protected static class FontFaceElementFactory implements ElementFactory { 1072 public FontFaceElementFactory() {} 1073 1076 public Element create(String prefix, Document doc) { 1077 return new SVGOMFontFaceElement(prefix, (AbstractDocument)doc); 1078 } 1079 } 1080 1081 1084 protected static class FontFaceFormatElementFactory 1085 implements ElementFactory { 1086 public FontFaceFormatElementFactory() {} 1087 1090 public Element create(String prefix, Document doc) { 1091 return new SVGOMFontFaceFormatElement(prefix, 1092 (AbstractDocument)doc); 1093 } 1094 } 1095 1096 1099 protected static class FontFaceNameElementFactory 1100 implements ElementFactory { 1101 public FontFaceNameElementFactory() {} 1102 1105 public Element create(String prefix, Document doc) { 1106 return new SVGOMFontFaceNameElement(prefix, (AbstractDocument)doc); 1107 } 1108 } 1109 1110 1113 protected static class FontFaceSrcElementFactory 1114 implements ElementFactory { 1115 public FontFaceSrcElementFactory() {} 1116 1119 public Element create(String prefix, Document doc) { 1120 return new SVGOMFontFaceSrcElement(prefix, (AbstractDocument)doc); 1121 } 1122 } 1123 1124 1127 protected static class FontFaceUriElementFactory 1128 implements ElementFactory { 1129 public FontFaceUriElementFactory() {} 1130 1133 public Element create(String prefix, Document doc) { 1134 return new SVGOMFontFaceUriElement(prefix, (AbstractDocument)doc); 1135 } 1136 } 1137 1138 1141 protected static class ForeignObjectElementFactory 1142 implements ElementFactory { 1143 public ForeignObjectElementFactory() {} 1144 1147 public Element create(String prefix, Document doc) { 1148 return new SVGOMForeignObjectElement(prefix, 1149 (AbstractDocument)doc); 1150 } 1151 } 1152 1153 1156 protected static class GElementFactory implements ElementFactory { 1157 public GElementFactory() {} 1158 1161 public Element create(String prefix, Document doc) { 1162 return new SVGOMGElement(prefix, (AbstractDocument)doc); 1163 } 1164 } 1165 1166 1169 protected static class GlyphElementFactory implements ElementFactory { 1170 public GlyphElementFactory() {} 1171 1174 public Element create(String prefix, Document doc) { 1175 return new SVGOMGlyphElement(prefix, (AbstractDocument)doc); 1176 } 1177 } 1178 1179 1182 protected static class GlyphRefElementFactory implements ElementFactory { 1183 public GlyphRefElementFactory() {} 1184 1187 public Element create(String prefix, Document doc) { 1188 return new SVGOMGlyphRefElement(prefix, (AbstractDocument)doc); 1189 } 1190 } 1191 1192 1195 protected static class HkernElementFactory implements ElementFactory { 1196 public HkernElementFactory() {} 1197 1200 public Element create(String prefix, Document doc) { 1201 return new SVGOMHKernElement(prefix, (AbstractDocument)doc); 1202 } 1203 } 1204 1205 1208 protected static class ImageElementFactory implements ElementFactory { 1209 public ImageElementFactory() {} 1210 1213 public Element create(String prefix, Document doc) { 1214 return new SVGOMImageElement(prefix, (AbstractDocument)doc); 1215 } 1216 } 1217 1218 1221 protected static class LineElementFactory implements ElementFactory { 1222 public LineElementFactory() {} 1223 1226 public Element create(String prefix, Document doc) { 1227 return new SVGOMLineElement(prefix, (AbstractDocument)doc); 1228 } 1229 } 1230 1231 1234 protected static class LinearGradientElementFactory 1235 implements ElementFactory { 1236 public LinearGradientElementFactory() {} 1237 1240 public Element create(String prefix, Document doc) { 1241 return new SVGOMLinearGradientElement(prefix, 1242 (AbstractDocument)doc); 1243 } 1244 } 1245 1246 1249 protected static class MarkerElementFactory implements ElementFactory { 1250 public MarkerElementFactory() {} 1251 1254 public Element create(String prefix, Document doc) { 1255 return new SVGOMMarkerElement(prefix, (AbstractDocument)doc); 1256 } 1257 } 1258 1259 1262 protected static class MaskElementFactory implements ElementFactory { 1263 public MaskElementFactory() {} 1264 1267 public Element create(String prefix, Document doc) { 1268 return new SVGOMMaskElement(prefix, (AbstractDocument)doc); 1269 } 1270 } 1271 1272 1275 protected static class MetadataElementFactory implements ElementFactory { 1276 public MetadataElementFactory() {} 1277 1280 public Element create(String prefix, Document doc) { 1281 return new SVGOMMetadataElement(prefix, (AbstractDocument)doc); 1282 } 1283 } 1284 1285 1288 protected static class MissingGlyphElementFactory 1289 implements ElementFactory { 1290 public MissingGlyphElementFactory() {} 1291 1294 public Element create(String prefix, Document doc) { 1295 return new SVGOMMissingGlyphElement(prefix, (AbstractDocument)doc); 1296 } 1297 } 1298 1299 1302 protected static class MpathElementFactory implements ElementFactory { 1303 public MpathElementFactory() {} 1304 1307 public Element create(String prefix, Document doc) { 1308 return new SVGOMMPathElement(prefix, (AbstractDocument)doc); 1309 } 1310 } 1311 1312 1315 protected static class PathElementFactory implements ElementFactory { 1316 public PathElementFactory() {} 1317 1320 public Element create(String prefix, Document doc) { 1321 return new SVGOMPathElement(prefix, (AbstractDocument)doc); 1322 } 1323 } 1324 1325 1328 protected static class PatternElementFactory implements ElementFactory { 1329 public PatternElementFactory() {} 1330 1333 public Element create(String prefix, Document doc) { 1334 return new SVGOMPatternElement(prefix, (AbstractDocument)doc); 1335 } 1336 } 1337 1338 1341 protected static class PolygonElementFactory implements ElementFactory { 1342 public PolygonElementFactory() {} 1343 1346 public Element create(String prefix, Document doc) { 1347 return new SVGOMPolygonElement(prefix, (AbstractDocument)doc); 1348 } 1349 } 1350 1351 1354 protected static class PolylineElementFactory implements ElementFactory { 1355 public PolylineElementFactory() {} 1356 1359 public Element create(String prefix, Document doc) { 1360 return new SVGOMPolylineElement(prefix, (AbstractDocument)doc); 1361 } 1362 } 1363 1364 1367 protected static class RadialGradientElementFactory 1368 implements ElementFactory { 1369 public RadialGradientElementFactory() {} 1370 1373 public Element create(String prefix, Document doc) { 1374 return new SVGOMRadialGradientElement(prefix, 1375 (AbstractDocument)doc); 1376 } 1377 } 1378 1379 1382 protected static class RectElementFactory implements ElementFactory { 1383 public RectElementFactory() {} 1384 1387 public Element create(String prefix, Document doc) { 1388 return new SVGOMRectElement(prefix, (AbstractDocument)doc); 1389 } 1390 } 1391 1392 1395 protected static class ScriptElementFactory implements ElementFactory { 1396 public ScriptElementFactory() {} 1397 1400 public Element create(String prefix, Document doc) { 1401 return new SVGOMScriptElement(prefix, (AbstractDocument)doc); 1402 } 1403 } 1404 1405 1408 protected static class SetElementFactory implements ElementFactory { 1409 public SetElementFactory() {} 1410 1413 public Element create(String prefix, Document doc) { 1414 return new SVGOMSetElement(prefix, (AbstractDocument)doc); 1415 } 1416 } 1417 1418 1421 protected static class StopElementFactory implements ElementFactory { 1422 public StopElementFactory() {} 1423 1426 public Element create(String prefix, Document doc) { 1427 return new SVGOMStopElement(prefix, (AbstractDocument)doc); 1428 } 1429 } 1430 1431 1434 protected static class StyleElementFactory implements ElementFactory { 1435 public StyleElementFactory() {} 1436 1439 public Element create(String prefix, Document doc) { 1440 return new SVGOMStyleElement(prefix, (AbstractDocument)doc); 1441 } 1442 } 1443 1444 1447 protected static class SvgElementFactory implements ElementFactory { 1448 public SvgElementFactory() {} 1449 1452 public Element create(String prefix, Document doc) { 1453 return new SVGOMSVGElement(prefix, (AbstractDocument)doc); 1454 } 1455 } 1456 1457 1460 protected static class SwitchElementFactory implements ElementFactory { 1461 public SwitchElementFactory() {} 1462 1465 public Element create(String prefix, Document doc) { 1466 return new SVGOMSwitchElement(prefix, (AbstractDocument)doc); 1467 } 1468 } 1469 1470 1473 protected static class SymbolElementFactory implements ElementFactory { 1474 public SymbolElementFactory() {} 1475 1478 public Element create(String prefix, Document doc) { 1479 return new SVGOMSymbolElement(prefix, (AbstractDocument)doc); 1480 } 1481 } 1482 1483 1486 protected static class TextElementFactory implements ElementFactory { 1487 public TextElementFactory() {} 1488 1491 public Element create(String prefix, Document doc) { 1492 return new SVGOMTextElement(prefix, (AbstractDocument)doc); 1493 } 1494 } 1495 1496 1499 protected static class TextPathElementFactory implements ElementFactory { 1500 public TextPathElementFactory() {} 1501 1504 public Element create(String prefix, Document doc) { 1505 return new SVGOMTextPathElement(prefix, (AbstractDocument)doc); 1506 } 1507 } 1508 1509 1512 protected static class TitleElementFactory implements ElementFactory { 1513 public TitleElementFactory() {} 1514 1517 public Element create(String prefix, Document doc) { 1518 return new SVGOMTitleElement(prefix, (AbstractDocument)doc); 1519 } 1520 } 1521 1522 1525 protected static class TrefElementFactory implements ElementFactory { 1526 public TrefElementFactory() {} 1527 1530 public Element create(String prefix, Document doc) { 1531 return new SVGOMTRefElement(prefix, (AbstractDocument)doc); 1532 } 1533 } 1534 1535 1538 protected static class TspanElementFactory implements ElementFactory { 1539 public TspanElementFactory() {} 1540 1543 public Element create(String prefix, Document doc) { 1544 return new SVGOMTSpanElement(prefix, (AbstractDocument)doc); 1545 } 1546 } 1547 1548 1551 protected static class UseElementFactory implements ElementFactory { 1552 public UseElementFactory() {} 1553 1556 public Element create(String prefix, Document doc) { 1557 return new SVGOMUseElement(prefix, (AbstractDocument)doc); 1558 } 1559 } 1560 1561 1564 protected static class ViewElementFactory implements ElementFactory { 1565 public ViewElementFactory() {} 1566 1569 public Element create(String prefix, Document doc) { 1570 return new SVGOMViewElement(prefix, (AbstractDocument)doc); 1571 } 1572 } 1573 1574 1577 protected static class VkernElementFactory implements ElementFactory { 1578 public VkernElementFactory() {} 1579 1582 public Element create(String prefix, Document doc) { 1583 return new SVGOMVKernElement(prefix, (AbstractDocument)doc); 1584 } 1585 } 1586 1587 1590 protected final static DOMImplementation DOM_IMPLEMENTATION = 1591 new SVGDOMImplementation(); 1592 1593} 1594 | Popular Tags |