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