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.SVGViewElement;
33  import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
34  import org.vectomatic.dom.svg.itf.ISVGFitToViewBox;
35  import org.vectomatic.dom.svg.itf.ISVGZoomAndPan;
36  import org.vectomatic.dom.svg.utils.DOMHelper;
37  import org.vectomatic.dom.svg.utils.SVGConstants;
38  
39  import com.google.gwt.core.client.JavaScriptException;
40  import com.google.gwt.dom.client.TagName;
41  
42  /**
43   * The {@link org.vectomatic.dom.svg.OMSVGAElement} interface corresponds
44   * to the <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement' title='view
45   * element specification'>view</a> element.
46   */
47  @TagName("view")
48  public class OMSVGViewElement extends OMSVGElement implements ISVGExternalResourcesRequired, ISVGFitToViewBox, ISVGZoomAndPan {
49    public OMSVGViewElement() {
50      this((SVGViewElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_VIEW_TAG).cast());
51    }
52  
53    protected OMSVGViewElement(SVGViewElement ot) {
54      super(ot);
55    }
56  
57    // Implementation of the svg::SVGViewElement W3C IDL interface
58    /**
59     * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGViewElement#getViewTarget()}
60     * on the given <a href='http://www.w3.org/TR/SVG11/linking.html#ViewElement'
61     * title='view element specification'>view</a> element. A list of DOMString
62     * values which contain the names listed in the {@link org.vectomatic.dom.svg.OMSVGViewElement#getViewTarget()}
63     * attribute. Each of the DOMString values can be associated with the corresponding
64     * element using the getElementById() method call.
65     */
66    public final OMSVGStringList getViewTarget() {
67      return ((SVGViewElement)ot).getViewTarget();
68    }
69  
70    // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
71    /**
72     * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
73     * on the given element. Note that the SVG DOM defines the attribute {@link
74     * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
75     * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
76     * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
77     * is not animated. Because the SVG language definition states that {@link
78     * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
79     * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
80     * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
81     */
82    public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
83      return ((SVGViewElement)ot).getExternalResourcesRequired();
84    }
85  
86    // Implementation of the svg::SVGFitToViewBox W3C IDL interface
87    /**
88     * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}
89     * on the given element.
90     */
91    public final OMSVGAnimatedRect getViewBox() {
92      return ((SVGViewElement)ot).getViewBox();
93    }
94    /**
95     * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
96     * on the given element.
97     */
98    public final OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
99      return ((SVGViewElement)ot).getPreserveAspectRatio();
100   }
101 
102   // Implementation of the svg::SVGZoomAndPan W3C IDL interface
103   /**
104    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
105    * on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants
106    * defined on this interface.
107    */
108   public final short getZoomAndPan() {
109     return ((SVGViewElement)ot).getZoomAndPan();
110   }
111   /**
112    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGZoomAndPan#getZoomAndPan()}
113    * on the given element. The value must be one of the SVG_ZOOMANDPAN_ constants
114    * defined on this interface.
115    * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an   attempt
116    * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
117    * attribute</a>.
118    */
119   public final void setZoomAndPan(short value) throws JavaScriptException {
120     ((SVGViewElement)ot).setZoomAndPan(value);
121   }
122 
123 }