View Javadoc

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