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.OMSVGStringList;
34  
35  import com.google.gwt.core.client.JavaScriptException;
36  
37  /**
38   * <p>The {@link org.vectomatic.dom.svg.impl.SVGAnimationElement} interface
39   * is the base interface for all of the animation element interfaces: {@link
40   * org.vectomatic.dom.svg.impl.SVGAnimateElement}, {@link org.vectomatic.dom.svg.impl.SVGSetElement},
41   * {@link org.vectomatic.dom.svg.impl.SVGAnimateColorElement}, {@link org.vectomatic.dom.svg.impl.SVGAnimateMotionElement}
42   * and {@link org.vectomatic.dom.svg.impl.SVGAnimateTransformElement}.</p>
43   * <p>Unlike other SVG DOM interfaces, the SVG DOM does not specify convenience
44   * DOM properties corresponding to the various language attributes on SVG's
45   * animation elements. Specification of these convenience properties in a
46   * way that will be compatible with future versions of SMIL Animation is expected
47   * in a future version of SVG. The current method for accessing and modifying
48   * the attributes on the animation elements is to use the standard <code>getAttribute</code>,
49   * <code>setAttribute</code>, <code>getAttributeNS</code> and <code>setAttributeNS</code>
50   * defined in <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/">DOM
51   * Level 2 Core</a> [<a href="refs.html#ref-DOM2">DOM2</a>].</p>
52   */
53  public class SVGAnimationElement extends SVGElement {
54    protected SVGAnimationElement() {
55    }
56  
57    // Implementation of the svg::SVGAnimationElement W3C IDL interface
58    /**
59     * The element which is being animated.
60     */
61    public final native SVGElement getTargetElement() /*-{
62      return this.targetElement;
63    }-*/;
64    /**
65     * Returns the begin time, in seconds, for this animation element's current
66     * interval, if it exists, regardless of whether the interval has begun yet.
67     * If there is no current interval, then a DOMException with code INVALID_STATE_ERR
68     * is thrown.
69     * @return The start time, in seconds, of this animation element's current
70     * interval.
71     * @throws DOMException(INVALID_STATE_ERR) The animation element does not
72     * have a current interval.
73     */
74    public final native float getStartTime() throws JavaScriptException /*-{
75      return this.getStartTime();
76    }-*/;
77    /**
78     * Returns the current time in seconds relative to time zero for the given
79     * time container.
80     * @return The current time in seconds relative to time zero for the given
81     * time container.
82     */
83    public final native float getCurrentTime() /*-{
84      return this.getCurrentTime();
85    }-*/;
86    /**
87     * Returns the number of seconds for the simple duration for this animation.
88     * If the simple duration is undefined (e.g., the end time is indefinite),
89     * then an exception is raised.
90     * @return number of seconds for the simple duration for this animation.
91     * @throws DOMException(NOT_SUPPORTED_ERR) The simple duration is not   determined
92     * on the given element.
93     */
94    public final native float getSimpleDuration() throws JavaScriptException /*-{
95      return this.getSimpleDuration();
96    }-*/;
97  
98    // Implementation of the smil::ElementTimeControl W3C IDL interface
99    /**
100    * Creates a begin instance time for the current time. The new instance time
101    * is added to the <a href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-InstanceTimesLists"><em>begin
102    * instance times list</em></a>. The behavior of this method is equivalent
103    * to <code>beginElementAt(0)</code>.
104    */
105   public final native void beginElement() /*-{
106     this.beginElement();
107   }-*/;
108   /**
109    * Creates a begin instance time for the current time plus the specified offset.
110    * The new instance time is added to the <a href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-InstanceTimesLists"><em>begin
111    * instance times list</em></a>.
112    * @param offset The offset from the current document time, in seconds, at
113    * which to begin the element.
114    */
115   public final native void beginElementAt(float offset) /*-{
116     this.beginElementAt(offset);
117   }-*/;
118   /**
119    * Creates an end instance time for the current time. The new instance time
120    * is added to the <a href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-InstanceTimesLists"><em>end
121    * instance times list</em></a>. The behavior of this method is equivalent
122    * to <code>endElementAt(0)</code>.
123    */
124   public final native void endElement() /*-{
125     this.endElement();
126   }-*/;
127   /**
128    * Creates a end instance time for the current time plus the specified offset.
129    * The new instance time is added to the <a href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-InstanceTimesLists"><em>end
130    * instance times list</em></a>.
131    * @param offset offset from the current document time, in seconds, at   which
132    * to end the element.
133    */
134   public final native void endElementAt(float offset) /*-{
135     this.endElementAt(offset);
136   }-*/;
137 
138   // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
139   /**
140    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
141    * on the given element. Note that the SVG DOM defines the attribute {@link
142    * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
143    * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
144    * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
145    * is not animated. Because the SVG language definition states that {@link
146    * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
147    * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
148    * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
149    */
150   public final native OMSVGAnimatedBoolean getExternalResourcesRequired() /*-{
151     return this.externalResourcesRequired;
152   }-*/;
153 
154   // Implementation of the svg::SVGTests W3C IDL interface
155   /**
156    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()}
157    * on the given element.
158    */
159   public final native OMSVGStringList getRequiredFeatures() /*-{
160     return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredFeatures);
161   }-*/;
162   /**
163    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()}
164    * on the given element.
165    */
166   public final native OMSVGStringList getRequiredExtensions() /*-{
167     return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.requiredExtensions);
168   }-*/;
169   /**
170    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()}
171    * on the given element.
172    */
173   public final native OMSVGStringList getSystemLanguage() /*-{
174     return @org.vectomatic.dom.svg.OMNode::convertList(Lcom/google/gwt/core/client/JavaScriptObject;)(this.systemLanguage);
175   }-*/;
176   /**
177    * Returns true if the user agent supports the given extension, specified
178    * by a URI.
179    * @param extension The name of the extension, expressed as a URI.
180    * @return True or false, depending on whether the given extension is   supported.
181    */
182   public final native boolean hasExtension(String extension) /*-{
183     return this.hasExtension(extension);
184   }-*/;
185 
186 }