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.HasDocumentHandlers;
39 import org.vectomatic.dom.svg.events.HasGraphicalHandlers;
40 import org.vectomatic.dom.svg.events.SVGZoomEvent;
41 import org.vectomatic.dom.svg.events.SVGZoomHandler;
42 import org.vectomatic.dom.svg.impl.SVGElement;
43 import org.vectomatic.dom.svg.impl.SVGSVGElement;
44 import org.vectomatic.dom.svg.itf.ISVGContainerElement;
45 import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
46 import org.vectomatic.dom.svg.itf.ISVGFitToViewBox;
47 import org.vectomatic.dom.svg.itf.ISVGLangSpace;
48 import org.vectomatic.dom.svg.itf.ISVGLocatable;
49 import org.vectomatic.dom.svg.itf.ISVGStylable;
50 import org.vectomatic.dom.svg.itf.ISVGTests;
51 import org.vectomatic.dom.svg.itf.ISVGZoomAndPan;
52 import org.vectomatic.dom.svg.utils.DOMHelper;
53 import org.vectomatic.dom.svg.utils.SVGConstants;
54
55 import com.google.gwt.core.client.JavaScriptException;
56 import com.google.gwt.dom.client.Node;
57 import com.google.gwt.dom.client.NodeList;
58 import com.google.gwt.dom.client.Style;
59 import com.google.gwt.dom.client.TagName;
60 import com.google.gwt.event.dom.client.ClickEvent;
61 import com.google.gwt.event.dom.client.ClickHandler;
62 import com.google.gwt.event.dom.client.LoadEvent;
63 import com.google.gwt.event.dom.client.LoadHandler;
64 import com.google.gwt.event.dom.client.MouseDownEvent;
65 import com.google.gwt.event.dom.client.MouseDownHandler;
66 import com.google.gwt.event.dom.client.MouseMoveEvent;
67 import com.google.gwt.event.dom.client.MouseMoveHandler;
68 import com.google.gwt.event.dom.client.MouseOutEvent;
69 import com.google.gwt.event.dom.client.MouseOutHandler;
70 import com.google.gwt.event.dom.client.MouseOverEvent;
71 import com.google.gwt.event.dom.client.MouseOverHandler;
72 import com.google.gwt.event.dom.client.MouseUpEvent;
73 import com.google.gwt.event.dom.client.MouseUpHandler;
74 import com.google.gwt.event.dom.client.ScrollEvent;
75 import com.google.gwt.event.dom.client.ScrollHandler;
76 import com.google.gwt.event.dom.client.TouchCancelEvent;
77 import com.google.gwt.event.dom.client.TouchCancelHandler;
78 import com.google.gwt.event.dom.client.TouchEndEvent;
79 import com.google.gwt.event.dom.client.TouchEndHandler;
80 import com.google.gwt.event.dom.client.TouchMoveEvent;
81 import com.google.gwt.event.dom.client.TouchMoveHandler;
82 import com.google.gwt.event.dom.client.TouchStartEvent;
83 import com.google.gwt.event.dom.client.TouchStartHandler;
84 import com.google.gwt.event.logical.shared.ResizeEvent;
85 import com.google.gwt.event.logical.shared.ResizeHandler;
86 import com.google.gwt.event.shared.HandlerRegistration;
87
88 /**
89 * <p>A key interface definition is the {@link org.vectomatic.dom.svg.OMSVGSVGElement}
90 * interface, which is the interface that corresponds to the <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
91 * title='svg element specification'>svg</a> element. This interface contains
92 * various miscellaneous commonly-used utility methods, such as matrix operations
93 * and the ability to control the time of redraw on visual rendering devices.</p>
94 * <p>{@link org.vectomatic.dom.svg.OMSVGSVGElement} extends <code>ViewCSS</code>
95 * and <code>DocumentCSS</code> to provide access to the computed values of
96 * properties and the override style sheet as described in <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/"><cite>DOM
97 * Level 2 Style</cite></a> [<a href="refs.html#ref-DOM2STYLE">DOM2STYLE</a>].</p>
98 */
99 @TagName("svg")
100 public class OMSVGSVGElement extends OMSVGElement implements HasGraphicalHandlers, HasDocumentHandlers, ISVGTests, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGLocatable, ISVGFitToViewBox, ISVGZoomAndPan, ISVGContainerElement {
101 public OMSVGSVGElement() {
102 this((SVGSVGElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SVG_TAG).cast());
103 }
104
105 public OMSVGSVGElement(SVGSVGElement ot) {
106 super(ot);
107 }
108
109 // Implementation of the svg::SVGSVGElement W3C IDL interface
110 /**
111 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getX()}
112 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
113 * title='svg element specification'>svg</a> element.
114 */
115 public final OMSVGAnimatedLength getX() {
116 return ((SVGSVGElement)ot).getX();
117 }
118 /**
119 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getY()}
120 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
121 * title='svg element specification'>svg</a> element.
122 */
123 public final OMSVGAnimatedLength getY() {
124 return ((SVGSVGElement)ot).getY();
125 }
126 /**
127 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getWidth()}
128 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
129 * title='svg element specification'>svg</a> element.
130 */
131 public final OMSVGAnimatedLength getWidth() {
132 return ((SVGSVGElement)ot).getWidth();
133 }
134 /**
135 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getHeight()}
136 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
137 * title='svg element specification'>svg</a> element.
138 */
139 public final OMSVGAnimatedLength getHeight() {
140 return ((SVGSVGElement)ot).getHeight();
141 }
142 /**
143 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getContentScriptType()}
144 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
145 * title='svg element specification'>svg</a> element.
146 */
147 public final String getContentScriptType() {
148 return ((SVGSVGElement)ot).getContentScriptType();
149 }
150 /**
151 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getContentScriptType()}
152 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
153 * title='svg element specification'>svg</a> element.
154 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
155 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
156 * attribute</a>.
157 */
158 public final void setContentScriptType(java.lang.String value) throws JavaScriptException {
159 ((SVGSVGElement)ot).setContentScriptType(value);
160 }
161 /**
162 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getContentStyleType()}
163 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
164 * title='svg element specification'>svg</a> element.
165 */
166 public final String getContentStyleType() {
167 return ((SVGSVGElement)ot).getContentStyleType();
168 }
169 /**
170 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGSVGElement#getContentStyleType()}
171 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
172 * title='svg element specification'>svg</a> element.
173 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
174 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
175 * attribute</a>.
176 */
177 public final void setContentStyleType(java.lang.String value) throws JavaScriptException {
178 ((SVGSVGElement)ot).setContentStyleType(value);
179 }
180 /**
181 * <p>The position and size of the viewport (implicit or explicit) that corresponds
182 * to this <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
183 * element specification'>svg</a> element. When the user agent is actually
184 * rendering the content, then the position and size values represent the
185 * actual values when rendering. The position and size values are unitless
186 * values in the coordinate system of the parent element. If no parent element
187 * exists (i.e., <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
188 * title='svg element specification'>svg</a> element represents the root of
189 * the document tree), if this SVG document is embedded as part of another
190 * document (e.g., via the HTML <span class='element-name'>'object'</span>
191 * element), then the position and size are unitless values in the coordinate
192 * system of the parent document. (If the parent uses CSS or XSL layout, then
193 * unitless values represent pixel units for the current CSS or XSL viewport,
194 * as described in the CSS2 specification.) If the parent element does not
195 * have a coordinate system, then the user agent should provide reasonable
196 * default values for this attribute.</p> <p>The {@link org.vectomatic.dom.svg.OMSVGRect}
197 * object is <a href="types.html#ReadOnlyRect">read only</a>.</p>
198 */
199 public final OMSVGRect getViewport() {
200 return ((SVGSVGElement)ot).getViewport();
201 }
202 /**
203 * Size of a pixel units (as defined by CSS2) along the x-axis of the viewport,
204 * which represents a unit somewhere in the range of 70dpi to 120dpi, and,
205 * on systems that support this, might actually match the characteristics
206 * of the target medium. On systems where it is impossible to know the size
207 * of a pixel, a suitable default pixel size is provided.
208 */
209 public final float getPixelUnitToMillimeterX() {
210 return ((SVGSVGElement)ot).getPixelUnitToMillimeterX();
211 }
212 /**
213 * Corresponding size of a pixel unit along the y-axis of the viewport.
214 */
215 public final float getPixelUnitToMillimeterY() {
216 return ((SVGSVGElement)ot).getPixelUnitToMillimeterY();
217 }
218 /**
219 * User interface (UI) events in DOM Level 2 indicate the screen positions
220 * at which the given UI event occurred. When the user agent actually knows
221 * the physical size of a "screen unit", this attribute will express that
222 * information; otherwise, user agents will provide a suitable default value
223 * such as .28mm.
224 */
225 public final float getScreenPixelToMillimeterX() {
226 return ((SVGSVGElement)ot).getScreenPixelToMillimeterX();
227 }
228 /**
229 * Corresponding size of a screen pixel along the y-axis of the viewport.
230 */
231 public final float getScreenPixelToMillimeterY() {
232 return ((SVGSVGElement)ot).getScreenPixelToMillimeterY();
233 }
234 /**
235 * The initial view (i.e., before magnification and panning) of the current
236 * innermost SVG document fragment can be either the "standard" view (i.e.,
237 * based on attributes on the <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
238 * title='svg element specification'>svg</a> element such as <code>svg/viewBox</code>)
239 * or to a "custom" view (i.e., a hyperlink into a particular <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement'
240 * title='view element specification'>view</a> or other element - see <a href="linking.html#LinksIntoSVG">Linking
241 * into SVG content: URI fragments and SVG views</a>). If the initial view
242 * is the "standard" view, then this attribute is false. If the initial view
243 * is a "custom" view, then this attribute is true.
244 */
245 public final boolean getUseCurrentView() {
246 return ((SVGSVGElement)ot).getUseCurrentView();
247 }
248 /**
249 * <p>The definition of the initial view (i.e., before magnification and panning)
250 * of the current innermost SVG document fragment. The meaning depends on
251 * the situation:</p> <ul> <li> If the initial view was a "standard"
252 * view, then: <ul> <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()},
253 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
254 * and {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
255 * within {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()}
256 * will match the values for the corresponding DOM attributes that are
257 * on SVGSVGElement directly</li> <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()}
258 * and {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()}
259 * within {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()}
260 * will be null</li> </ul> </li> <li> If the initial view was
261 * a link into a <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement'
262 * title='view element specification'>view</a> element, then: <ul>
263 * <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()},
264 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
265 * and {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
266 * within {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()}
267 * will correspond to the corresponding attributes for the given <a
268 * href='http://www.w3.org/TR/SVG11/linking.html#ViewElement' title='view
269 * element specification'>view</a> element</li> <li>the values for {@link
270 * org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} and {@link
271 * org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()} within {@link
272 * org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()} will be
273 * null</li> </ul> </li> <li> If the initial view was a link into
274 * another element (i.e., other than a <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement'
275 * title='view element specification'>view</a>), then: <ul> <li>the
276 * values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()},
277 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
278 * and {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
279 * within {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()}
280 * will match the values for the corresponding DOM attributes that are
281 * on SVGSVGElement directly for the closest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
282 * title='svg element specification'>svg</a> element</li> <li>the values
283 * for {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} within
284 * {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()} will be
285 * null</li> <li>the {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()}
286 * within {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()}
287 * will represent the target of the link</li> </ul> </li> <li>
288 * If the initial view was a link into the SVG document fragment using
289 * an SVG view specification fragment identifier (i.e., #svgView(...)),
290 * then: <ul> <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()},
291 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()},
292 * {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()},
293 * {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} and
294 * {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()} within
295 * {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentView()} will
296 * correspond to the values from the SVG view specification fragment
297 * identifier</li> </ul> </li> </ul> <p>The object itself and its contents
298 * are both read only.</p>
299 */
300 public final OMSVGViewSpec getCurrentView() {
301 return ((SVGSVGElement)ot).getCurrentView();
302 }
303 /**
304 * On an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
305 * title='svg element specification'>svg</a> element, this attribute indicates
306 * the current scale factor relative to the initial view to take into account
307 * user magnification and panning operations, as described under <a href='interact.html#ZoomAndPanAttribute'>Magnification
308 * and panning</a>. DOM attributes {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentScale()}
309 * and {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentTranslate()}
310 * are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].
311 * If "magnification" is enabled (i.e., <span class='attr-value'>zoomAndPan="magnify"</span>),
312 * then the effect is as if an extra transformation were placed at the outermost
313 * level on the SVG document fragment (i.e., outside the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
314 * title='svg element specification'>svg</a> element). <p>When accessed on
315 * an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
316 * element specification'>svg</a> element that is not an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
317 * title='svg element specification'>svg</a> element, it is undefined what
318 * behavior this attribute has.</p>
319 */
320 public final float getCurrentScale() {
321 return ((SVGSVGElement)ot).getCurrentScale();
322 }
323 /**
324 * On an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
325 * title='svg element specification'>svg</a> element, this attribute indicates
326 * the current scale factor relative to the initial view to take into account
327 * user magnification and panning operations, as described under <a href='interact.html#ZoomAndPanAttribute'>Magnification
328 * and panning</a>. DOM attributes {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentScale()}
329 * and {@link org.vectomatic.dom.svg.OMSVGSVGElement#getCurrentTranslate()}
330 * are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y].
331 * If "magnification" is enabled (i.e., <span class='attr-value'>zoomAndPan="magnify"</span>),
332 * then the effect is as if an extra transformation were placed at the outermost
333 * level on the SVG document fragment (i.e., outside the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
334 * title='svg element specification'>svg</a> element). <p>When accessed on
335 * an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
336 * element specification'>svg</a> element that is not an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
337 * title='svg element specification'>svg</a> element, it is undefined what
338 * behavior this attribute has.</p>
339 */
340 public final void setCurrentScale(float value) {
341 ((SVGSVGElement)ot).setCurrentScale(value);
342 }
343 /**
344 * On an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
345 * title='svg element specification'>svg</a> element, the corresponding translation
346 * factor that takes into account user "magnification". <p>When accessed on
347 * an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
348 * element specification'>svg</a> element that is not an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
349 * title='svg element specification'>svg</a> element, it is undefined what
350 * behavior this attribute has.</p>
351 */
352 public final OMSVGPoint getCurrentTranslate() {
353 return ((SVGSVGElement)ot).getCurrentTranslate();
354 }
355 /**
356 * Takes a time-out value which indicates that redraw shall not occur until:
357 * <ol> <li>the corresponding unsuspendRedraw() call has been made,</li>
358 * <li>an unsuspendRedrawAll() call has been made, or</li> <li>its timer
359 * has timed out.</li> </ol> <p>In environments that do not support interactivity
360 * (e.g., print media), then redraw shall not be suspended. Calls to suspendRedraw()
361 * and unsuspendRedraw() should, but need not be, made in balanced pairs.</p>
362 * <p>To suspend redraw actions as a collection of SVG DOM changes occur,
363 * precede the changes to the SVG DOM with a method call similar to:</p> <pre>suspendHandleID
364 * = suspendRedraw(maxWaitMilliseconds);</pre> <p>and follow the changes with
365 * a method call similar to:</p> <pre>unsuspendRedraw(suspendHandleID);</pre>
366 * <p>Note that multiple suspendRedraw calls can be used at once and that
367 * each such method call is treated independently of the other suspendRedraw
368 * method calls.</p>
369 * @param maxWaitMilliseconds The amount of time in milliseconds to hold
370 * off before redrawing the device. Values greater than 60 seconds will
371 * be truncated down to 60 seconds.
372 * @return A number which acts as a unique identifier for the given suspendRedraw()
373 * call. This value must be passed as the parameter to the corresponding
374 * unsuspendRedraw() method call.
375 */
376 public final int suspendRedraw(int maxWaitMilliseconds) {
377 return ((SVGSVGElement)ot).suspendRedraw(maxWaitMilliseconds);
378 }
379 /**
380 * Cancels a specified suspendRedraw() by providing a unique suspend handle
381 * ID that was returned by a previous suspendRedraw() call.
382 * @param suspendHandleID A number which acts as a unique identifier for
383 * the desired suspendRedraw() call. The number supplied must be a value
384 * returned from a previous call to suspendRedraw(). If an invalid handle
385 * ID value is provided then the request to unsuspendRedraw() is silently
386 * ignored.
387 */
388 public final void unsuspendRedraw(int suspendHandleID) {
389 ((SVGSVGElement)ot).unsuspendRedraw(suspendHandleID);
390 }
391 /**
392 * Cancels all currently active suspendRedraw() method calls. This method
393 * is most useful at the very end of a set of SVG DOM calls to ensure that
394 * all pending suspendRedraw() method calls have been cancelled.
395 */
396 public final void unsuspendRedrawAll() {
397 ((SVGSVGElement)ot).unsuspendRedrawAll();
398 }
399 /**
400 * In rendering environments supporting interactivity, forces the user agent
401 * to immediately redraw all regions of the viewport that require updating.
402 */
403 public final void forceRedraw() {
404 ((SVGSVGElement)ot).forceRedraw();
405 }
406 /**
407 * Suspends (i.e., pauses) all currently running animations that are defined
408 * within the SVG document fragment corresponding to this <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
409 * title='svg element specification'>svg</a> element, causing the animation
410 * clock corresponding to this document fragment to stand still until it is
411 * unpaused.
412 */
413 public final void pauseAnimations() {
414 ((SVGSVGElement)ot).pauseAnimations();
415 }
416 /**
417 * Unsuspends (i.e., unpauses) currently running animations that are defined
418 * within the SVG document fragment, causing the animation clock to continue
419 * from the time at which it was suspended.
420 */
421 public final void unpauseAnimations() {
422 ((SVGSVGElement)ot).unpauseAnimations();
423 }
424 /**
425 * Returns true if this SVG document fragment is in a paused state.
426 * @return Boolean indicating whether this SVG document fragment is in a
427 * paused state.
428 */
429 public final boolean animationsPaused() {
430 return ((SVGSVGElement)ot).animationsPaused();
431 }
432 /**
433 * Returns the current time in seconds relative to the start time for the
434 * current SVG document fragment. If <span class="dom-method-name">getCurrentTime</span>
435 * is called before the document timeline has begun (for example, by script
436 * running in a <a href='http://www.w3.org/TR/SVG11/script.html#ScriptElement'
437 * title='script element specification'>script</a> element before the document's
438 * <a href="interact.html#LoadEvent">SVGLoad</a> event is dispatched), then
439 * 0 is returned.
440 * @return The current time in seconds, or 0 if the document timeline has
441 * not yet begun.
442 */
443 public final float getCurrentTime() {
444 return ((SVGSVGElement)ot).getCurrentTime();
445 }
446 /**
447 * Adjusts the clock for this SVG document fragment, establishing a new current
448 * time. If <span class="dom-method-name">setCurrentTime</span> is called
449 * before the document timeline has begun (for example, by script running
450 * in a <a href='http://www.w3.org/TR/SVG11/script.html#ScriptElement' title='script
451 * element specification'>script</a> element before the document's <a href="interact.html#LoadEvent">SVGLoad</a>
452 * event is dispatched), then the value of <var>seconds</var> in the last
453 * invocation of the method gives the time that the document will seek to
454 * once the document timeline has begun.
455 * @param seconds The new current time in seconds relative to the start
456 * time for the current SVG document fragment.
457 */
458 public final void setCurrentTime(float seconds) {
459 ((SVGSVGElement)ot).setCurrentTime(seconds);
460 }
461 /**
462 * Returns the list of graphics elements whose rendered content intersects
463 * the supplied rectangle. Each candidate graphics element is to be considered
464 * a match only if the same graphics element can be a <a href="interact.html#PointerEventsProperty">target
465 * of pointer events</a> as defined in <code>pointer-events</code> processing.
466 * @param rect The test rectangle. The values are in the <code>initial coordinate
467 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
468 * title='svg element specification'>svg</a> element.
469 * @param referenceElement If not null, then any intersected element that
470 * doesn't have the referenceElement as ancestor must not be included in
471 * the returned NodeList.
472 * @return A list of Elements whose content intersects the supplied rectangle.
473 * This {@link com.google.gwt.dom.client.NodeList} must be implemented identically
474 * to the {@link com.google.gwt.dom.client.NodeList} interface as defined
475 * in DOM Level 2 Core ([<a href="refs.html#ref-DOM2">DOM2</a>], section
476 * 1.2) with the exception that the interface is not <a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#td-live">live</a>.
477 */
478 public final NodeList<? extends Node> getIntersectionList(OMSVGRect rect, OMSVGElement referenceElement) {
479 return ((SVGSVGElement)ot).getIntersectionList(rect, ((SVGElement)referenceElement.ot));
480 }
481 /**
482 * Returns the list of graphics elements whose rendered content is entirely
483 * contained within the supplied rectangle. Each candidate graphics element
484 * is to be considered a match only if the same graphics element can be a
485 * <a href="interact.html#PointerEventsProperty">target of pointer events</a>
486 * as defined in <code>pointer-events</code> processing.
487 * @param rect The test rectangle. The values are in the <code>initial coordinate
488 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
489 * title='svg element specification'>svg</a> element.
490 * @param referenceElement If not null, then any intersected element that
491 * doesn't have the referenceElement as ancestor must not be included in
492 * the returned NodeList.
493 * @return A list of Elements whose content is enclosed by the supplied
494 * rectangle. This {@link com.google.gwt.dom.client.NodeList} must be implemented
495 * identically to the {@link com.google.gwt.dom.client.NodeList} interface
496 * as defined in DOM Level 2 Core ([<a href="refs.html#ref-DOM2">DOM2</a>],
497 * section 1.2) with the exception that the interface is not <a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#td-live">live</a>.
498 */
499 public final NodeList<? extends Node> getEnclosureList(OMSVGRect rect, OMSVGElement referenceElement) {
500 return ((SVGSVGElement)ot).getEnclosureList(rect, ((SVGElement)referenceElement.ot));
501 }
502 /**
503 * Returns true if the rendered content of the given element intersects the
504 * supplied rectangle. Each candidate graphics element is to be considered
505 * a match only if the same graphics element can be a <a href="interact.html#PointerEventsProperty">target
506 * of pointer events</a> as defined in <code>pointer-events</code> processing.
507 * @param element The element on which to perform the given test.
508 * @param rect The test rectangle. The values are in the <code>initial coordinate
509 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
510 * title='svg element specification'>svg</a> element.
511 * @return True or false, depending on whether the given element intersects
512 * the supplied rectangle.
513 */
514 public final boolean checkIntersection(OMSVGElement element, OMSVGRect rect) {
515 return ((SVGSVGElement)ot).checkIntersection(((SVGElement)element.ot), rect);
516 }
517 /**
518 * Returns true if the rendered content of the given element is entirely contained
519 * within the supplied rectangle. Each candidate graphics element is to be
520 * considered a match only if the same graphics element can be a <a href="interact.html#PointerEventsProperty">target
521 * of pointer events</a> as defined in <code>pointer-events</code> processing.
522 * @param element The element on which to perform the given test.
523 * @param rect The test rectangle. The values are in the <code>initial coordinate
524 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
525 * title='svg element specification'>svg</a> element.
526 * @return True or false, depending on whether the given element is enclosed
527 * by the supplied rectangle.
528 */
529 public final boolean checkEnclosure(OMSVGElement element, OMSVGRect rect) {
530 return ((SVGSVGElement)ot).checkEnclosure(((SVGElement)element.ot), rect);
531 }
532 /**
533 * Unselects any selected objects, including any selections of text strings
534 * and type-in bars.
535 */
536 public final void deselectAll() {
537 ((SVGSVGElement)ot).deselectAll();
538 }
539 /**
540 * Creates an {@link org.vectomatic.dom.svg.OMSVGNumber} object outside of
541 * any document trees. The object is initialized to a value of zero.
542 * @return An {@link org.vectomatic.dom.svg.OMSVGNumber} object.
543 */
544 public final OMSVGNumber createSVGNumber() {
545 return ((SVGSVGElement)ot).createSVGNumber();
546 }
547 /**
548 * Creates an {@link org.vectomatic.dom.svg.OMSVGLength} object outside of
549 * any document trees. The object is initialized to the value of 0 user units.
550 * @return An {@link org.vectomatic.dom.svg.OMSVGLength} object.
551 */
552 public final OMSVGLength createSVGLength() {
553 return ((SVGSVGElement)ot).createSVGLength();
554 }
555 /**
556 * Creates an {@link org.vectomatic.dom.svg.OMSVGAngle} object outside of
557 * any document trees. The object is initialized to the value 0 degrees (unitless).
558 * @return An {@link org.vectomatic.dom.svg.OMSVGAngle} object.
559 */
560 public final OMSVGAngle createSVGAngle() {
561 return ((SVGSVGElement)ot).createSVGAngle();
562 }
563 /**
564 * Creates an {@link org.vectomatic.dom.svg.OMSVGPoint} object outside of
565 * any document trees. The object is initialized to the point (0,0) in the
566 * user coordinate system.
567 * @return An {@link org.vectomatic.dom.svg.OMSVGPoint} object.
568 */
569 public final OMSVGPoint createSVGPoint() {
570 return ((SVGSVGElement)ot).createSVGPoint();
571 }
572 /**
573 * Creates an {@link org.vectomatic.dom.svg.OMSVGMatrix} object outside of
574 * any document trees. The object is initialized to the identity matrix.
575 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object.
576 */
577 public final OMSVGMatrix createSVGMatrix() {
578 return ((SVGSVGElement)ot).createSVGMatrix();
579 }
580 /**
581 * Creates an {@link org.vectomatic.dom.svg.OMSVGRect} object outside of any
582 * document trees. The object is initialized such that all values are set
583 * to 0 user units.
584 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object.
585 */
586 public final OMSVGRect createSVGRect() {
587 return ((SVGSVGElement)ot).createSVGRect();
588 }
589 /**
590 * Creates an {@link org.vectomatic.dom.svg.OMSVGTransform} object outside
591 * of any document trees. The object is initialized to an identity matrix
592 * transform (SVG_TRANSFORM_MATRIX).
593 * @return An {@link org.vectomatic.dom.svg.OMSVGTransform} object.
594 */
595 public final OMSVGTransform createSVGTransform() {
596 return ((SVGSVGElement)ot).createSVGTransform();
597 }
598 /**
599 * <p xmlns:edit="http://xmlns.grorg.org/SVGT12NG/"> Creates an {@link org.vectomatic.dom.svg.OMSVGTransform}
600 * object outside of any document trees. The object is initialized to the
601 * given matrix transform (i.e., SVG_TRANSFORM_MATRIX). The values from the
602 * parameter <var>matrix</var> are copied, the <var>matrix</var> parameter
603 * is not adopted as <a edit:format="expanded">SVGTransform::matrix</a>. </p>
604 * @param matrix The transform matrix.
605 * @return An {@link org.vectomatic.dom.svg.OMSVGTransform} object.
606 */
607 public final OMSVGTransform createSVGTransformFromMatrix(OMSVGMatrix matrix) {
608 return ((SVGSVGElement)ot).createSVGTransformFromMatrix(matrix);
609 }
610 /**
611 * Searches this SVG document fragment (i.e., the search is restricted to
612 * a subset of the document tree) for an Element whose id is given by <var>elementId</var>.
613 * If an Element is found, that Element is returned. If no such element exists,
614 * returns null. Behavior is not defined if more than one element has this
615 * id.
616 * @param elementId The unique id value for an element.
617 * @return The matching element.
618 */
619 public final OMElement getElementById(String elementId) {
620 return (OMElement) convert(((SVGSVGElement)ot).getElementById(elementId));
621 }
622
623 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
624 /**
625 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
626 * on the given element. Note that the SVG DOM defines the attribute {@link
627 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
628 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
629 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
630 * is not animated. Because the SVG language definition states that {@link
631 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
632 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
633 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
634 */
635 public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
636 return ((SVGSVGElement)ot).getExternalResourcesRequired();
637 }
638
639 // Implementation of the svg::SVGFitToViewBox W3C IDL interface
640 /**
641 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}
642 * on the given element.
643 */
644 public final OMSVGAnimatedRect getViewBox() {
645 return ((SVGSVGElement)ot).getViewBox();
646 }
647 /**
648 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
649 * on the given element.
650 */
651 public final OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
652 return ((SVGSVGElement)ot).getPreserveAspectRatio();
653 }
654
655 // Implementation of the svg::SVGLangSpace W3C IDL interface
656 /**
657 * Corresponds to attribute <code>xml:lang</code> on the given element.
658 */
659 public final String getXmllang() {
660 return ((SVGSVGElement)ot).getXmllang();
661 }
662 /**
663 * Corresponds to attribute <code>xml:lang</code> on the given element.
664 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
665 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
666 * attribute</a>.
667 */
668 public final void setXmllang(java.lang.String value) throws JavaScriptException {
669 ((SVGSVGElement)ot).setXmllang(value);
670 }
671 /**
672 * Corresponds to attribute <code>xml:space</code> on the given element.
673 */
674 public final String getXmlspace() {
675 return ((SVGSVGElement)ot).getXmlspace();
676 }
677 /**
678 * Corresponds to attribute <code>xml:space</code> on the given element.
679 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
680 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
681 * attribute</a>.
682 */
683 public final void setXmlspace(java.lang.String value) throws JavaScriptException {
684 ((SVGSVGElement)ot).setXmlspace(value);
685 }
686
687 // Implementation of the svg::SVGLocatable W3C IDL interface
688 /**
689 * The element which established the current viewport. Often, the nearest
690 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg
691 * element specification'>svg</a> element. Null if the current element is
692 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
693 * title='svg element specification'>svg</a> element.
694 */
695 public final OMSVGElement getNearestViewportElement() {
696 return (OMSVGElement)convert(((SVGSVGElement)ot).getNearestViewportElement());
697 }
698 /**
699 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
700 * title='svg element specification'>svg</a> element. Null if the current
701 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
702 * title='svg element specification'>svg</a> element.
703 */
704 public final OMSVGElement getFarthestViewportElement() {
705 return (OMSVGElement)convert(((SVGSVGElement)ot).getFarthestViewportElement());
706 }
707 /**
708 * Returns the tight bounding box in current user space (i.e., after application
709 * of the <code>transform</code> attribute, if any) on the geometry of all
710 * contained graphics elements, exclusive of stroking, clipping, masking and
711 * filter effects). Note that getBBox must return the actual bounding box
712 * at the time the method was called, even in case the element has not yet
713 * been rendered.
714 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines
715 * the bounding box.
716 */
717 public final OMSVGRect getBBox() {
718 return ((SVGSVGElement)ot).getBBox();
719 }
720 /**
721 * Returns the transformation matrix from current user units (i.e., after
722 * application of the <code>transform</code> attribute, if any) to the viewport
723 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}.
724 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
725 * the CTM.
726 */
727 public final OMSVGMatrix getCTM() {
728 return ((SVGSVGElement)ot).getCTM();
729 }
730 /**
731 * Returns the transformation matrix from current user units (i.e., after
732 * application of the <code>transform</code> attribute, if any) to the parent
733 * user agent's notice of a "pixel". For display devices, ideally this represents
734 * a physical screen pixel. For other devices or environments where physical
735 * pixel sizes are not known, then an algorithm similar to the CSS2 definition
736 * of a "pixel" can be used instead. Note that null is returned if this element
737 * is not hooked into the document tree. This method would have been more
738 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code>
739 * is kept for historical reasons.
740 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
741 * the given transformation matrix.
742 */
743 public final OMSVGMatrix getScreenCTM() {
744 return ((SVGSVGElement)ot).getScreenCTM();
745 }
746 /**
747 * Returns the transformation matrix from the user coordinate system on the
748 * current element (after application of the <code>transform</code> attribute,
749 * if any) to the user coordinate system on parameter <var>element</var> (after
750 * application of its <code>transform</code> attribute, if any).
751 * @param element The target element.
752 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
753 * the transformation.
754 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently
755 * defined transformation matrices make it impossible to compute the given
756 * matrix (e.g., because one of the transformations is singular).
757 */
758 public final OMSVGMatrix getTransformToElement(OMSVGElement element) throws JavaScriptException {
759 return ((SVGSVGElement)ot).getTransformToElement(((SVGElement)element.ot));
760 }
761
762 // Implementation of the svg::SVGTests W3C IDL interface
763 /**
764 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()}
765 * on the given element.
766 */
767 public final OMSVGStringList getRequiredFeatures() {
768 return ((SVGSVGElement)ot).getRequiredFeatures();
769 }
770 /**
771 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()}
772 * on the given element.
773 */
774 public final OMSVGStringList getRequiredExtensions() {
775 return ((SVGSVGElement)ot).getRequiredExtensions();
776 }
777 /**
778 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()}
779 * on the given element.
780 */
781 public final OMSVGStringList getSystemLanguage() {
782 return ((SVGSVGElement)ot).getSystemLanguage();
783 }
784 /**
785 * Returns true if the user agent supports the given extension, specified
786 * by a URI.
787 * @param extension The name of the extension, expressed as a URI.
788 * @return True or false, depending on whether the given extension is supported.
789 */
790 public final boolean hasExtension(String extension) {
791 return ((SVGSVGElement)ot).hasExtension(extension);
792 }
793
794 // Implementation of the svg::SVGZoomAndPan W3C IDL interface
795 /**
796 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
797 * on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants
798 * defined on this interface.
799 */
800 public final short getZoomAndPan() {
801 return ((SVGSVGElement)ot).getZoomAndPan();
802 }
803 /**
804 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
805 * on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants
806 * defined on this interface.
807 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
808 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
809 * attribute</a>.
810 */
811 public final void setZoomAndPan(short value) throws JavaScriptException {
812 ((SVGSVGElement)ot).setZoomAndPan(value);
813 }
814
815 @Override
816 public final HandlerRegistration addClickHandler(ClickHandler handler) {
817 return addDomHandler(handler, ClickEvent.getType());
818 }
819 @Override
820 public final HandlerRegistration addLoadHandler(LoadHandler handler) {
821 return addDomHandler(handler, LoadEvent.getType());
822 }
823 @Override
824 public final HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
825 return addDomHandler(handler, MouseDownEvent.getType());
826 }
827 @Override
828 public final HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
829 return addDomHandler(handler, MouseMoveEvent.getType());
830 }
831 @Override
832 public final HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
833 return addDomHandler(handler, MouseOutEvent.getType());
834 }
835 @Override
836 public final HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
837 return addDomHandler(handler, MouseOverEvent.getType());
838 }
839 @Override
840 public final HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
841 return addDomHandler(handler, MouseUpEvent.getType());
842 }
843 @Override
844 public final HandlerRegistration addScrollHandler(ScrollHandler handler) {
845 return addDomHandler(handler, ScrollEvent.getType());
846 }
847 @Override
848 public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
849 return addDomHandler(handler, TouchCancelEvent.getType());
850 }
851 @Override
852 public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
853 return addDomHandler(handler, TouchEndEvent.getType());
854 }
855 @Override
856 public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
857 return addDomHandler(handler, TouchMoveEvent.getType());
858 }
859 @Override
860 public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
861 return addDomHandler(handler, TouchStartEvent.getType());
862 }
863 @Override
864 public final HandlerRegistration addResizeHandler(ResizeHandler handler) {
865 return addHandler(handler, ResizeEvent.getType());
866 }
867 @Override
868 public final HandlerRegistration addActivateHandler(ActivateHandler handler) {
869 return addDomHandler(handler, ActivateEvent.getType());
870 }
871 @Override
872 public final HandlerRegistration addFocusInHandler(FocusInHandler handler) {
873 return addDomHandler(handler, FocusInEvent.getType());
874 }
875 @Override
876 public final HandlerRegistration addFocusOutHandler(FocusOutHandler handler) {
877 return addDomHandler(handler, FocusOutEvent.getType());
878 }
879 @Override
880 public final HandlerRegistration addSVGZoomHandler(SVGZoomHandler handler) {
881 return addDomHandler(handler, SVGZoomEvent.getType());
882 }
883 // Helper methods
884 /**
885 * Creates an {@link org.vectomatic.dom.svg.OMSVGNumber} object outside of
886 * any document trees. The object is initialized to the specified value.
887 * @param value the value to use for initialization
888 * @return An {@link org.vectomatic.dom.svg.OMSVGNumber} object.
889 */
890 public final OMSVGNumber createSVGNumber(float value) {
891 OMSVGNumber number = createSVGNumber();
892 number.setValue(value);
893 return number;
894 }
895 /**
896 * Creates an {@link org.vectomatic.dom.svg.OMSVGLength} object outside of
897 * any document trees. The object is initialized to the specified value
898 * and unit type.
899 * @param unitType the unit type to use for initialization
900 * @param valueInSpecifiedUnits the value to use for initialization, in the specified units
901 * @return An {@link org.vectomatic.dom.svg.OMSVGLength} object.
902 */
903 public final OMSVGLength createSVGLength(short unitType, float valueInSpecifiedUnits) {
904 OMSVGLength length = ((SVGSVGElement)ot).createSVGLength();
905 length.newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
906 return length;
907 }
908 /**
909 * Creates an {@link org.vectomatic.dom.svg.OMSVGLength} object outside of
910 * any document trees. The object is initialized to the specified value
911 * and unit type.
912 * @param unitType the unit type to use for initialization
913 * @param valueInSpecifiedUnits the value to use for initialization, in the specified units
914 * @return An {@link org.vectomatic.dom.svg.OMSVGLength} object.
915 */
916 public final OMSVGLength createSVGLength(Style.Unit unitType, float valueInSpecifiedUnits) {
917 return createSVGLength(OMSVGLength.unitToCode(unitType), valueInSpecifiedUnits);
918 }
919 /**
920 * Creates an {@link org.vectomatic.dom.svg.OMSVGLength} object outside of
921 * any document trees. The object is initialized to the specified length.
922 * @param l the length to use for initialization
923 * @return An {@link org.vectomatic.dom.svg.OMSVGLength} object.
924 */
925 public final OMSVGLength createSVGLength(OMSVGLength l) {
926 return createSVGLength(l.getUnitType(), l.getValueInSpecifiedUnits());
927 }
928 /**
929 * Creates an {@link org.vectomatic.dom.svg.OMSVGAngle} object outside of
930 * any document trees. The object is initialized to the specified value
931 * and unit type.
932 * @param unitType the unit type to use for initialization
933 * @param valueInSpecifiedUnits the value to use for initialization, in the specified units
934 * @return An {@link org.vectomatic.dom.svg.OMSVGAngle} object.
935 */
936 public final OMSVGAngle createSVGAngle(short unitType, float valueInSpecifiedUnits) {
937 OMSVGAngle angle = ((SVGSVGElement)ot).createSVGAngle();
938 angle.newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
939 return angle;
940 }
941 /**
942 * Creates an {@link org.vectomatic.dom.svg.OMSVGAngle} object outside of
943 * any document trees. The object is initialized to the specified angle.
944 * @param a the angle to use for initialization
945 * @return An {@link org.vectomatic.dom.svg.OMSVGAngle} object.
946 */
947 public final OMSVGAngle createSVGAngle(OMSVGAngle a) {
948 return createSVGAngle(a.getUnitType(), a.getValueInSpecifiedUnits());
949 }
950 /**
951 * Creates an {@link org.vectomatic.dom.svg.OMSVGPoint} object outside of
952 * any document trees. The object is initialized to the specified coordinates.
953 * @param x the X coordinate to use for initialization
954 * @param y the Y coordinate to use for initialization
955 * @return An {@link org.vectomatic.dom.svg.OMSVGPoint} object.
956 */
957 public final OMSVGPoint createSVGPoint(float x, float y) {
958 OMSVGPoint point = ((SVGSVGElement)ot).createSVGPoint();
959 point.setX(x);
960 point.setY(y);
961 return point;
962 }
963 /**
964 * Creates an {@link org.vectomatic.dom.svg.OMSVGPoint} object outside of
965 * any document trees. The object is initialized to the specified point.
966 * @param p the point to use for initialization
967 * @return An {@link org.vectomatic.dom.svg.OMSVGPoint} object.
968 */
969 public final OMSVGPoint createSVGPoint(OMSVGPoint p) {
970 return createSVGPoint(p.getX(), p.getY());
971 }
972 /**
973 * Creates an {@link org.vectomatic.dom.svg.OMSVGMatrix} object outside of
974 * any document trees. The object is initialized to the specified components.
975 * @param a the A component to use for initialization
976 * @param b the B component to use for initialization
977 * @param c the C component to use for initialization
978 * @param d the D component to use for initialization
979 * @param e the E component to use for initialization
980 * @param f the F component to use for initialization
981 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object.
982 */
983 public final OMSVGMatrix createSVGMatrix(float a, float b, float c, float d, float e, float f) {
984 OMSVGMatrix matrix = ((SVGSVGElement)ot).createSVGMatrix();
985 matrix.setA(a);
986 matrix.setB(b);
987 matrix.setC(c);
988 matrix.setD(d);
989 matrix.setE(e);
990 matrix.setF(f);
991 return matrix;
992 }
993 /**
994 * Creates an {@link org.vectomatic.dom.svg.OMSVGMatrix} object outside of
995 * any document trees. The object is initialized to the specified matrix.
996 * @param m the matrix to use for initialization
997 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object.
998 */
999 public final OMSVGMatrix createSVGMatrix(OMSVGMatrix m) {
1000 return createSVGMatrix(m.getA(), m.getB(), m.getC(), m.getD(), m.getE(), m.getF());
1001 }
1002 /**
1003 * Creates an {@link org.vectomatic.dom.svg.OMSVGRect} object outside of
1004 * any document trees. The object is initialized to the specified coordinates
1005 * and size.
1006 * @param x the X coordinate to use for initialization
1007 * @param y the Y coordinate to use for initialization
1008 * @param width the width to use for initialization
1009 * @param height the height to use for initialization
1010 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object.
1011 */
1012 public final OMSVGRect createSVGRect(float x, float y, float width, float height) {
1013 OMSVGRect rect = ((SVGSVGElement)ot).createSVGRect();
1014 rect.setX(x);
1015 rect.setY(y);
1016 rect.setWidth(width);
1017 rect.setHeight(height);
1018 return rect;
1019 }
1020 /**
1021 * Creates an {@link org.vectomatic.dom.svg.OMSVGRect} object outside of
1022 * any document trees. The object is initialized to the specified rectangle.
1023 * @param rect the rect to use for initialization
1024 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object.
1025 */
1026 public final OMSVGRect createSVGRect(OMSVGRect rect) {
1027 return createSVGRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
1028 }
1029 /**
1030 * Sets the base value for the height of this {@link org.vectomatic.dom.svg.OMSVGSVGElement}
1031 * to the specified value and unit type.
1032 * @param unitType the unit type in which the height is specified
1033 * @param height the height in the specified units
1034 */
1035 public final void setHeight(short unitType, float height) {
1036 getHeight().getBaseVal().newValueSpecifiedUnits(unitType, height);
1037 }
1038 /**
1039 * Sets the base value for the height of this {@link org.vectomatic.dom.svg.OMSVGSVGElement}
1040 * to the specified value and unit type.
1041 * @param unitType the unit type in which the height is specified
1042 * @param height the height in the specified units
1043 */
1044 public final void setHeight(com.google.gwt.dom.client.Style.Unit unitType, float height) {
1045 getHeight().getBaseVal().newValueSpecifiedUnits(unitType, height);
1046 }
1047 /**
1048 * Sets the base value for the viewbox of this {@link org.vectomatic.dom.svg.OMSVGSVGElement}
1049 * to the specified rectangle.
1050 * @param rect the rectangle used to specify the viewbox
1051 */
1052 public final void setViewBox(OMSVGRect rect) {
1053 setViewBox(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
1054 }
1055 /**
1056 * Sets the base value for the viewbox of this {@link org.vectomatic.dom.svg.OMSVGSVGElement}
1057 * to the specified coordinates and size.
1058 * @param x the X coordinate to use for the viewbox
1059 * @param y the Y coordinate to use for the viewbox
1060 * @param width the width to use for the viewbox
1061 * @param height the height to use for the viewbox
1062 */
1063 public final void setViewBox(float x, float y, float width, float height) {
1064 OMSVGRect viewBox = getViewBox().getBaseVal();
1065 viewBox.setX(x);
1066 viewBox.setY(y);
1067 viewBox.setWidth(width);
1068 viewBox.setHeight(height);
1069 }
1070 /**
1071 * Sets the base value for the width of this {@link org.vectomatic.dom.svg.OMSVGSVGElement}
1072 * to the specified value and unit type.
1073 * @param unitType the unit type in which the width is specified
1074 * @param width the width in the specified units
1075 */
1076 public final void setWidth(short unitType, float width) {
1077 getWidth().getBaseVal().newValueSpecifiedUnits(unitType, width);
1078 }
1079 /**
1080 * Sets the base value for the width of this {@link org.vectomatic.dom.svg.OMSVGSVGElement}
1081 * to the specified value and unit type.
1082 * @param unitType the unit type in which the width is specified
1083 * @param width the width in the specified units
1084 */
1085 public final void setWidth(com.google.gwt.dom.client.Style.Unit unitType, float width) {
1086 getWidth().getBaseVal().newValueSpecifiedUnits(unitType, width);
1087 }
1088 }