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