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.OMSVGAnimatedBoolean; 33 import org.vectomatic.dom.svg.OMSVGAnimatedLength; 34 import org.vectomatic.dom.svg.OMSVGAnimatedTransformList; 35 import org.vectomatic.dom.svg.OMSVGMatrix; 36 import org.vectomatic.dom.svg.OMSVGRect; 37 import org.vectomatic.dom.svg.OMSVGStringList; 38 39 import com.google.gwt.core.client.JavaScriptException; 40 41 /** 42 * The {@link org.vectomatic.dom.svg.impl.SVGRectElement} interface corresponds 43 * to the <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' title='rect 44 * element specification'>rect</a> element. 45 */ 46 public class SVGRectElement extends SVGElement { 47 protected SVGRectElement() { 48 } 49 50 // Implementation of the svg::SVGRectElement W3C IDL interface 51 /** 52 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGRectElement#getX()} 53 * on the given <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' 54 * title='rect element specification'>rect</a> element. 55 */ 56 public final native OMSVGAnimatedLength getX() /*-{ 57 return this.x; 58 }-*/; 59 /** 60 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGRectElement#getY()} 61 * on the given <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' 62 * title='rect element specification'>rect</a> element. 63 */ 64 public final native OMSVGAnimatedLength getY() /*-{ 65 return this.y; 66 }-*/; 67 /** 68 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGRectElement#getWidth()} 69 * on the given <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' 70 * title='rect element specification'>rect</a> element. 71 */ 72 public final native OMSVGAnimatedLength getWidth() /*-{ 73 return this.width; 74 }-*/; 75 /** 76 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGRectElement#getHeight()} 77 * on the given <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' 78 * title='rect element specification'>rect</a> element. 79 */ 80 public final native OMSVGAnimatedLength getHeight() /*-{ 81 return this.height; 82 }-*/; 83 /** 84 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGRectElement#getRx()} 85 * on the given <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' 86 * title='rect element specification'>rect</a> element. 87 */ 88 public final native OMSVGAnimatedLength getRx() /*-{ 89 return this.rx; 90 }-*/; 91 /** 92 * Corresponds to attribute {@link org.vectomatic.dom.svg.impl.SVGRectElement#getRy()} 93 * on the given <a href='http://www.w3.org/TR/SVG11/shapes.html#RectElement' 94 * title='rect element specification'>rect</a> element. 95 */ 96 public final native OMSVGAnimatedLength getRy() /*-{ 97 return this.ry; 98 }-*/; 99 100 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface 101 /** 102 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 103 * on the given element. Note that the SVG DOM defines the attribute {@link 104 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 105 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas 106 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 107 * is not animated. Because the SVG language definition states that {@link 108 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()} 109 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()} 110 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}. 111 */ 112 public final native OMSVGAnimatedBoolean getExternalResourcesRequired() /*-{ 113 return this.externalResourcesRequired; 114 }-*/; 115 116 // Implementation of the svg::SVGLangSpace W3C IDL interface 117 /** 118 * Corresponds to attribute <code>xml:lang</code> on the given element. 119 */ 120 public final native String getXmllang() /*-{ 121 return this.xmllang; 122 }-*/; 123 /** 124 * Corresponds to attribute <code>xml:lang</code> on the given element. 125 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 126 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 127 * attribute</a>. 128 */ 129 public final native void setXmllang(String value) throws JavaScriptException /*-{ 130 this.xmllang = value; 131 }-*/; 132 /** 133 * Corresponds to attribute <code>xml:space</code> on the given element. 134 */ 135 public final native String getXmlspace() /*-{ 136 return this.xmlspace; 137 }-*/; 138 /** 139 * Corresponds to attribute <code>xml:space</code> on the given element. 140 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt 141 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only 142 * attribute</a>. 143 */ 144 public final native void setXmlspace(String value) throws JavaScriptException /*-{ 145 this.xmlspace = value; 146 }-*/; 147 148 // Implementation of the svg::SVGLocatable W3C IDL interface 149 /** 150 * The element which established the current viewport. Often, the nearest 151 * ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' title='svg 152 * element specification'>svg</a> element. Null if the current element is 153 * the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 154 * title='svg element specification'>svg</a> element. 155 */ 156 public final native SVGElement getNearestViewportElement() /*-{ 157 return this.nearestViewportElement; 158 }-*/; 159 /** 160 * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 161 * title='svg element specification'>svg</a> element. Null if the current 162 * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement' 163 * title='svg element specification'>svg</a> element. 164 */ 165 public final native SVGElement getFarthestViewportElement() /*-{ 166 return this.farthestViewportElement; 167 }-*/; 168 /** 169 * Returns the tight bounding box in current user space (i.e., after application 170 * of the <code>transform</code> attribute, if any) on the geometry of all 171 * contained graphics elements, exclusive of stroking, clipping, masking and 172 * filter effects). Note that getBBox must return the actual bounding box 173 * at the time the method was called, even in case the element has not yet 174 * been rendered. 175 * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines 176 * the bounding box. 177 */ 178 public final native OMSVGRect getBBox() /*-{ 179 return this.getBBox(); 180 }-*/; 181 /** 182 * Returns the transformation matrix from current user units (i.e., after 183 * application of the <code>transform</code> attribute, if any) to the viewport 184 * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}. 185 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 186 * the CTM. 187 */ 188 public final native OMSVGMatrix getCTM() /*-{ 189 return this.getCTM(); 190 }-*/; 191 /** 192 * Returns the transformation matrix from current user units (i.e., after 193 * application of the <code>transform</code> attribute, if any) to the parent 194 * user agent's notice of a "pixel". For display devices, ideally this represents 195 * a physical screen pixel. For other devices or environments where physical 196 * pixel sizes are not known, then an algorithm similar to the CSS2 definition 197 * of a "pixel" can be used instead. Note that null is returned if this element 198 * is not hooked into the document tree. This method would have been more 199 * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code> 200 * is kept for historical reasons. 201 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 202 * the given transformation matrix. 203 */ 204 public final native OMSVGMatrix getScreenCTM() /*-{ 205 return this.getScreenCTM(); 206 }-*/; 207 /** 208 * Returns the transformation matrix from the user coordinate system on the 209 * current element (after application of the <code>transform</code> attribute, 210 * if any) to the user coordinate system on parameter <var>element</var> (after 211 * application of its <code>transform</code> attribute, if any). 212 * @param element The target element. 213 * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines 214 * the transformation. 215 * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently 216 * defined transformation matrices make it impossible to compute the given 217 * matrix (e.g., because one of the transformations is singular). 218 */ 219 public final native OMSVGMatrix getTransformToElement(SVGElement element) throws JavaScriptException /*-{ 220 return this.getTransformToElement(element); 221 }-*/; 222 223 // Implementation of the svg::SVGTests W3C IDL interface 224 /** 225 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()} 226 * on the given element. 227 */ 228 public final native OMSVGStringList getRequiredFeatures() /*-{ 229 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredFeatures); 230 }-*/; 231 /** 232 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()} 233 * on the given element. 234 */ 235 public final native OMSVGStringList getRequiredExtensions() /*-{ 236 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredExtensions); 237 }-*/; 238 /** 239 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()} 240 * on the given element. 241 */ 242 public final native OMSVGStringList getSystemLanguage() /*-{ 243 return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.systemLanguage); 244 }-*/; 245 /** 246 * Returns true if the user agent supports the given extension, specified 247 * by a URI. 248 * @param extension The name of the extension, expressed as a URI. 249 * @return True or false, depending on whether the given extension is supported. 250 */ 251 public final native boolean hasExtension(String extension) /*-{ 252 return this.hasExtension(extension); 253 }-*/; 254 255 // Implementation of the svg::SVGTransformable W3C IDL interface 256 /** 257 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()} 258 * on the given element. 259 */ 260 public final native OMSVGAnimatedTransformList getTransform() /*-{ 261 return this.transform; 262 }-*/; 263 264 }