1 18 package org.apache.batik.extension.svg; 19 20 import org.apache.batik.css.engine.value.LengthManager; 21 import org.apache.batik.css.engine.value.svg.OpacityManager; 22 import org.apache.batik.css.engine.value.svg.SVGColorManager; 23 import org.apache.batik.dom.AbstractDocument; 24 import org.apache.batik.dom.DomExtension; 25 import org.apache.batik.dom.ExtensibleDOMImplementation; 26 import org.apache.batik.dom.svg.SVGDOMImplementation; 27 import org.w3c.dom.Document ; 28 import org.w3c.dom.Element ; 29 30 34 public class BatikDomExtension 35 implements DomExtension, BatikExtConstants { 36 37 43 public float getPriority() { return 1f; } 44 45 49 public String getAuthor() { 50 return "Thomas DeWeese"; 51 } 52 53 56 public String getContactAddress() { 57 return "deweese@apache.org"; 58 } 59 60 64 public String getURL() { 65 return "http://xml.apache.org/batik"; 66 } 67 68 73 public String getDescription() { 74 return "Example extension to standard SVG shape tags"; 75 } 76 77 86 public void registerTags(ExtensibleDOMImplementation di) { 87 di.registerCustomElementFactory 88 (BATIK_EXT_NAMESPACE_URI, 89 BATIK_EXT_REGULAR_POLYGON_TAG, 90 new BatikRegularPolygonElementFactory()); 91 92 di.registerCustomElementFactory 93 (BATIK_EXT_NAMESPACE_URI, 94 BATIK_EXT_STAR_TAG, 95 new BatikStarElementFactory()); 96 97 di.registerCustomElementFactory 98 (BATIK_EXT_NAMESPACE_URI, 99 BATIK_EXT_HISTOGRAM_NORMALIZATION_TAG, 100 new BatikHistogramNormalizationElementFactory()); 101 102 di.registerCustomElementFactory 103 (BATIK_EXT_NAMESPACE_URI, 104 BATIK_EXT_COLOR_SWITCH_TAG, 105 new ColorSwitchElementFactory()); 106 107 di.registerCustomElementFactory 108 (BATIK_12_NAMESPACE_URI, 109 BATIK_EXT_FLOW_TEXT_TAG, 110 new FlowTextElementFactory()); 111 112 di.registerCustomElementFactory 113 (BATIK_12_NAMESPACE_URI, 114 BATIK_EXT_FLOW_DIV_TAG, 115 new FlowDivElementFactory()); 116 117 di.registerCustomElementFactory 118 (BATIK_12_NAMESPACE_URI, 119 BATIK_EXT_FLOW_PARA_TAG, 120 new FlowParaElementFactory()); 121 122 di.registerCustomElementFactory 123 (BATIK_12_NAMESPACE_URI, 124 BATIK_EXT_FLOW_REGION_BREAK_TAG, 125 new FlowRegionBreakElementFactory()); 126 127 di.registerCustomElementFactory 128 (BATIK_12_NAMESPACE_URI, 129 BATIK_EXT_FLOW_REGION_TAG, 130 new FlowRegionElementFactory()); 131 132 di.registerCustomElementFactory 133 (BATIK_12_NAMESPACE_URI, 134 BATIK_EXT_FLOW_LINE_TAG, 135 new FlowLineElementFactory()); 136 137 di.registerCustomElementFactory 138 (BATIK_12_NAMESPACE_URI, 139 BATIK_EXT_FLOW_SPAN_TAG, 140 new FlowSpanElementFactory()); 141 } 142 143 146 protected static class BatikRegularPolygonElementFactory 147 implements ExtensibleDOMImplementation.ElementFactory { 148 public BatikRegularPolygonElementFactory() {} 149 152 public Element create(String prefix, Document doc) { 153 return new BatikRegularPolygonElement 154 (prefix, (AbstractDocument)doc); 155 } 156 } 157 158 159 162 protected static class BatikStarElementFactory 163 implements ExtensibleDOMImplementation.ElementFactory { 164 public BatikStarElementFactory() {} 165 168 public Element create(String prefix, Document doc) { 169 return new BatikStarElement(prefix, (AbstractDocument)doc); 170 } 171 } 172 173 176 protected static class BatikHistogramNormalizationElementFactory 177 implements ExtensibleDOMImplementation.ElementFactory { 178 public BatikHistogramNormalizationElementFactory() {} 179 182 public Element create(String prefix, Document doc) { 183 return new BatikHistogramNormalizationElement 184 (prefix, (AbstractDocument)doc); 185 } 186 } 187 188 191 protected static class ColorSwitchElementFactory 192 implements ExtensibleDOMImplementation.ElementFactory { 193 public ColorSwitchElementFactory() { 194 } 195 198 public Element create(String prefix, Document doc) { 199 return new ColorSwitchElement(prefix, (AbstractDocument)doc); 200 } 201 } 202 203 206 protected static class FlowTextElementFactory 207 implements SVGDOMImplementation.ElementFactory { 208 public FlowTextElementFactory() { 209 } 210 213 public Element create(String prefix, Document doc) { 214 return new FlowTextElement(prefix, (AbstractDocument)doc); 215 } 216 } 217 218 221 protected static class FlowDivElementFactory 222 implements SVGDOMImplementation.ElementFactory { 223 public FlowDivElementFactory() { 224 } 225 228 public Element create(String prefix, Document doc) { 229 return new FlowDivElement(prefix, (AbstractDocument)doc); 230 } 231 } 232 233 236 protected static class FlowParaElementFactory 237 implements SVGDOMImplementation.ElementFactory { 238 public FlowParaElementFactory() { 239 } 240 243 public Element create(String prefix, Document doc) { 244 return new FlowParaElement(prefix, (AbstractDocument)doc); 245 } 246 } 247 248 251 protected static class FlowRegionBreakElementFactory 252 implements SVGDOMImplementation.ElementFactory { 253 public FlowRegionBreakElementFactory() { 254 } 255 258 public Element create(String prefix, Document doc) { 259 return new FlowRegionBreakElement(prefix, (AbstractDocument)doc); 260 } 261 } 262 263 266 protected static class FlowRegionElementFactory 267 implements SVGDOMImplementation.ElementFactory { 268 public FlowRegionElementFactory() { 269 } 270 273 public Element create(String prefix, Document doc) { 274 return new FlowRegionElement(prefix, (AbstractDocument)doc); 275 } 276 } 277 278 281 protected static class FlowLineElementFactory 282 implements SVGDOMImplementation.ElementFactory { 283 public FlowLineElementFactory() { 284 } 285 288 public Element create(String prefix, Document doc) { 289 return new FlowLineElement(prefix, (AbstractDocument)doc); 290 } 291 } 292 293 296 protected static class FlowSpanElementFactory 297 implements SVGDOMImplementation.ElementFactory { 298 public FlowSpanElementFactory() { 299 } 300 303 public Element create(String prefix, Document doc) { 304 return new FlowSpanElement(prefix, (AbstractDocument)doc); 305 } 306 } 307 } 308 309 310 | Popular Tags |