001/********************************************** 002 * Copyright (C) 2010-2011 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.ActivateEvent; 033import org.vectomatic.dom.svg.events.ActivateHandler; 034import org.vectomatic.dom.svg.events.FocusInEvent; 035import org.vectomatic.dom.svg.events.FocusInHandler; 036import org.vectomatic.dom.svg.events.FocusOutEvent; 037import org.vectomatic.dom.svg.events.FocusOutHandler; 038import org.vectomatic.dom.svg.events.HasGraphicalHandlers; 039import org.vectomatic.dom.svg.impl.SVGElement; 040import org.vectomatic.dom.svg.impl.SVGPathElement; 041import org.vectomatic.dom.svg.itf.ISVGAnimatedPathData; 042import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired; 043import org.vectomatic.dom.svg.itf.ISVGGraphicsElement; 044import org.vectomatic.dom.svg.itf.ISVGLangSpace; 045import org.vectomatic.dom.svg.itf.ISVGStylable; 046import org.vectomatic.dom.svg.itf.ISVGTests; 047import org.vectomatic.dom.svg.itf.ISVGTransformable; 048import org.vectomatic.dom.svg.utils.DOMHelper; 049import org.vectomatic.dom.svg.utils.SVGConstants; 050 051import com.google.gwt.core.client.JavaScriptException; 052import com.google.gwt.dom.client.TagName; 053import com.google.gwt.event.dom.client.ClickEvent; 054import com.google.gwt.event.dom.client.ClickHandler; 055import com.google.gwt.event.dom.client.DragEndEvent; 056import com.google.gwt.event.dom.client.DragEndHandler; 057import com.google.gwt.event.dom.client.DragEnterEvent; 058import com.google.gwt.event.dom.client.DragEnterHandler; 059import com.google.gwt.event.dom.client.DragEvent; 060import com.google.gwt.event.dom.client.DragHandler; 061import com.google.gwt.event.dom.client.DragLeaveEvent; 062import com.google.gwt.event.dom.client.DragLeaveHandler; 063import com.google.gwt.event.dom.client.DragOverEvent; 064import com.google.gwt.event.dom.client.DragOverHandler; 065import com.google.gwt.event.dom.client.DragStartEvent; 066import com.google.gwt.event.dom.client.DragStartHandler; 067import com.google.gwt.event.dom.client.DropEvent; 068import com.google.gwt.event.dom.client.DropHandler; 069import com.google.gwt.event.dom.client.LoadEvent; 070import com.google.gwt.event.dom.client.LoadHandler; 071import com.google.gwt.event.dom.client.MouseDownEvent; 072import com.google.gwt.event.dom.client.MouseDownHandler; 073import com.google.gwt.event.dom.client.MouseMoveEvent; 074import com.google.gwt.event.dom.client.MouseMoveHandler; 075import com.google.gwt.event.dom.client.MouseOutEvent; 076import com.google.gwt.event.dom.client.MouseOutHandler; 077import com.google.gwt.event.dom.client.MouseOverEvent; 078import com.google.gwt.event.dom.client.MouseOverHandler; 079import com.google.gwt.event.dom.client.MouseUpEvent; 080import com.google.gwt.event.dom.client.MouseUpHandler; 081import com.google.gwt.event.dom.client.TouchCancelEvent; 082import com.google.gwt.event.dom.client.TouchCancelHandler; 083import com.google.gwt.event.dom.client.TouchEndEvent; 084import com.google.gwt.event.dom.client.TouchEndHandler; 085import com.google.gwt.event.dom.client.TouchMoveEvent; 086import com.google.gwt.event.dom.client.TouchMoveHandler; 087import com.google.gwt.event.dom.client.TouchStartEvent; 088import com.google.gwt.event.dom.client.TouchStartHandler; 089import com.google.gwt.event.shared.HandlerRegistration; 090 091/** 092 * The {@link org.vectomatic.dom.svg.OMSVGPathElement} interface corresponds 093 * to the <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement' title='path 094 * element specification'>path</a> element. 095 */ 096@TagName("path") 097public class OMSVGPathElement extends OMSVGElement implements HasGraphicalHandlers, ISVGTests, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGTransformable, ISVGAnimatedPathData, ISVGGraphicsElement { 098 public OMSVGPathElement() { 099 this((SVGPathElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_PATH_TAG).cast()); 100 } 101 102 protected OMSVGPathElement(SVGPathElement ot) { 103 super(ot); 104 } 105 106 // Implementation of the svg::SVGPathElement W3C IDL interface 107 /** 108 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGPathElement#getPathLength()} 109 * on the given <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement' 110 * title='path element specification'>path</a> element. 111 */ 112 public final OMSVGAnimatedNumber getPathLength() { 113 return ((SVGPathElement)ot).getPathLength(); 114 } 115 /** 116 * Returns the user agent's computed value for the total length of the path 117 * using the user agent's distance-along-a-path algorithm, as a distance in 118 * the current user coordinate system. 119 * @return The total length of the path. 120 */ 121 public final float getTotalLength() { 122 return ((SVGPathElement)ot).getTotalLength(); 123 } 124 /** 125 * Returns the (x,y) coordinate in user space which is <var>distance</var> 126 * units along the path, utilizing the user agent's distance-along-a-path 127 * algorithm. 128 * @param distance The distance along the path, relative to the start of 129 * the path, as a distance in the current user coordinate system. 130 * @return The returned point in user space. 131 */ 132 public final OMSVGPoint getPointAtLength(float distance) { 133 return ((SVGPathElement)ot).getPointAtLength(distance); 134 } 135 /** 136 * Returns the index into {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()} 137 * which is <var>distance</var> units along the path, utilizing the user agent's 138 * distance-along-a-path algorithm. 139 * @param distance The distance along the path, relative to the start of 140 * the path, as a distance in the current user coordinate system. 141 * @return The index of the path segment, where the first path segment is 142 * number 0. 143 */ 144 public final int getPathSegAtLength(float distance) { 145 return ((SVGPathElement)ot).getPathSegAtLength(distance); 146 } 147 /** 148 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegClosePath} 149 * object. 150 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegClosePath} 151 * object. 152 */ 153 public final OMSVGPathSegClosePath createSVGPathSegClosePath() { 154 return ((SVGPathElement)ot).createSVGPathSegClosePath(); 155 } 156 /** 157 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs} 158 * object. 159 * @param x The absolute X coordinate for the end point of this path segment. 160 * @param y The absolute Y coordinate for the end point of this path segment. 161 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs} 162 * object. 163 */ 164 public final OMSVGPathSegMovetoAbs createSVGPathSegMovetoAbs(float x, float y) { 165 return ((SVGPathElement)ot).createSVGPathSegMovetoAbs(x, y); 166 } 167 /** 168 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoRel} 169 * object. 170 * @param x The relative X coordinate for the end point of this path segment. 171 * @param y The relative Y coordinate for the end point of this path segment. 172 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoRel} 173 * object. 174 */ 175 public final OMSVGPathSegMovetoRel createSVGPathSegMovetoRel(float x, float y) { 176 return ((SVGPathElement)ot).createSVGPathSegMovetoRel(x, y); 177 } 178 /** 179 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs} 180 * object. 181 * @param x The absolute X coordinate for the end point of this path segment. 182 * @param y The absolute Y coordinate for the end point of this path segment. 183 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs} 184 * object. 185 */ 186 public final OMSVGPathSegLinetoAbs createSVGPathSegLinetoAbs(float x, float y) { 187 return ((SVGPathElement)ot).createSVGPathSegLinetoAbs(x, y); 188 } 189 /** 190 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoRel} 191 * object. 192 * @param x The relative X coordinate for the end point of this path segment. 193 * @param y The relative Y coordinate for the end point of this path segment. 194 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoRel} 195 * object. 196 */ 197 public final OMSVGPathSegLinetoRel createSVGPathSegLinetoRel(float x, float y) { 198 return ((SVGPathElement)ot).createSVGPathSegLinetoRel(x, y); 199 } 200 /** 201 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs} 202 * object. 203 * @param x The absolute X coordinate for the end point of this path segment. 204 * @param y The absolute Y coordinate for the end point of this path segment. 205 * @param x1 The absolute X coordinate for the first control point. 206 * @param y1 The absolute Y coordinate for the first control point. 207 * @param x2 The absolute X coordinate for the second control point. 208 * @param y2 The absolute Y coordinate for the second control point. 209 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs} 210 * object. 211 */ 212 public final OMSVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2) { 213 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2); 214 } 215 /** 216 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel} 217 * object. 218 * @param x The relative X coordinate for the end point of this path segment. 219 * @param y The relative Y coordinate for the end point of this path segment. 220 * @param x1 The relative X coordinate for the first control point. 221 * @param y1 The relative Y coordinate for the first control point. 222 * @param x2 The relative X coordinate for the second control point. 223 * @param y2 The relative Y coordinate for the second control point. 224 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel} 225 * object. 226 */ 227 public final OMSVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2) { 228 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2); 229 } 230 /** 231 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs} 232 * object. 233 * @param x The absolute X coordinate for the end point of this path segment. 234 * @param y The absolute Y coordinate for the end point of this path segment. 235 * @param x1 The absolute X coordinate for the first control point. 236 * @param y1 The absolute Y coordinate for the first control point. 237 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs} 238 * object. 239 */ 240 public final OMSVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1) { 241 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1); 242 } 243 /** 244 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel} 245 * object. 246 * @param x The relative X coordinate for the end point of this path segment. 247 * @param y The relative Y coordinate for the end point of this path segment. 248 * @param x1 The relative X coordinate for the first control point. 249 * @param y1 The relative Y coordinate for the first control point. 250 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel} 251 * object. 252 */ 253 public final OMSVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1) { 254 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticRel(x, y, x1, y1); 255 } 256 /** 257 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcAbs} 258 * object. 259 * @param x The absolute X coordinate for the end point of this path segment. 260 * @param y The absolute Y coordinate for the end point of this path segment. 261 * @param r1 The x-axis radius for the ellipse (i.e., r1). 262 * @param r2 The y-axis radius for the ellipse (i.e., r2). 263 * @param angle The rotation angle in degrees for the ellipse's x-axis relative 264 * to the x-axis of the user coordinate system. 265 * @param largeArcFlag The value of the large-arc-flag parameter. 266 * @param sweepFlag The value of the large-arc-flag parameter. 267 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcAbs} 268 * object. 269 */ 270 public final OMSVGPathSegArcAbs createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag) { 271 return ((SVGPathElement)ot).createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag); 272 } 273 /** 274 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcRel} 275 * object. 276 * @param x The relative X coordinate for the end point of this path segment. 277 * @param y The relative Y coordinate for the end point of this path segment. 278 * @param r1 The x-axis radius for the ellipse (i.e., r1). 279 * @param r2 The y-axis radius for the ellipse (i.e., r2). 280 * @param angle The rotation angle in degrees for the ellipse's x-axis relative 281 * to the x-axis of the user coordinate system. 282 * @param largeArcFlag The value of the large-arc-flag parameter. 283 * @param sweepFlag The value of the large-arc-flag parameter. 284 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcRel} 285 * object. 286 */ 287 public final OMSVGPathSegArcRel createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag) { 288 return ((SVGPathElement)ot).createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag); 289 } 290 /** 291 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs} 292 * object. 293 * @param x The absolute X coordinate for the end point of this path segment. 294 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs} 295 * object. 296 */ 297 public final OMSVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(float x) { 298 return ((SVGPathElement)ot).createSVGPathSegLinetoHorizontalAbs(x); 299 } 300 /** 301 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel} 302 * object. 303 * @param x The relative X coordinate for the end point of this path segment. 304 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel} 305 * object. 306 */ 307 public final OMSVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(float x) { 308 return ((SVGPathElement)ot).createSVGPathSegLinetoHorizontalRel(x); 309 } 310 /** 311 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs} 312 * object. 313 * @param y The absolute Y coordinate for the end point of this path segment. 314 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs} 315 * object. 316 */ 317 public final OMSVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(float y) { 318 return ((SVGPathElement)ot).createSVGPathSegLinetoVerticalAbs(y); 319 } 320 /** 321 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel} 322 * object. 323 * @param y The relative Y coordinate for the end point of this path segment. 324 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel} 325 * object. 326 */ 327 public final OMSVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(float y) { 328 return ((SVGPathElement)ot).createSVGPathSegLinetoVerticalRel(y); 329 } 330 /** 331 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs} 332 * object. 333 * @param x The absolute X coordinate for the end point of this path segment. 334 * @param y The absolute Y coordinate for the end point of this path segment. 335 * @param x2 The absolute X coordinate for the second control point. 336 * @param y2 The absolute Y coordinate for the second control point. 337 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs} 338 * object. 339 */ 340 public final OMSVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2) { 341 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2); 342 } 343 /** 344 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel} 345 * object. 346 * @param x The relative X coordinate for the end point of this path segment. 347 * @param y The relative Y coordinate for the end point of this path segment. 348 * @param x2 The relative X coordinate for the second control point. 349 * @param y2 The relative Y coordinate for the second control point. 350 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel} 351 * object. 352 */ 353 public final OMSVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2) { 354 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2); 355 } 356 /** 357 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs} 358 * object. 359 * @param x The absolute X coordinate for the end point of this path segment. 360 * @param y The absolute Y coordinate for the end point of this path segment. 361 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs} 362 * object. 363 */ 364 public final OMSVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y) { 365 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticSmoothAbs(x, y); 366 } 367 /** 368 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel} 369 * object. 370 * @param x The relative X coordinate for the end point of this path segment. 371 * @param y The relative Y coordinate for the end point of this path segment. 372 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel} 373 * object. 374 */ 375 public final OMSVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y) { 376 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticSmoothRel(x, y); 377 } 378 379 // Implementation of the svg::SVGAnimatedPathData W3C IDL interface 380 /** 381 * Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span> 382 * attribute in a form which matches one-for-one with SVG's syntax. Thus, 383 * if the <span class='attr-name'>'d'</span> attribute has an "absolute moveto 384 * (M)" and an "absolute arcto (A)" command, then {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()} 385 * will have two entries: a SVG_PATHSEG_MOVETO_ABS and a SVG_PATHSEG_ARC_ABS. 386 */ 387 public final OMSVGPathSegList getPathSegList() { 388 return ((SVGPathElement)ot).getPathSegList(); 389 } 390 /** 391 * <p>Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span> 392 * attribute in a form where all path data commands are expressed in terms 393 * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg} 394 * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS 395 * (C) and SVG_PATHSEG_CLOSEPATH (z). Thus, if the <span class='attr-name'>'d'</span> 396 * attribute has an "absolute moveto (M)" and an "absolute arcto (A)" command, 397 * then pathSegList will have one SVG_PATHSEG_MOVETO_ABS entry followed by 398 * a series of SVG_PATHSEG_LINETO_ABS entries which approximate the arc. This 399 * alternate representation is available to provide a simpler interface to 400 * developers who would benefit from a more limited set of commands.</p> <p>The 401 * only valid {@link org.vectomatic.dom.svg.OMSVGPathSeg} types are SVG_PATHSEG_MOVETO_ABS 402 * (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS (C) and 403 * SVG_PATHSEG_CLOSEPATH (z).</p> 404 */ 405 public final OMSVGPathSegList getNormalizedPathSegList() { 406 return ((SVGPathElement)ot).getNormalizedPathSegList(); 407 } 408 /** 409 * Provides access to the current animated contents of the <span class='attr-name'>'d'</span> 410 * attribute in a form which matches one-for-one with SVG's syntax. If the 411 * given attribute or property is being animated, contains the current animated 412 * value of the attribute or property, and both the object itself and its 413 * contents are read only. If the given attribute or property is not currently 414 * being animated, contains the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}. 415 */ 416 public final OMSVGPathSegList getAnimatedPathSegList() { 417 return ((SVGPathElement)ot).getAnimatedPathSegList(); 418 } 419 /** 420 * Provides access to the current animated contents of the <span class='attr-name'>'d'</span> 421 * attribute in a form where all path data commands are expressed in terms 422 * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg} 423 * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS 424 * (C) and SVG_PATHSEG_CLOSEPATH (z). If the given attribute or property is 425 * being animated, contains the current animated value of the attribute or 426 * property, and both the object itself and its contents are read only. If 427 * the given attribute or property is not currently being animated, contains 428 * the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}. 429 */ 430 public final OMSVGPathSegList getAnimatedNormalizedPathSegList() { 431 return ((SVGPathElement)ot).getAnimatedNormalizedPathSegList(); 432 } 433 434 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface 435 /** 436 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 437 * on the given element. Note that the SVG DOM defines the attribute {@link 438 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 439 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas 440 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 441 * is not animated. Because the SVG language definition states that {@link 442 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 443 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()} 444 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}. 445 */ 446 public final OMSVGAnimatedBoolean getExternalResourcesRequired() { 447 return ((SVGPathElement)ot).getExternalResourcesRequired(); 448 } 449 450 // Implementation of the svg::SVGLangSpace W3C IDL interface 451 /** 452 * Corresponds to attribute <code>xml:lang</code> on the given element. 453 */ 454 public final String getXmllang() { 455 return ((SVGPathElement)ot).getXmllang(); 456 } 457 /** 458 * Corresponds to attribute <code>xml:lang</code> on the given element. 459 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 460 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 461 * attribute</a>. 462 */ 463 public final void setXmllang(java.lang.String value) throws JavaScriptException { 464 ((SVGPathElement)ot).setXmllang(value); 465 } 466 /** 467 * Corresponds to attribute <code>xml:space</code> on the given element. 468 */ 469 public final String getXmlspace() { 470 return ((SVGPathElement)ot).getXmlspace(); 471 } 472 /** 473 * Corresponds to attribute <code>xml:space</code> on the given element. 474 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 475 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 476 * attribute</a>. 477 */ 478 public final void setXmlspace(java.lang.String value) throws JavaScriptException { 479 ((SVGPathElement)ot).setXmlspace(value); 480 } 481 482 // Implementation of the svg::SVGLocatable W3C IDL interface 483 /** 484 * The element which established the current viewport. Often, the nearest 485 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 486 * element specification'>svg</a> element. Null if the current element is 487 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 488 * title='svg element specification'>svg</a> element. 489 */ 490 public final OMSVGElement getNearestViewportElement() { 491 SVGElement elt = ((SVGPathElement)ot).getNearestViewportElement(); 492 return elt != null ? (OMSVGElement)convert(elt) : null; 493 } 494 /** 495 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 496 * title='svg element specification'>svg</a> element. Null if the current 497 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 498 * title='svg element specification'>svg</a> element. 499 */ 500 public final OMSVGElement getFarthestViewportElement() { 501 SVGElement elt = ((SVGPathElement)ot).getFarthestViewportElement(); 502 return elt != null ? (OMSVGElement)convert(elt) : null; 503 } 504 /** 505 * Returns the tight bounding box in current user space (i.e., after application 506 * of the <code>transform</code> attribute, if any) on the geometry of all 507 * contained graphics elements, exclusive of stroking, clipping, masking and 508 * filter effects). Note that getBBox must return the actual bounding box 509 * at the time the method was called, even in case the element has not yet 510 * been rendered. 511 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines 512 * the bounding box. 513 */ 514 public final OMSVGRect getBBox() { 515 return ((SVGPathElement)ot).getBBox(); 516 } 517 /** 518 * Returns the transformation matrix from current user units (i.e., after 519 * application of the <code>transform</code> attribute, if any) to the viewport 520 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}. 521 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 522 * the CTM. 523 */ 524 public final OMSVGMatrix getCTM() { 525 return ((SVGPathElement)ot).getCTM(); 526 } 527 /** 528 * Returns the transformation matrix from current user units (i.e., after 529 * application of the <code>transform</code> attribute, if any) to the parent 530 * user agent's notice of a "pixel". For display devices, ideally this represents 531 * a physical screen pixel. For other devices or environments where physical 532 * pixel sizes are not known, then an algorithm similar to the CSS2 definition 533 * of a "pixel" can be used instead. Note that null is returned if this element 534 * is not hooked into the document tree. This method would have been more 535 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code> 536 * is kept for historical reasons. 537 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 538 * the given transformation matrix. 539 */ 540 public final OMSVGMatrix getScreenCTM() { 541 return ((SVGPathElement)ot).getScreenCTM(); 542 } 543 /** 544 * Returns the transformation matrix from the user coordinate system on the 545 * current element (after application of the <code>transform</code> attribute, 546 * if any) to the user coordinate system on parameter <var>element</var> (after 547 * application of its <code>transform</code> attribute, if any). 548 * @param element The target element. 549 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 550 * the transformation. 551 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently 552 * defined transformation matrices make it impossible to compute the given 553 * matrix (e.g., because one of the transformations is singular). 554 */ 555 public final OMSVGMatrix getTransformToElement(OMSVGElement element) throws JavaScriptException { 556 return ((SVGPathElement)ot).getTransformToElement(((SVGElement)element.ot)); 557 } 558 559 // Implementation of the svg::SVGTests W3C IDL interface 560 /** 561 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()} 562 * on the given element. 563 */ 564 public final OMSVGStringList getRequiredFeatures() { 565 return ((SVGPathElement)ot).getRequiredFeatures(); 566 } 567 /** 568 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()} 569 * on the given element. 570 */ 571 public final OMSVGStringList getRequiredExtensions() { 572 return ((SVGPathElement)ot).getRequiredExtensions(); 573 } 574 /** 575 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()} 576 * on the given element. 577 */ 578 public final OMSVGStringList getSystemLanguage() { 579 return ((SVGPathElement)ot).getSystemLanguage(); 580 } 581 /** 582 * Returns true if the user agent supports the given extension, specified 583 * by a URI. 584 * @param extension The name of the extension, expressed as a URI. 585 * @return True or false, depending on whether the given extension is supported. 586 */ 587 public final boolean hasExtension(String extension) { 588 return ((SVGPathElement)ot).hasExtension(extension); 589 } 590 591 // Implementation of the svg::SVGTransformable W3C IDL interface 592 /** 593 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()} 594 * on the given element. 595 */ 596 public final OMSVGAnimatedTransformList getTransform() { 597 return ((SVGPathElement)ot).getTransform(); 598 } 599 600 @Override 601 public final HandlerRegistration addClickHandler(ClickHandler handler) { 602 return addDomHandler(handler, ClickEvent.getType()); 603 } 604 @Override 605 public final HandlerRegistration addDragEndHandler(DragEndHandler handler) { 606 return addDomHandler(handler, DragEndEvent.getType()); 607 } 608 @Override 609 public final HandlerRegistration addDragEnterHandler(DragEnterHandler handler) { 610 return addDomHandler(handler, DragEnterEvent.getType()); 611 } 612 @Override 613 public final HandlerRegistration addDragHandler(DragHandler handler) { 614 return addDomHandler(handler, DragEvent.getType()); 615 } 616 @Override 617 public final HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) { 618 return addDomHandler(handler, DragLeaveEvent.getType()); 619 } 620 @Override 621 public final HandlerRegistration addDragOverHandler(DragOverHandler handler) { 622 return addDomHandler(handler, DragOverEvent.getType()); 623 } 624 @Override 625 public final HandlerRegistration addDragStartHandler(DragStartHandler handler) { 626 return addDomHandler(handler, DragStartEvent.getType()); 627 } 628 @Override 629 public final HandlerRegistration addDropHandler(DropHandler handler) { 630 return addDomHandler(handler, DropEvent.getType()); 631 } 632 @Override 633 public final HandlerRegistration addLoadHandler(LoadHandler handler) { 634 return addDomHandler(handler, LoadEvent.getType()); 635 } 636 @Override 637 public final HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { 638 return addDomHandler(handler, MouseDownEvent.getType()); 639 } 640 @Override 641 public final HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { 642 return addDomHandler(handler, MouseMoveEvent.getType()); 643 } 644 @Override 645 public final HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { 646 return addDomHandler(handler, MouseOutEvent.getType()); 647 } 648 @Override 649 public final HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { 650 return addDomHandler(handler, MouseOverEvent.getType()); 651 } 652 @Override 653 public final HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { 654 return addDomHandler(handler, MouseUpEvent.getType()); 655 } 656 @Override 657 public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) { 658 return addDomHandler(handler, TouchCancelEvent.getType()); 659 } 660 @Override 661 public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) { 662 return addDomHandler(handler, TouchEndEvent.getType()); 663 } 664 @Override 665 public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { 666 return addDomHandler(handler, TouchMoveEvent.getType()); 667 } 668 @Override 669 public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler) { 670 return addDomHandler(handler, TouchStartEvent.getType()); 671 } 672 @Override 673 public final HandlerRegistration addActivateHandler(ActivateHandler handler) { 674 return addDomHandler(handler, ActivateEvent.getType()); 675 } 676 @Override 677 public final HandlerRegistration addFocusInHandler(FocusInHandler handler) { 678 return addDomHandler(handler, FocusInEvent.getType()); 679 } 680 @Override 681 public final HandlerRegistration addFocusOutHandler(FocusOutHandler handler) { 682 return addDomHandler(handler, FocusOutEvent.getType()); 683 } 684}