001/**********************************************
002 * Copyright (C) 2010 Lukas Laag
003 * This file is part of lib-gwt-svg.
004 * 
005 * libgwtsvg is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Lesser General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 * 
010 * libgwtsvg is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public License
016 * along with libgwtsvg.  If not, see http://www.gnu.org/licenses/
017 **********************************************/
018/*
019 * Copyright (c) 2004 World Wide Web Consortium,
020 *
021 * (Massachusetts Institute of Technology, European Research Consortium for
022 * Informatics and Mathematics, Keio University). All Rights Reserved. This
023 * work is distributed under the W3C(r) Software License [1] in the hope that
024 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
025 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
026 *
027 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
028 */
029
030package org.vectomatic.dom.svg;
031
032import org.vectomatic.dom.svg.impl.SVGClipPathElement;
033import org.vectomatic.dom.svg.impl.SVGElement;
034import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
035import org.vectomatic.dom.svg.itf.ISVGLangSpace;
036import org.vectomatic.dom.svg.itf.ISVGStylable;
037import org.vectomatic.dom.svg.itf.ISVGTests;
038import org.vectomatic.dom.svg.itf.ISVGTransformable;
039import org.vectomatic.dom.svg.itf.ISVGUnitTypes;
040import org.vectomatic.dom.svg.utils.DOMHelper;
041import org.vectomatic.dom.svg.utils.SVGConstants;
042
043import com.google.gwt.core.client.JavaScriptException;
044import com.google.gwt.dom.client.TagName;
045
046/**
047 * The {@link org.vectomatic.dom.svg.OMSVGClipPathElement} interface corresponds
048 * to the <a href='http://www.w3.org/TR/SVG11/masking.html#ClipPathElement'
049 * title='clipPath element specification'>clipPath</a> element.
050 */
051@TagName("clipPath")
052public class OMSVGClipPathElement extends OMSVGElement implements ISVGTests, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGTransformable, ISVGUnitTypes {
053  public OMSVGClipPathElement() {
054    this((SVGClipPathElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_CLIP_PATH_TAG).cast());
055  }
056
057  protected OMSVGClipPathElement(SVGClipPathElement ot) {
058    super(ot);
059  }
060
061  // Implementation of the svg::SVGClipPathElement W3C IDL interface
062  /**
063   * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGClipPathElement#getClipPathUnits()}
064   * on the given <a href='http://www.w3.org/TR/SVG11/masking.html#ClipPathElement'
065   * title='clipPath element specification'>clipPath</a> element.  Takes one
066   * of the constants defined in {@link org.vectomatic.dom.svg.itf.ISVGUnitTypes}.
067   */
068  public final OMSVGAnimatedEnumeration getClipPathUnits() {
069    return ((SVGClipPathElement)ot).getClipPathUnits();
070  }
071
072  // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
073  /**
074   * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
075   * on the given element. Note that the SVG DOM defines the attribute {@link
076   * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
077   * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
078   * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
079   * is not animated. Because the SVG language definition states that {@link
080   * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
081   * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
082   * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
083   */
084  public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
085    return ((SVGClipPathElement)ot).getExternalResourcesRequired();
086  }
087
088  // Implementation of the svg::SVGLangSpace W3C IDL interface
089  /**
090   * Corresponds to attribute <code>xml:lang</code> on the given element.
091   */
092  public final String getXmllang() {
093    return ((SVGClipPathElement)ot).getXmllang();
094  }
095  /**
096   * Corresponds to attribute <code>xml:lang</code> on the given element.
097   * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an   attempt
098   * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
099   * 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    SVGElement elt = ((SVGClipPathElement)ot).getNearestViewportElement();
130    return elt != null ? (OMSVGElement)convert(elt) : null;
131  }
132  /**
133   * The farthest ancestor <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
134   * title='svg element specification'>svg</a> element. Null if the current
135   * element is the outermost <a href='http://www.w3.org/TR/SVG11/struct.html#SVGElement'
136   * title='svg element specification'>svg</a> element.
137   */
138  public final OMSVGElement getFarthestViewportElement() {
139    SVGElement elt = ((SVGClipPathElement)ot).getFarthestViewportElement();
140    return elt != null ? (OMSVGElement)convert(elt) : null;
141  }
142  /**
143   * Returns the tight bounding box in current user space (i.e., after application
144   * of the <code>transform</code> attribute, if any) on the geometry of all
145   * contained graphics elements, exclusive of stroking, clipping, masking and
146   * filter effects). Note that getBBox must return the actual bounding box
147   * at the time the method was called, even in case the element has not yet
148   * been rendered.
149   * @return An {@link org.vectomatic.dom.svg.OMSVGRect} object that defines
150   * the bounding box.
151   */
152  public final OMSVGRect getBBox() {
153    return ((SVGClipPathElement)ot).getBBox();
154  }
155  /**
156   * Returns the transformation matrix from current user units (i.e., after
157   * application of the <code>transform</code> attribute, if any) to the viewport
158   * coordinate system for the {@link org.vectomatic.dom.svg.itf.ISVGLocatable#getNearestViewportElement()}.
159   * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
160   * the CTM.
161   */
162  public final OMSVGMatrix getCTM() {
163    return ((SVGClipPathElement)ot).getCTM();
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 parent
168   * user agent's notice of a "pixel". For display devices, ideally this represents
169   * a physical screen pixel. For other devices or environments where physical
170   * pixel sizes are not known, then an algorithm similar to the CSS2 definition
171   * of a "pixel" can be used instead.  Note that null is returned if this element
172   * is not hooked into the document tree. This method would have been more
173   * aptly named as <code>getClientCTM</code>, but the name <code>getScreenCTM</code>
174   * is kept for historical reasons.
175   * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
176   * the given   transformation matrix.
177   */
178  public final OMSVGMatrix getScreenCTM() {
179    return ((SVGClipPathElement)ot).getScreenCTM();
180  }
181  /**
182   * Returns the transformation matrix from the user coordinate system on the
183   * current element (after application of the <code>transform</code> attribute,
184   * if any) to the user coordinate system on parameter <var>element</var> (after
185   * application of its <code>transform</code> attribute, if any).
186   * @param element The target element.
187   * @return An {@link org.vectomatic.dom.svg.OMSVGMatrix} object that defines
188   * the transformation.
189   * @throws SVGException(SVG_MATRIX_NOT_INVERTABLE) Raised if the currently
190   * defined transformation matrices make it impossible to compute the   given
191   * matrix (e.g., because one of the transformations is singular).
192   */
193  public final OMSVGMatrix getTransformToElement(OMSVGElement element) throws JavaScriptException {
194    return ((SVGClipPathElement)ot).getTransformToElement(((SVGElement)element.ot));
195  }
196
197  // Implementation of the svg::SVGTests W3C IDL interface
198  /**
199   * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredFeatures()}
200   * on the given element.
201   */
202  public final OMSVGStringList getRequiredFeatures() {
203    return ((SVGClipPathElement)ot).getRequiredFeatures();
204  }
205  /**
206   * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getRequiredExtensions()}
207   * on the given element.
208   */
209  public final OMSVGStringList getRequiredExtensions() {
210    return ((SVGClipPathElement)ot).getRequiredExtensions();
211  }
212  /**
213   * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTests#getSystemLanguage()}
214   * on the given element.
215   */
216  public final OMSVGStringList getSystemLanguage() {
217    return ((SVGClipPathElement)ot).getSystemLanguage();
218  }
219  /**
220   * Returns true if the user agent supports the given extension, specified
221   * by a URI.
222   * @param extension The name of the extension, expressed as a URI.
223   * @return True or false, depending on whether the given extension is   supported.
224   */
225  public final boolean hasExtension(String extension) {
226    return ((SVGClipPathElement)ot).hasExtension(extension);
227  }
228
229  // Implementation of the svg::SVGTransformable W3C IDL interface
230  /**
231   * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGTransformable#getTransform()}
232   * on the given element.
233   */
234  public final OMSVGAnimatedTransformList getTransform() {
235    return ((SVGClipPathElement)ot).getTransform();
236  }
237
238  // Implementation of the svg::SVGUnitTypes W3C IDL interface
239
240}