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