1 /**********************************************
2 * Copyright (C) 2010-2011 Lukas Laag
3 * This file is part of lib-gwt-svg.
4 *
5 * libgwtsvg is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * libgwtsvg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libgwtsvg. If not, see http://www.gnu.org/licenses/
17 **********************************************/
18 /*
19 * Copyright (c) 2004 World Wide Web Consortium,
20 *
21 * (Massachusetts Institute of Technology, European Research Consortium for
22 * Informatics and Mathematics, Keio University). All Rights Reserved. This
23 * work is distributed under the W3C(r) Software License [1] in the hope that
24 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 *
27 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
28 */
29
30 package org.vectomatic.dom.svg;
31
32 import org.vectomatic.dom.svg.events.ActivateEvent;
33 import org.vectomatic.dom.svg.events.ActivateHandler;
34 import org.vectomatic.dom.svg.events.FocusInEvent;
35 import org.vectomatic.dom.svg.events.FocusInHandler;
36 import org.vectomatic.dom.svg.events.FocusOutEvent;
37 import org.vectomatic.dom.svg.events.FocusOutHandler;
38 import org.vectomatic.dom.svg.events.HasGraphicalHandlers;
39 import org.vectomatic.dom.svg.impl.SVGElement;
40 import org.vectomatic.dom.svg.impl.SVGPathElement;
41 import org.vectomatic.dom.svg.itf.ISVGAnimatedPathData;
42 import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
43 import org.vectomatic.dom.svg.itf.ISVGGraphicsElement;
44 import org.vectomatic.dom.svg.itf.ISVGLangSpace;
45 import org.vectomatic.dom.svg.itf.ISVGStylable;
46 import org.vectomatic.dom.svg.itf.ISVGTests;
47 import org.vectomatic.dom.svg.itf.ISVGTransformable;
48 import org.vectomatic.dom.svg.utils.DOMHelper;
49 import org.vectomatic.dom.svg.utils.SVGConstants;
50
51 import com.google.gwt.core.client.JavaScriptException;
52 import com.google.gwt.dom.client.TagName;
53 import com.google.gwt.event.dom.client.ClickEvent;
54 import com.google.gwt.event.dom.client.ClickHandler;
55 import com.google.gwt.event.dom.client.LoadEvent;
56 import com.google.gwt.event.dom.client.LoadHandler;
57 import com.google.gwt.event.dom.client.MouseDownEvent;
58 import com.google.gwt.event.dom.client.MouseDownHandler;
59 import com.google.gwt.event.dom.client.MouseMoveEvent;
60 import com.google.gwt.event.dom.client.MouseMoveHandler;
61 import com.google.gwt.event.dom.client.MouseOutEvent;
62 import com.google.gwt.event.dom.client.MouseOutHandler;
63 import com.google.gwt.event.dom.client.MouseOverEvent;
64 import com.google.gwt.event.dom.client.MouseOverHandler;
65 import com.google.gwt.event.dom.client.MouseUpEvent;
66 import com.google.gwt.event.dom.client.MouseUpHandler;
67 import com.google.gwt.event.dom.client.TouchCancelEvent;
68 import com.google.gwt.event.dom.client.TouchCancelHandler;
69 import com.google.gwt.event.dom.client.TouchEndEvent;
70 import com.google.gwt.event.dom.client.TouchEndHandler;
71 import com.google.gwt.event.dom.client.TouchMoveEvent;
72 import com.google.gwt.event.dom.client.TouchMoveHandler;
73 import com.google.gwt.event.dom.client.TouchStartEvent;
74 import com.google.gwt.event.dom.client.TouchStartHandler;
75 import com.google.gwt.event.shared.HandlerRegistration;
76
77 /**
78 * The {@link org.vectomatic.dom.svg.OMSVGPathElement} interface corresponds
79 * to the <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement' title='path
80 * element specification'>path</a> element.
81 */
82 @TagName("path")
83 public class OMSVGPathElement extends OMSVGElement implements HasGraphicalHandlers, ISVGTests, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGTransformable, ISVGAnimatedPathData, ISVGGraphicsElement {
84 public OMSVGPathElement() {
85 this((SVGPathElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_PATH_TAG).cast());
86 }
87
88 protected OMSVGPathElement(SVGPathElement ot) {
89 super(ot);
90 }
91
92 // Implementation of the svg::SVGPathElement W3C IDL interface
93 /**
94 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGPathElement#getPathLength()}
95 * on the given <a href='http://www.w3.org/TR/SVG11/paths.html#PathElement'
96 * title='path element specification'>path</a> element.
97 */
98 public final OMSVGAnimatedNumber getPathLength() {
99 return ((SVGPathElement)ot).getPathLength();
100 }
101 /**
102 * Returns the user agent's computed value for the total length of the path
103 * using the user agent's distance-along-a-path algorithm, as a distance in
104 * the current user coordinate system.
105 * @return The total length of the path.
106 */
107 public final float getTotalLength() {
108 return ((SVGPathElement)ot).getTotalLength();
109 }
110 /**
111 * Returns the (x,y) coordinate in user space which is <var>distance</var>
112 * units along the path, utilizing the user agent's distance-along-a-path
113 * algorithm.
114 * @param distance The distance along the path, relative to the start of
115 * the path, as a distance in the current user coordinate system.
116 * @return The returned point in user space.
117 */
118 public final OMSVGPoint getPointAtLength(float distance) {
119 return ((SVGPathElement)ot).getPointAtLength(distance);
120 }
121 /**
122 * Returns the index into {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
123 * which is <var>distance</var> units along the path, utilizing the user agent's
124 * distance-along-a-path algorithm.
125 * @param distance The distance along the path, relative to the start of
126 * the path, as a distance in the current user coordinate system.
127 * @return The index of the path segment, where the first path segment is
128 * number 0.
129 */
130 public final int getPathSegAtLength(float distance) {
131 return ((SVGPathElement)ot).getPathSegAtLength(distance);
132 }
133 /**
134 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegClosePath}
135 * object.
136 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegClosePath}
137 * object.
138 */
139 public final OMSVGPathSegClosePath createSVGPathSegClosePath() {
140 return ((SVGPathElement)ot).createSVGPathSegClosePath();
141 }
142 /**
143 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs}
144 * object.
145 * @param x The absolute X coordinate for the end point of this path segment.
146 * @param y The absolute Y coordinate for the end point of this path segment.
147 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoAbs}
148 * object.
149 */
150 public final OMSVGPathSegMovetoAbs createSVGPathSegMovetoAbs(float x, float y) {
151 return ((SVGPathElement)ot).createSVGPathSegMovetoAbs(x, y);
152 }
153 /**
154 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoRel}
155 * object.
156 * @param x The relative X coordinate for the end point of this path segment.
157 * @param y The relative Y coordinate for the end point of this path segment.
158 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegMovetoRel}
159 * object.
160 */
161 public final OMSVGPathSegMovetoRel createSVGPathSegMovetoRel(float x, float y) {
162 return ((SVGPathElement)ot).createSVGPathSegMovetoRel(x, y);
163 }
164 /**
165 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs}
166 * object.
167 * @param x The absolute X coordinate for the end point of this path segment.
168 * @param y The absolute Y coordinate for the end point of this path segment.
169 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoAbs}
170 * object.
171 */
172 public final OMSVGPathSegLinetoAbs createSVGPathSegLinetoAbs(float x, float y) {
173 return ((SVGPathElement)ot).createSVGPathSegLinetoAbs(x, y);
174 }
175 /**
176 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoRel}
177 * object.
178 * @param x The relative X coordinate for the end point of this path segment.
179 * @param y The relative Y coordinate for the end point of this path segment.
180 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoRel}
181 * object.
182 */
183 public final OMSVGPathSegLinetoRel createSVGPathSegLinetoRel(float x, float y) {
184 return ((SVGPathElement)ot).createSVGPathSegLinetoRel(x, y);
185 }
186 /**
187 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs}
188 * object.
189 * @param x The absolute X coordinate for the end point of this path segment.
190 * @param y The absolute Y coordinate for the end point of this path segment.
191 * @param x1 The absolute X coordinate for the first control point.
192 * @param y1 The absolute Y coordinate for the first control point.
193 * @param x2 The absolute X coordinate for the second control point.
194 * @param y2 The absolute Y coordinate for the second control point.
195 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicAbs}
196 * object.
197 */
198 public final OMSVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2) {
199 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2);
200 }
201 /**
202 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel}
203 * object.
204 * @param x The relative X coordinate for the end point of this path segment.
205 * @param y The relative Y coordinate for the end point of this path segment.
206 * @param x1 The relative X coordinate for the first control point.
207 * @param y1 The relative Y coordinate for the first control point.
208 * @param x2 The relative X coordinate for the second control point.
209 * @param y2 The relative Y coordinate for the second control point.
210 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicRel}
211 * object.
212 */
213 public final OMSVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2) {
214 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicRel(x, y, x1, y1, x2, y2);
215 }
216 /**
217 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs}
218 * object.
219 * @param x The absolute X coordinate for the end point of this path segment.
220 * @param y The absolute Y coordinate for the end point of this path segment.
221 * @param x1 The absolute X coordinate for the first control point.
222 * @param y1 The absolute Y coordinate for the first control point.
223 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticAbs}
224 * object.
225 */
226 public final OMSVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1) {
227 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1);
228 }
229 /**
230 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel}
231 * object.
232 * @param x The relative X coordinate for the end point of this path segment.
233 * @param y The relative Y coordinate for the end point of this path segment.
234 * @param x1 The relative X coordinate for the first control point.
235 * @param y1 The relative Y coordinate for the first control point.
236 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticRel}
237 * object.
238 */
239 public final OMSVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1) {
240 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticRel(x, y, x1, y1);
241 }
242 /**
243 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcAbs}
244 * object.
245 * @param x The absolute X coordinate for the end point of this path segment.
246 * @param y The absolute Y coordinate for the end point of this path segment.
247 * @param r1 The x-axis radius for the ellipse (i.e., r1).
248 * @param r2 The y-axis radius for the ellipse (i.e., r2).
249 * @param angle The rotation angle in degrees for the ellipse's x-axis relative
250 * to the x-axis of the user coordinate system.
251 * @param largeArcFlag The value of the large-arc-flag parameter.
252 * @param sweepFlag The value of the large-arc-flag parameter.
253 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcAbs}
254 * object.
255 */
256 public final OMSVGPathSegArcAbs createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag) {
257 return ((SVGPathElement)ot).createSVGPathSegArcAbs(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
258 }
259 /**
260 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcRel}
261 * object.
262 * @param x The relative X coordinate for the end point of this path segment.
263 * @param y The relative Y coordinate for the end point of this path segment.
264 * @param r1 The x-axis radius for the ellipse (i.e., r1).
265 * @param r2 The y-axis radius for the ellipse (i.e., r2).
266 * @param angle The rotation angle in degrees for the ellipse's x-axis relative
267 * to the x-axis of the user coordinate system.
268 * @param largeArcFlag The value of the large-arc-flag parameter.
269 * @param sweepFlag The value of the large-arc-flag parameter.
270 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegArcRel}
271 * object.
272 */
273 public final OMSVGPathSegArcRel createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag) {
274 return ((SVGPathElement)ot).createSVGPathSegArcRel(x, y, r1, r2, angle, largeArcFlag, sweepFlag);
275 }
276 /**
277 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs}
278 * object.
279 * @param x The absolute X coordinate for the end point of this path segment.
280 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalAbs}
281 * object.
282 */
283 public final OMSVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(float x) {
284 return ((SVGPathElement)ot).createSVGPathSegLinetoHorizontalAbs(x);
285 }
286 /**
287 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel}
288 * object.
289 * @param x The relative X coordinate for the end point of this path segment.
290 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoHorizontalRel}
291 * object.
292 */
293 public final OMSVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(float x) {
294 return ((SVGPathElement)ot).createSVGPathSegLinetoHorizontalRel(x);
295 }
296 /**
297 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs}
298 * object.
299 * @param y The absolute Y coordinate for the end point of this path segment.
300 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalAbs}
301 * object.
302 */
303 public final OMSVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(float y) {
304 return ((SVGPathElement)ot).createSVGPathSegLinetoVerticalAbs(y);
305 }
306 /**
307 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel}
308 * object.
309 * @param y The relative Y coordinate for the end point of this path segment.
310 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegLinetoVerticalRel}
311 * object.
312 */
313 public final OMSVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(float y) {
314 return ((SVGPathElement)ot).createSVGPathSegLinetoVerticalRel(y);
315 }
316 /**
317 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs}
318 * object.
319 * @param x The absolute X coordinate for the end point of this path segment.
320 * @param y The absolute Y coordinate for the end point of this path segment.
321 * @param x2 The absolute X coordinate for the second control point.
322 * @param y2 The absolute Y coordinate for the second control point.
323 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothAbs}
324 * object.
325 */
326 public final OMSVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2) {
327 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2);
328 }
329 /**
330 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel}
331 * object.
332 * @param x The relative X coordinate for the end point of this path segment.
333 * @param y The relative Y coordinate for the end point of this path segment.
334 * @param x2 The relative X coordinate for the second control point.
335 * @param y2 The relative Y coordinate for the second control point.
336 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoCubicSmoothRel}
337 * object.
338 */
339 public final OMSVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2) {
340 return ((SVGPathElement)ot).createSVGPathSegCurvetoCubicSmoothRel(x, y, x2, y2);
341 }
342 /**
343 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs}
344 * object.
345 * @param x The absolute X coordinate for the end point of this path segment.
346 * @param y The absolute Y coordinate for the end point of this path segment.
347 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothAbs}
348 * object.
349 */
350 public final OMSVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y) {
351 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticSmoothAbs(x, y);
352 }
353 /**
354 * Returns a stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel}
355 * object.
356 * @param x The relative X coordinate for the end point of this path segment.
357 * @param y The relative Y coordinate for the end point of this path segment.
358 * @return A stand-alone, parentless {@link org.vectomatic.dom.svg.OMSVGPathSegCurvetoQuadraticSmoothRel}
359 * object.
360 */
361 public final OMSVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y) {
362 return ((SVGPathElement)ot).createSVGPathSegCurvetoQuadraticSmoothRel(x, y);
363 }
364
365 // Implementation of the svg::SVGAnimatedPathData W3C IDL interface
366 /**
367 * Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span>
368 * attribute in a form which matches one-for-one with SVG's syntax. Thus,
369 * if the <span class='attr-name'>'d'</span> attribute has an "absolute moveto
370 * (M)" and an "absolute arcto (A)" command, then {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}
371 * will have two entries: a SVG_PATHSEG_MOVETO_ABS and a SVG_PATHSEG_ARC_ABS.
372 */
373 public final OMSVGPathSegList getPathSegList() {
374 return ((SVGPathElement)ot).getPathSegList();
375 }
376 /**
377 * <p>Provides access to the base (i.e., static) contents of the <span class='attr-name'>'d'</span>
378 * attribute in a form where all path data commands are expressed in terms
379 * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
380 * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS
381 * (C) and SVG_PATHSEG_CLOSEPATH (z). Thus, if the <span class='attr-name'>'d'</span>
382 * attribute has an "absolute moveto (M)" and an "absolute arcto (A)" command,
383 * then pathSegList will have one SVG_PATHSEG_MOVETO_ABS entry followed by
384 * a series of SVG_PATHSEG_LINETO_ABS entries which approximate the arc. This
385 * alternate representation is available to provide a simpler interface to
386 * developers who would benefit from a more limited set of commands.</p> <p>The
387 * only valid {@link org.vectomatic.dom.svg.OMSVGPathSeg} types are SVG_PATHSEG_MOVETO_ABS
388 * (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS (C) and
389 * SVG_PATHSEG_CLOSEPATH (z).</p>
390 */
391 public final OMSVGPathSegList getNormalizedPathSegList() {
392 return ((SVGPathElement)ot).getNormalizedPathSegList();
393 }
394 /**
395 * Provides access to the current animated contents of the <span class='attr-name'>'d'</span>
396 * attribute in a form which matches one-for-one with SVG's syntax. If the
397 * given attribute or property is being animated, contains the current animated
398 * value of the attribute or property, and both the object itself and its
399 * contents are read only. If the given attribute or property is not currently
400 * being animated, contains the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getPathSegList()}.
401 */
402 public final OMSVGPathSegList getAnimatedPathSegList() {
403 return ((SVGPathElement)ot).getAnimatedPathSegList();
404 }
405 /**
406 * Provides access to the current animated contents of the <span class='attr-name'>'d'</span>
407 * attribute in a form where all path data commands are expressed in terms
408 * of the following subset of {@link org.vectomatic.dom.svg.OMSVGPathSeg}
409 * types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS
410 * (C) and SVG_PATHSEG_CLOSEPATH (z). If the given attribute or property is
411 * being animated, contains the current animated value of the attribute or
412 * property, and both the object itself and its contents are read only. If
413 * the given attribute or property is not currently being animated, contains
414 * the same value as {@link org.vectomatic.dom.svg.itf.ISVGAnimatedPathData#getNormalizedPathSegList()}.
415 */
416 public final OMSVGPathSegList getAnimatedNormalizedPathSegList() {
417 return ((SVGPathElement)ot).getAnimatedNormalizedPathSegList();
418 }
419
420 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
421 /**
422 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
423 * on the given element. Note that the SVG DOM defines the attribute {@link
424 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
425 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
426 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
427 * is not animated. Because the SVG language definition states that {@link
428 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
429 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
430 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
431 */
432 public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
433 return ((SVGPathElement)ot).getExternalResourcesRequired();
434 }
435
436 // Implementation of the svg::SVGLangSpace W3C IDL interface
437 /**
438 * Corresponds to attribute <code>xml:lang</code> on the given element.
439 */
440 public final String getXmllang() {
441 return ((SVGPathElement)ot).getXmllang();
442 }
443 /**
444 * Corresponds to attribute <code>xml:lang</code> on the given element.
445 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
446 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
447 * attribute</a>.
448 */
449 public final void setXmllang(java.lang.String value) throws JavaScriptException {
450 ((SVGPathElement)ot).setXmllang(value);
451 }
452 /**
453 * Corresponds to attribute <code>xml:space</code> on the given element.
454 */
455 public final String getXmlspace() {
456 return ((SVGPathElement)ot).getXmlspace();
457 }
458 /**
459 * Corresponds to attribute <code>xml:space</code> on the given element.
460 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
461 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
462 * attribute</a>.
463 */
464 public final void setXmlspace(java.lang.String value) throws JavaScriptException {
465 ((SVGPathElement)ot).setXmlspace(value);
466 }
467
468 // Implementation of the svg::SVGLocatable W3C IDL interface
469 /**
470 * The element which established the current viewport. Often, the nearest
471 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
472 * element specification'>svg</a> element. Null if the current element is
473 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
474 * title='svg element specification'>svg</a> element.
475 */
476 public final OMSVGElement getNearestViewportElement() {
477 return (OMSVGElement)convert(((SVGPathElement)ot).getNearestViewportElement());
478 }
479 /**
480 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
481 * title='svg element specification'>svg</a> element. Null if the current
482 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
483 * title='svg element specification'>svg</a> element.
484 */
485 public final OMSVGElement getFarthestViewportElement() {
486 return (OMSVGElement)convert(((SVGPathElement)ot).getFarthestViewportElement());
487 }
488 /**
489 * Returns the tight bounding box in current user space (i.e., after application
490 * of the <code>transform</code> attribute, if any) on the geometry of all
491 * contained graphics elements, exclusive of stroking, clipping, masking and
492 * filter effects). Note that getBBox must return the actual bounding box
493 * at the time the method was called, even in case the element has not yet
494 * been rendered.
495 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines
496 * the bounding box.
497 */
498 public final OMSVGRect getBBox() {
499 return ((SVGPathElement)ot).getBBox();
500 }
501 /**
502 * Returns the transformation matrix from current user units (i.e., after
503 * application of the <code>transform</code> attribute, if any) to the viewport
504 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}.
505 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
506 * the CTM.
507 */
508 public final OMSVGMatrix getCTM() {
509 return ((SVGPathElement)ot).getCTM();
510 }
511 /**
512 * Returns the transformation matrix from current user units (i.e., after
513 * application of the <code>transform</code> attribute, if any) to the parent
514 * user agent's notice of a "pixel". For display devices, ideally this represents
515 * a physical screen pixel. For other devices or environments where physical
516 * pixel sizes are not known, then an algorithm similar to the CSS2 definition
517 * of a "pixel" can be used instead. Note that null is returned if this element
518 * is not hooked into the document tree. This method would have been more
519 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code>
520 * is kept for historical reasons.
521 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
522 * the given transformation matrix.
523 */
524 public final OMSVGMatrix getScreenCTM() {
525 return ((SVGPathElement)ot).getScreenCTM();
526 }
527 /**
528 * Returns the transformation matrix from the user coordinate system on the
529 * current element (after application of the <code>transform</code> attribute,
530 * if any) to the user coordinate system on parameter <var>element</var> (after
531 * application of its <code>transform</code> attribute, if any).
532 * @param element The target element.
533 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
534 * the transformation.
535 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently
536 * defined transformation matrices make it impossible to compute the given
537 * matrix (e.g., because one of the transformations is singular).
538 */
539 public final OMSVGMatrix getTransformToElement(OMSVGElement element) throws JavaScriptException {
540 return ((SVGPathElement)ot).getTransformToElement(((SVGElement)element.ot));
541 }
542
543 // Implementation of the svg::SVGTests W3C IDL interface
544 /**
545 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()}
546 * on the given element.
547 */
548 public final OMSVGStringList getRequiredFeatures() {
549 return ((SVGPathElement)ot).getRequiredFeatures();
550 }
551 /**
552 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()}
553 * on the given element.
554 */
555 public final OMSVGStringList getRequiredExtensions() {
556 return ((SVGPathElement)ot).getRequiredExtensions();
557 }
558 /**
559 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()}
560 * on the given element.
561 */
562 public final OMSVGStringList getSystemLanguage() {
563 return ((SVGPathElement)ot).getSystemLanguage();
564 }
565 /**
566 * Returns true if the user agent supports the given extension, specified
567 * by a URI.
568 * @param extension The name of the extension, expressed as a URI.
569 * @return True or false, depending on whether the given extension is supported.
570 */
571 public final boolean hasExtension(String extension) {
572 return ((SVGPathElement)ot).hasExtension(extension);
573 }
574
575 // Implementation of the svg::SVGTransformable W3C IDL interface
576 /**
577 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()}
578 * on the given element.
579 */
580 public final OMSVGAnimatedTransformList getTransform() {
581 return ((SVGPathElement)ot).getTransform();
582 }
583
584 @Override
585 public final HandlerRegistration addClickHandler(ClickHandler handler) {
586 return addDomHandler(handler, ClickEvent.getType());
587 }
588 @Override
589 public final HandlerRegistration addLoadHandler(LoadHandler handler) {
590 return addDomHandler(handler, LoadEvent.getType());
591 }
592 @Override
593 public final HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
594 return addDomHandler(handler, MouseDownEvent.getType());
595 }
596 @Override
597 public final HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
598 return addDomHandler(handler, MouseMoveEvent.getType());
599 }
600 @Override
601 public final HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
602 return addDomHandler(handler, MouseOutEvent.getType());
603 }
604 @Override
605 public final HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
606 return addDomHandler(handler, MouseOverEvent.getType());
607 }
608 @Override
609 public final HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
610 return addDomHandler(handler, MouseUpEvent.getType());
611 }
612 @Override
613 public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
614 return addDomHandler(handler, TouchCancelEvent.getType());
615 }
616 @Override
617 public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
618 return addDomHandler(handler, TouchEndEvent.getType());
619 }
620 @Override
621 public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
622 return addDomHandler(handler, TouchMoveEvent.getType());
623 }
624 @Override
625 public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
626 return addDomHandler(handler, TouchStartEvent.getType());
627 }
628 @Override
629 public final HandlerRegistration addActivateHandler(ActivateHandler handler) {
630 return addDomHandler(handler, ActivateEvent.getType());
631 }
632 @Override
633 public final HandlerRegistration addFocusInHandler(FocusInHandler handler) {
634 return addDomHandler(handler, FocusInEvent.getType());
635 }
636 @Override
637 public final HandlerRegistration addFocusOutHandler(FocusOutHandler handler) {
638 return addDomHandler(handler, FocusOutEvent.getType());
639 }
640 }