1 /********************************************** 2 * Copyright (C) 2010 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.impl; 31 32 import org.vectomatic.dom.svg.OMSVGAngle; 33 import org.vectomatic.dom.svg.OMSVGAnimatedBoolean; 34 import org.vectomatic.dom.svg.OMSVGAnimatedLength; 35 import org.vectomatic.dom.svg.OMSVGAnimatedPreserveAspectRatio; 36 import org.vectomatic.dom.svg.OMSVGAnimatedRect; 37 import org.vectomatic.dom.svg.OMSVGLength; 38 import org.vectomatic.dom.svg.OMSVGMatrix; 39 import org.vectomatic.dom.svg.OMSVGNumber; 40 import org.vectomatic.dom.svg.OMSVGPoint; 41 import org.vectomatic.dom.svg.OMSVGRect; 42 import org.vectomatic.dom.svg.OMSVGStringList; 43 import org.vectomatic.dom.svg.OMSVGTransform; 44 import org.vectomatic.dom.svg.OMSVGViewSpec; 45 46 import com.google.gwt.core.client.JavaScriptException; 47 import com.google.gwt.dom.client.Element; 48 import com.google.gwt.dom.client.Node; 49 import com.google.gwt.dom.client.NodeList; 50 51 /** 52 * <p>A key interface definition is the {@link org.vectomatic.dom.svg.impl.SVGSVGElement} 53 * interface, which is the interface that corresponds to the <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 54 * title='svg element specification'>svg</a> element. This interface contains 55 * various miscellaneous commonly-used utility methods, such as matrix operations 56 * and the ability to control the time of redraw on visual rendering devices.</p> 57 * <p>{@link org.vectomatic.dom.svg.impl.SVGSVGElement} extends <code>ViewCSS</code> 58 * and <code>DocumentCSS</code> to provide access to the computed values of 59 * 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 60 * Level 2 Style</cite></a> [<a href="refs.html#ref-DOM2STYLE">DOM2STYLE</a>].</p> 61 */ 62 public class SVGSVGElement extends SVGElement { 63 protected SVGSVGElement() { 64 } 65 66 // Implementation of the svg::SVGSVGElement W3C IDL interface 67 /** 68 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getX()} 69 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 70 * title='svg element specification'>svg</a> element. 71 */ 72 public final native OMSVGAnimatedLength getX() /*-{ 73 return this.x; 74 }-*/; 75 /** 76 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getY()} 77 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 78 * title='svg element specification'>svg</a> element. 79 */ 80 public final native OMSVGAnimatedLength getY() /*-{ 81 return this.y; 82 }-*/; 83 /** 84 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getWidth()} 85 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 86 * title='svg element specification'>svg</a> element. 87 */ 88 public final native OMSVGAnimatedLength getWidth() /*-{ 89 return this.width; 90 }-*/; 91 /** 92 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getHeight()} 93 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 94 * title='svg element specification'>svg</a> element. 95 */ 96 public final native OMSVGAnimatedLength getHeight() /*-{ 97 return this.height; 98 }-*/; 99 /** 100 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getContentScriptType()} 101 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 102 * title='svg element specification'>svg</a> element. 103 */ 104 public final native String getContentScriptType() /*-{ 105 return this.contentScriptType; 106 }-*/; 107 /** 108 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getContentScriptType()} 109 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 110 * title='svg element specification'>svg</a> element. 111 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 112 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 113 * attribute</a>. 114 */ 115 public final native void setContentScriptType(String value) throws JavaScriptException /*-{ 116 this.contentScriptType = value; 117 }-*/; 118 /** 119 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getContentStyleType()} 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 native String getContentStyleType() /*-{ 124 return this.contentStyleType; 125 }-*/; 126 /** 127 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getContentStyleType()} 128 * on the given <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 129 * title='svg element specification'>svg</a> element. 130 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 131 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 132 * attribute</a>. 133 */ 134 public final native void setContentStyleType(String value) throws JavaScriptException /*-{ 135 this.contentStyleType = value; 136 }-*/; 137 /** 138 * <p>The position and size of the viewport (implicit or explicit) that corresponds 139 * to this <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 140 * element specification'>svg</a> element. When the user agent is actually 141 * rendering the content, then the position and size values represent the 142 * actual values when rendering. The position and size values are unitless 143 * values in the coordinate system of the parent element. If no parent element 144 * exists (i.e., <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 145 * title='svg element specification'>svg</a> element represents the root of 146 * the document tree), if this SVG document is embedded as part of another 147 * document (e.g., via the HTML <span class='element-name'>'object'</span> 148 * element), then the position and size are unitless values in the coordinate 149 * system of the parent document. (If the parent uses CSS or XSL layout, then 150 * unitless values represent pixel units for the current CSS or XSL viewport, 151 * as described in the CSS2 specification.) If the parent element does not 152 * have a coordinate system, then the user agent should provide reasonable 153 * default values for this attribute.</p> <p>The {@link org.vectomatic.dom.svg.OMSVGRect} 154 * object is <a href="types.html#ReadOnlyRect">read only</a>.</p> 155 */ 156 public final native OMSVGRect getViewport() /*-{ 157 return this.viewport; 158 }-*/; 159 /** 160 * Size of a pixel units (as defined by CSS2) along the x-axis of the viewport, 161 * which represents a unit somewhere in the range of 70dpi to 120dpi, and, 162 * on systems that support this, might actually match the characteristics 163 * of the target medium. On systems where it is impossible to know the size 164 * of a pixel, a suitable default pixel size is provided. 165 */ 166 public final native float getPixelUnitToMillimeterX() /*-{ 167 return this.pixelUnitToMillimeterX; 168 }-*/; 169 /** 170 * Corresponding size of a pixel unit along the y-axis of the viewport. 171 */ 172 public final native float getPixelUnitToMillimeterY() /*-{ 173 return this.pixelUnitToMillimeterY; 174 }-*/; 175 /** 176 * User interface (UI) events in DOM Level 2 indicate the screen positions 177 * at which the given UI event occurred. When the user agent actually knows 178 * the physical size of a "screen unit", this attribute will express that 179 * information; otherwise, user agents will provide a suitable default value 180 * such as .28mm. 181 */ 182 public final native float getScreenPixelToMillimeterX() /*-{ 183 return this.screenPixelToMillimeterX; 184 }-*/; 185 /** 186 * Corresponding size of a screen pixel along the y-axis of the viewport. 187 */ 188 public final native float getScreenPixelToMillimeterY() /*-{ 189 return this.screenPixelToMillimeterY; 190 }-*/; 191 /** 192 * The initial view (i.e., before magnification and panning) of the current 193 * innermost SVG document fragment can be either the "standard" view (i.e., 194 * based on attributes on the <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 195 * title='svg element specification'>svg</a> element such as <code>svg/viewBox</code>) 196 * or to a "custom" view (i.e., a hyperlink into a particular <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement' 197 * title='view element specification'>view</a> or other element - see <a href="linking.html#LinksIntoSVG">Linking 198 * into SVG content: URI fragments and SVG views</a>). If the initial view 199 * is the "standard" view, then this attribute is false. If the initial view 200 * is a "custom" view, then this attribute is true. 201 */ 202 public final native boolean getUseCurrentView() /*-{ 203 return this.useCurrentView; 204 }-*/; 205 /** 206 * <p>The definition of the initial view (i.e., before magnification and panning) 207 * of the current innermost SVG document fragment. The meaning depends on 208 * the situation:</p> <ul> <li> If the initial view was a "standard" 209 * view, then: <ul> <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}, 210 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()} 211 * and {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()} 212 * within {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} 213 * will match the values for the corresponding DOM attributes that are 214 * on SVGSVGElement directly</li> <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} 215 * and {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()} 216 * within {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} 217 * will be null</li> </ul> </li> <li> If the initial view was 218 * a link into a <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement' 219 * title='view element specification'>view</a> element, then: <ul> 220 * <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}, 221 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()} 222 * and {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()} 223 * within {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} 224 * will correspond to the corresponding attributes for the given <a 225 * href='http://www.w3.org/TR/SVG11/linking.html#ViewElement' title='view 226 * element specification'>view</a> element</li> <li>the values for {@link 227 * org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} and {@link 228 * org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()} within {@link 229 * org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} will 230 * be null</li> </ul> </li> <li> If the initial view was a link 231 * into another element (i.e., other than a <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement' 232 * title='view element specification'>view</a>), then: <ul> <li>the 233 * values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}, 234 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()} 235 * and {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()} 236 * within {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} 237 * will match the values for the corresponding DOM attributes that are 238 * on SVGSVGElement directly for the closest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 239 * title='svg element specification'>svg</a> element</li> <li>the values 240 * for {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} within 241 * {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} will 242 * be null</li> <li>the {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()} 243 * within {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} 244 * will represent the target of the link</li> </ul> </li> <li> 245 * If the initial view was a link into the SVG document fragment using 246 * an SVG view specification fragment identifier (i.e., #svgView(...)), 247 * then: <ul> <li>the values for {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}, 248 * {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}, 249 * {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}, 250 * {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getTransform()} and 251 * {@link org.vectomatic.dom.svg.itf.ISVGViewSpec#getViewTarget()} within 252 * {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentView()} 253 * will correspond to the values from the SVG view specification fragment 254 * identifier</li> </ul> </li> </ul> <p>The object itself and its contents 255 * are both read only.</p> 256 */ 257 public final native OMSVGViewSpec getCurrentView() /*-{ 258 return this.currentView; 259 }-*/; 260 /** 261 * On an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 262 * title='svg element specification'>svg</a> element, this attribute indicates 263 * the current scale factor relative to the initial view to take into account 264 * user magnification and panning operations, as described under <a href='interact.html#ZoomAndPanAttribute'>Magnification 265 * and panning</a>. DOM attributes {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentScale()} 266 * and {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentTranslate()} 267 * are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y]. 268 * If "magnification" is enabled (i.e., <span class='attr-value'>zoomAndPan="magnify"</span>), 269 * then the effect is as if an extra transformation were placed at the outermost 270 * level on the SVG document fragment (i.e., outside the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 271 * title='svg element specification'>svg</a> element). <p>When accessed on 272 * an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 273 * element specification'>svg</a> element that is not an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 274 * title='svg element specification'>svg</a> element, it is undefined what 275 * behavior this attribute has.</p> 276 */ 277 public final native float getCurrentScale() /*-{ 278 return this.currentScale; 279 }-*/; 280 /** 281 * On an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 282 * title='svg element specification'>svg</a> element, this attribute indicates 283 * the current scale factor relative to the initial view to take into account 284 * user magnification and panning operations, as described under <a href='interact.html#ZoomAndPanAttribute'>Magnification 285 * and panning</a>. DOM attributes {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentScale()} 286 * and {@link org.vectomatic.dom.svg.impl.SVGSVGElement#getCurrentTranslate()} 287 * are equivalent to the 2x3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y]. 288 * If "magnification" is enabled (i.e., <span class='attr-value'>zoomAndPan="magnify"</span>), 289 * then the effect is as if an extra transformation were placed at the outermost 290 * level on the SVG document fragment (i.e., outside the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 291 * title='svg element specification'>svg</a> element). <p>When accessed on 292 * an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 293 * element specification'>svg</a> element that is not an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 294 * title='svg element specification'>svg</a> element, it is undefined what 295 * behavior this attribute has.</p> 296 */ 297 public final native void setCurrentScale(float value) /*-{ 298 this.currentScale = value; 299 }-*/; 300 /** 301 * On an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 302 * title='svg element specification'>svg</a> element, the corresponding translation 303 * factor that takes into account user "magnification". <p>When accessed on 304 * an <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 305 * element specification'>svg</a> element that is not an outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 306 * title='svg element specification'>svg</a> element, it is undefined what 307 * behavior this attribute has.</p> 308 */ 309 public final native OMSVGPoint getCurrentTranslate() /*-{ 310 return this.currentTranslate; 311 }-*/; 312 /** 313 * Takes a time-out value which indicates that redraw shall not occur until: 314 * <ol> <li>the corresponding unsuspendRedraw() call has been made,</li> 315 * <li>an unsuspendRedrawAll() call has been made, or</li> <li>its timer 316 * has timed out.</li> </ol> <p>In environments that do not support interactivity 317 * (e.g., print media), then redraw shall not be suspended. Calls to suspendRedraw() 318 * and unsuspendRedraw() should, but need not be, made in balanced pairs.</p> 319 * <p>To suspend redraw actions as a collection of SVG DOM changes occur, 320 * precede the changes to the SVG DOM with a method call similar to:</p> <pre>suspendHandleID 321 * = suspendRedraw(maxWaitMilliseconds);</pre> <p>and follow the changes with 322 * a method call similar to:</p> <pre>unsuspendRedraw(suspendHandleID);</pre> 323 * <p>Note that multiple suspendRedraw calls can be used at once and that 324 * each such method call is treated independently of the other suspendRedraw 325 * method calls.</p> 326 * @param maxWaitMilliseconds The amount of time in milliseconds to hold 327 * off before redrawing the device. Values greater than 60 seconds will 328 * be truncated down to 60 seconds. 329 * @return A number which acts as a unique identifier for the given suspendRedraw() 330 * call. This value must be passed as the parameter to the corresponding 331 * unsuspendRedraw() method call. 332 */ 333 public final native int suspendRedraw(int maxWaitMilliseconds) /*-{ 334 return this.suspendRedraw(maxWaitMilliseconds); 335 }-*/; 336 /** 337 * Cancels a specified suspendRedraw() by providing a unique suspend handle 338 * ID that was returned by a previous suspendRedraw() call. 339 * @param suspendHandleID A number which acts as a unique identifier for 340 * the desired suspendRedraw() call. The number supplied must be a value 341 * returned from a previous call to suspendRedraw(). If an invalid handle 342 * ID value is provided then the request to unsuspendRedraw() is silently 343 * ignored. 344 */ 345 public final native void unsuspendRedraw(int suspendHandleID) /*-{ 346 this.unsuspendRedraw(suspendHandleID); 347 }-*/; 348 /** 349 * Cancels all currently active suspendRedraw() method calls. This method 350 * is most useful at the very end of a set of SVG DOM calls to ensure that 351 * all pending suspendRedraw() method calls have been cancelled. 352 */ 353 public final native void unsuspendRedrawAll() /*-{ 354 this.unsuspendRedrawAll(); 355 }-*/; 356 /** 357 * In rendering environments supporting interactivity, forces the user agent 358 * to immediately redraw all regions of the viewport that require updating. 359 */ 360 public final native void forceRedraw() /*-{ 361 this.forceRedraw(); 362 }-*/; 363 /** 364 * Suspends (i.e., pauses) all currently running animations that are defined 365 * within the SVG document fragment corresponding to this <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 366 * title='svg element specification'>svg</a> element, causing the animation 367 * clock corresponding to this document fragment to stand still until it is 368 * unpaused. 369 */ 370 public final native void pauseAnimations() /*-{ 371 this.pauseAnimations(); 372 }-*/; 373 /** 374 * Unsuspends (i.e., unpauses) currently running animations that are defined 375 * within the SVG document fragment, causing the animation clock to continue 376 * from the time at which it was suspended. 377 */ 378 public final native void unpauseAnimations() /*-{ 379 this.unpauseAnimations(); 380 }-*/; 381 /** 382 * Returns true if this SVG document fragment is in a paused state. 383 * @return Boolean indicating whether this SVG document fragment is in a 384 * paused state. 385 */ 386 public final native boolean animationsPaused() /*-{ 387 return this.animationsPaused(); 388 }-*/; 389 /** 390 * Returns the current time in seconds relative to the start time for the 391 * current SVG document fragment. If <span class="dom-method-name">getCurrentTime</span> 392 * is called before the document timeline has begun (for example, by script 393 * running in a <a href='http://www.w3.org/TR/SVG11/script.html#ScriptElement' 394 * title='script element specification'>script</a> element before the document's 395 * <a href="interact.html#LoadEvent">SVGLoad</a> event is dispatched), then 396 * 0 is returned. 397 * @return The current time in seconds, or 0 if the document timeline has 398 * not yet begun. 399 */ 400 public final native float getCurrentTime() /*-{ 401 return this.getCurrentTime(); 402 }-*/; 403 /** 404 * Adjusts the clock for this SVG document fragment, establishing a new current 405 * time. If <span class="dom-method-name">setCurrentTime</span> is called 406 * before the document timeline has begun (for example, by script running 407 * in a <a href='http://www.w3.org/TR/SVG11/script.html#ScriptElement' title='script 408 * element specification'>script</a> element before the document's <a href="interact.html#LoadEvent">SVGLoad</a> 409 * event is dispatched), then the value of <var>seconds</var> in the last 410 * invocation of the method gives the time that the document will seek to 411 * once the document timeline has begun. 412 * @param seconds The new current time in seconds relative to the start 413 * time for the current SVG document fragment. 414 */ 415 public final native void setCurrentTime(float seconds) /*-{ 416 this.setCurrentTime(seconds); 417 }-*/; 418 /** 419 * Returns the list of graphics elements whose rendered content intersects 420 * the supplied rectangle. Each candidate graphics element is to be considered 421 * a match only if the same graphics element can be a <a href="interact.html#PointerEventsProperty">target 422 * of pointer events</a> as defined in <code>pointer-events</code> processing. 423 * @param rect The test rectangle. The values are in the <code>initial coordinate 424 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 425 * title='svg element specification'>svg</a> element. 426 * @param referenceElement If not null, then any intersected element that 427 * doesn't have the referenceElement as ancestor must not be included in 428 * the returned NodeList. 429 * @return A list of Elements whose content intersects the supplied rectangle. 430 * This {@link com.google.gwt.dom.client.NodeList} must be implemented identically 431 * to the {@link com.google.gwt.dom.client.NodeList} interface as defined 432 * in DOM Level 2 Core ([<a href="refs.html#ref-DOM2">DOM2</a>], section 433 * 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>. 434 */ 435 public final native NodeList<? extends Node> getIntersectionList(OMSVGRect rect, SVGElement referenceElement) /*-{ 436 return this.getIntersectionList(rect, referenceElement); 437 }-*/; 438 /** 439 * Returns the list of graphics elements whose rendered content is entirely 440 * contained within the supplied rectangle. Each candidate graphics element 441 * is to be considered a match only if the same graphics element can be a 442 * <a href="interact.html#PointerEventsProperty">target of pointer events</a> 443 * as defined in <code>pointer-events</code> processing. 444 * @param rect The test rectangle. The values are in the <code>initial coordinate 445 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 446 * title='svg element specification'>svg</a> element. 447 * @param referenceElement If not null, then any intersected element that 448 * doesn't have the referenceElement as ancestor must not be included in 449 * the returned NodeList. 450 * @return A list of Elements whose content is enclosed by the supplied 451 * rectangle. This {@link com.google.gwt.dom.client.NodeList} must be implemented 452 * identically to the {@link com.google.gwt.dom.client.NodeList} interface 453 * as defined in DOM Level 2 Core ([<a href="refs.html#ref-DOM2">DOM2</a>], 454 * 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>. 455 */ 456 public final native NodeList<? extends Node> getEnclosureList(OMSVGRect rect, SVGElement referenceElement) /*-{ 457 return this.getEnclosureList(rect, referenceElement); 458 }-*/; 459 /** 460 * Returns true if the rendered content of the given element intersects the 461 * supplied rectangle. Each candidate graphics element is to be considered 462 * a match only if the same graphics element can be a <a href="interact.html#PointerEventsProperty">target 463 * of pointer events</a> as defined in <code>pointer-events</code> processing. 464 * @param element The element on which to perform the given test. 465 * @param rect The test rectangle. The values are in the <code>initial coordinate 466 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 467 * title='svg element specification'>svg</a> element. 468 * @return True or false, depending on whether the given element intersects 469 * the supplied rectangle. 470 */ 471 public final native boolean checkIntersection(SVGElement element, OMSVGRect rect) /*-{ 472 return this.checkIntersection(element, rect); 473 }-*/; 474 /** 475 * Returns true if the rendered content of the given element is entirely contained 476 * within the supplied rectangle. Each candidate graphics element is to be 477 * considered a match only if the same graphics element can be a <a href="interact.html#PointerEventsProperty">target 478 * of pointer events</a> as defined in <code>pointer-events</code> processing. 479 * @param element The element on which to perform the given test. 480 * @param rect The test rectangle. The values are in the <code>initial coordinate 481 * system</code> for the current <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 482 * title='svg element specification'>svg</a> element. 483 * @return True or false, depending on whether the given element is enclosed 484 * by the supplied rectangle. 485 */ 486 public final native boolean checkEnclosure(SVGElement element, OMSVGRect rect) /*-{ 487 return this.checkEnclosure(element, rect); 488 }-*/; 489 /** 490 * Unselects any selected objects, including any selections of text strings 491 * and type-in bars. 492 */ 493 public final native void deselectAll() /*-{ 494 this.deselectAll(); 495 }-*/; 496 /** 497 * Creates an {@link org.vectomatic.dom.svg.OMSVGNumber} object outside of 498 * any document trees. The object is initialized to a value of zero. 499 * @return An {@link org.vectomatic.dom.svg.OMSVGNumber} object. 500 */ 501 public final native OMSVGNumber createSVGNumber() /*-{ 502 return this.createSVGNumber(); 503 }-*/; 504 /** 505 * Creates an {@link org.vectomatic.dom.svg.OMSVGLength} object outside of 506 * any document trees. The object is initialized to the value of 0 user units. 507 * @return An {@link org.vectomatic.dom.svg.OMSVGLength} object. 508 */ 509 public final native OMSVGLength createSVGLength() /*-{ 510 return this.createSVGLength(); 511 }-*/; 512 /** 513 * Creates an {@link org.vectomatic.dom.svg.OMSVGAngle} object outside of 514 * any document trees. The object is initialized to the value 0 degrees (unitless). 515 * @return An {@link org.vectomatic.dom.svg.OMSVGAngle} object. 516 */ 517 public final native OMSVGAngle createSVGAngle() /*-{ 518 return this.createSVGAngle(); 519 }-*/; 520 /** 521 * Creates an {@link org.vectomatic.dom.svg.OMSVGPoint} object outside of 522 * any document trees. The object is initialized to the point (0,0) in the 523 * user coordinate system. 524 * @return An {@link org.vectomatic.dom.svg.OMSVGPoint} object. 525 */ 526 public final native OMSVGPoint createSVGPoint() /*-{ 527 return this.createSVGPoint(); 528 }-*/; 529 /** 530 * Creates an {@link org.vectomatic.dom.svg.OMSVGMatrix} object outside of 531 * any document trees. The object is initialized to the identity matrix. 532 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object. 533 */ 534 public final native OMSVGMatrix createSVGMatrix() /*-{ 535 return this.createSVGMatrix(); 536 }-*/; 537 /** 538 * Creates an {@link org.vectomatic.dom.svg.OMSVGRect} object outside of any 539 * document trees. The object is initialized such that all values are set 540 * to 0 user units. 541 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object. 542 */ 543 public final native OMSVGRect createSVGRect() /*-{ 544 return this.createSVGRect(); 545 }-*/; 546 /** 547 * Creates an {@link org.vectomatic.dom.svg.OMSVGTransform} object outside 548 * of any document trees. The object is initialized to an identity matrix 549 * transform (SVG_TRANSFORM_MATRIX). 550 * @return An {@link org.vectomatic.dom.svg.OMSVGTransform} object. 551 */ 552 public final native OMSVGTransform createSVGTransform() /*-{ 553 return this.createSVGTransform(); 554 }-*/; 555 /** 556 * <p xmlns:edit="http://xmlns.grorg.org/SVGT12NG/"> Creates an {@link org.vectomatic.dom.svg.OMSVGTransform} 557 * object outside of any document trees. The object is initialized to the 558 * given matrix transform (i.e., SVG_TRANSFORM_MATRIX). The values from the 559 * parameter <var>matrix</var> are copied, the <var>matrix</var> parameter 560 * is not adopted as <a edit:format="expanded">SVGTransform::matrix</a>. </p> 561 * @param matrix The transform matrix. 562 * @return An {@link org.vectomatic.dom.svg.OMSVGTransform} object. 563 */ 564 public final native OMSVGTransform createSVGTransformFromMatrix(OMSVGMatrix matrix) /*-{ 565 return this.createSVGTransformFromMatrix(matrix); 566 }-*/; 567 /** 568 * Searches this SVG document fragment (i.e., the search is restricted to 569 * a subset of the document tree) for an Element whose id is given by <var>elementId</var>. 570 * If an Element is found, that Element is returned. If no such element exists, 571 * returns null. Behavior is not defined if more than one element has this 572 * id. 573 * @param elementId The unique id value for an element. 574 * @return The matching element. 575 */ 576 public final native Element getElementById(String elementId) /*-{ 577 return this.getElementById(elementId); 578 }-*/; 579 580 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface 581 /** 582 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 583 * on the given element. Note that the SVG DOM defines the attribute {@link 584 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 585 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas 586 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 587 * is not animated. Because the SVG language definition states that {@link 588 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 589 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()} 590 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}. 591 */ 592 public final native OMSVGAnimatedBoolean getExternalResourcesRequired() /*-{ 593 return this.externalResourcesRequired; 594 }-*/; 595 596 // Implementation of the svg::SVGFitToViewBox W3C IDL interface 597 /** 598 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()} 599 * on the given element. 600 */ 601 public final native OMSVGAnimatedRect getViewBox() /*-{ 602 return this.viewBox; 603 }-*/; 604 /** 605 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()} 606 * on the given element. 607 */ 608 public final native OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio() /*-{ 609 return this.preserveAspectRatio; 610 }-*/; 611 612 // Implementation of the svg::SVGLangSpace W3C IDL interface 613 /** 614 * Corresponds to attribute <code>xml:lang</code> on the given element. 615 */ 616 public final native String getXmllang() /*-{ 617 return this.xmllang; 618 }-*/; 619 /** 620 * Corresponds to attribute <code>xml:lang</code> on the given element. 621 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 622 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 623 * attribute</a>. 624 */ 625 public final native void setXmllang(String value) throws JavaScriptException /*-{ 626 this.xmllang = value; 627 }-*/; 628 /** 629 * Corresponds to attribute <code>xml:space</code> on the given element. 630 */ 631 public final native String getXmlspace() /*-{ 632 return this.xmlspace; 633 }-*/; 634 /** 635 * Corresponds to attribute <code>xml:space</code> on the given element. 636 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 637 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 638 * attribute</a>. 639 */ 640 public final native void setXmlspace(String value) throws JavaScriptException /*-{ 641 this.xmlspace = value; 642 }-*/; 643 644 // Implementation of the svg::SVGLocatable W3C IDL interface 645 /** 646 * The element which established the current viewport. Often, the nearest 647 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 648 * element specification'>svg</a> element. Null if the current element is 649 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 650 * title='svg element specification'>svg</a> element. 651 */ 652 public final native SVGElement getNearestViewportElement() /*-{ 653 return this.nearestViewportElement; 654 }-*/; 655 /** 656 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 657 * title='svg element specification'>svg</a> element. Null if the current 658 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 659 * title='svg element specification'>svg</a> element. 660 */ 661 public final native SVGElement getFarthestViewportElement() /*-{ 662 return this.farthestViewportElement; 663 }-*/; 664 /** 665 * Returns the tight bounding box in current user space (i.e., after application 666 * of the <code>transform</code> attribute, if any) on the geometry of all 667 * contained graphics elements, exclusive of stroking, clipping, masking and 668 * filter effects). Note that getBBox must return the actual bounding box 669 * at the time the method was called, even in case the element has not yet 670 * been rendered. 671 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines 672 * the bounding box. 673 */ 674 public final native OMSVGRect getBBox() /*-{ 675 return this.getBBox(); 676 }-*/; 677 /** 678 * Returns the transformation matrix from current user units (i.e., after 679 * application of the <code>transform</code> attribute, if any) to the viewport 680 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}. 681 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 682 * the CTM. 683 */ 684 public final native OMSVGMatrix getCTM() /*-{ 685 return this.getCTM(); 686 }-*/; 687 /** 688 * Returns the transformation matrix from current user units (i.e., after 689 * application of the <code>transform</code> attribute, if any) to the parent 690 * user agent's notice of a "pixel". For display devices, ideally this represents 691 * a physical screen pixel. For other devices or environments where physical 692 * pixel sizes are not known, then an algorithm similar to the CSS2 definition 693 * of a "pixel" can be used instead. Note that null is returned if this element 694 * is not hooked into the document tree. This method would have been more 695 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code> 696 * is kept for historical reasons. 697 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 698 * the given transformation matrix. 699 */ 700 public final native OMSVGMatrix getScreenCTM() /*-{ 701 return this.getScreenCTM(); 702 }-*/; 703 /** 704 * Returns the transformation matrix from the user coordinate system on the 705 * current element (after application of the <code>transform</code> attribute, 706 * if any) to the user coordinate system on parameter <var>element</var> (after 707 * application of its <code>transform</code> attribute, if any). 708 * @param element The target element. 709 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 710 * the transformation. 711 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently 712 * defined transformation matrices make it impossible to compute the given 713 * matrix (e.g., because one of the transformations is singular). 714 */ 715 public final native OMSVGMatrix getTransformToElement(SVGElement element) throws JavaScriptException /*-{ 716 return this.getTransformToElement(element); 717 }-*/; 718 719 // Implementation of the svg::SVGTests W3C IDL interface 720 /** 721 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()} 722 * on the given element. 723 */ 724 public final native OMSVGStringList getRequiredFeatures() /*-{ 725 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredFeatures); 726 }-*/; 727 /** 728 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()} 729 * on the given element. 730 */ 731 public final native OMSVGStringList getRequiredExtensions() /*-{ 732 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredExtensions); 733 }-*/; 734 /** 735 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()} 736 * on the given element. 737 */ 738 public final native OMSVGStringList getSystemLanguage() /*-{ 739 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.systemLanguage); 740 }-*/; 741 /** 742 * Returns true if the user agent supports the given extension, specified 743 * by a URI. 744 * @param extension The name of the extension, expressed as a URI. 745 * @return True or false, depending on whether the given extension is supported. 746 */ 747 public final native boolean hasExtension(String extension) /*-{ 748 return this.hasExtension(extension); 749 }-*/; 750 751 // Implementation of the svg::SVGZoomAndPan W3C IDL interface 752 /** 753 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()} 754 * on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants 755 * defined on this interface. 756 */ 757 public final native short getZoomAndPan() /*-{ 758 return this.zoomAndPan; 759 }-*/; 760 /** 761 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()} 762 * on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants 763 * defined on this interface. 764 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 765 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 766 * attribute</a>. 767 */ 768 public final native void setZoomAndPan(short value) throws JavaScriptException /*-{ 769 this.zoomAndPan = value; 770 }-*/; 771 772 }