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