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.SVGMarkerElement;
33 import org.vectomatic.dom.svg.itf.ISVGContainerElement;
34 import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
35 import org.vectomatic.dom.svg.itf.ISVGFitToViewBox;
36 import org.vectomatic.dom.svg.itf.ISVGLangSpace;
37 import org.vectomatic.dom.svg.itf.ISVGStylable;
38 import org.vectomatic.dom.svg.utils.DOMHelper;
39 import org.vectomatic.dom.svg.utils.SVGConstants;
40
41 import com.google.gwt.core.client.JavaScriptException;
42 import com.google.gwt.dom.client.TagName;
43
44 /**
45 * The {@link org.vectomatic.dom.svg.OMSVGMarkerElement} interface corresponds
46 * to the <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
47 * title='marker element specification'>marker</a> element.
48 */
49 @TagName("marker")
50 public class OMSVGMarkerElement extends OMSVGElement implements ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGFitToViewBox, ISVGContainerElement {
51 /**
52 * The marker unit type is not one of predefined types. It is invalid to attempt
53 * to define a new value of this type or to attempt to switch an existing
54 * value to this type.
55 */
56 public static final short SVG_MARKERUNITS_UNKNOWN = 0;
57 /**
58 * The value of attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getMarkerUnits()}
59 * is <span class='attr-value'>'userSpaceOnUse'</span>.
60 */
61 public static final short SVG_MARKERUNITS_USERSPACEONUSE = 1;
62 /**
63 * The value of attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getMarkerUnits()}
64 * is <span class='attr-value'>'strokeWidth'</span>.
65 */
66 public static final short SVG_MARKERUNITS_STROKEWIDTH = 2;
67 /**
68 * The marker orientation is not one of predefined types. It is invalid to
69 * attempt to define a new value of this type or to attempt to switch an existing
70 * value to this type.
71 */
72 public static final short SVG_MARKER_ORIENT_UNKNOWN = 0;
73 /**
74 * Attribute <code>orient</code> has value <span class='attr-value'>'auto'</span>.
75 */
76 public static final short SVG_MARKER_ORIENT_AUTO = 1;
77 /**
78 * Attribute <code>orient</code> has an angle value.
79 */
80 public static final short SVG_MARKER_ORIENT_ANGLE = 2;
81 public OMSVGMarkerElement() {
82 this((SVGMarkerElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_MARKER_TAG).cast());
83 }
84
85 protected OMSVGMarkerElement(SVGMarkerElement ot) {
86 super(ot);
87 }
88
89 // Implementation of the svg::SVGMarkerElement W3C IDL interface
90 /**
91 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getRefX()}
92 * on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
93 * title='marker element specification'>marker</a> element.
94 */
95 public final OMSVGAnimatedLength getRefX() {
96 return ((SVGMarkerElement)ot).getRefX();
97 }
98 /**
99 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getRefY()}
100 * on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
101 * title='marker element specification'>marker</a> element.
102 */
103 public final OMSVGAnimatedLength getRefY() {
104 return ((SVGMarkerElement)ot).getRefY();
105 }
106 /**
107 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getMarkerUnits()}
108 * on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
109 * title='marker element specification'>marker</a> element. One of the Marker
110 * Unit Types defined on this interface.
111 */
112 public final OMSVGAnimatedEnumeration getMarkerUnits() {
113 return ((SVGMarkerElement)ot).getMarkerUnits();
114 }
115 /**
116 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getMarkerWidth()}
117 * on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
118 * title='marker element specification'>marker</a> element.
119 */
120 public final OMSVGAnimatedLength getMarkerWidth() {
121 return ((SVGMarkerElement)ot).getMarkerWidth();
122 }
123 /**
124 * Corresponds to attribute {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getMarkerHeight()}
125 * on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
126 * title='marker element specification'>marker</a> element.
127 */
128 public final OMSVGAnimatedLength getMarkerHeight() {
129 return ((SVGMarkerElement)ot).getMarkerHeight();
130 }
131 /**
132 * Corresponds to attribute <code>orient</code> on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
133 * title='marker element specification'>marker</a> element. One of the Marker
134 * Orientation Types defined on this interface.
135 */
136 public final OMSVGAnimatedEnumeration getOrientType() {
137 return ((SVGMarkerElement)ot).getOrientType();
138 }
139 /**
140 * Corresponds to attribute <code>orient</code> on the given <a href='http://www.w3.org/TR/SVG11/painting.html#MarkerElement'
141 * title='marker element specification'>marker</a> element. If {@link org.vectomatic.dom.svg.OMSVGMarkerElement#getMarkerUnits()}
142 * is SVG_MARKER_ORIENT_ANGLE, the angle value for attribute <code>orient</code>;
143 * otherwise, it will be set to zero.
144 */
145 public final OMSVGAnimatedAngle getOrientAngle() {
146 return ((SVGMarkerElement)ot).getOrientAngle();
147 }
148 /**
149 * Sets the value of attribute <code>orient</code> to <span class='attr-value'>'auto'</span>.
150 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
151 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
152 * attribute</a>.
153 */
154 public final void setOrientToAuto() throws JavaScriptException {
155 ((SVGMarkerElement)ot).setOrientToAuto();
156 }
157 /**
158 * Sets the value of attribute <code>orient</code> to the given angle.
159 * @param angle The angle value to use for attribute <code>orient</code>.
160 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
161 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
162 * attribute</a>.
163 */
164 public final void setOrientToAngle(OMSVGAngle angle) throws JavaScriptException {
165 ((SVGMarkerElement)ot).setOrientToAngle(angle);
166 }
167
168 // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
169 /**
170 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
171 * on the given element. Note that the SVG DOM defines the attribute {@link
172 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
173 * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
174 * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
175 * is not animated. Because the SVG language definition states that {@link
176 * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
177 * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
178 * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
179 */
180 public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
181 return ((SVGMarkerElement)ot).getExternalResourcesRequired();
182 }
183
184 // Implementation of the svg::SVGFitToViewBox W3C IDL interface
185 /**
186 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}
187 * on the given element.
188 */
189 public final OMSVGAnimatedRect getViewBox() {
190 return ((SVGMarkerElement)ot).getViewBox();
191 }
192 /**
193 * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
194 * on the given element.
195 */
196 public final OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
197 return ((SVGMarkerElement)ot).getPreserveAspectRatio();
198 }
199
200 // Implementation of the svg::SVGLangSpace W3C IDL interface
201 /**
202 * Corresponds to attribute <code>xml:lang</code> on the given element.
203 */
204 public final String getXmllang() {
205 return ((SVGMarkerElement)ot).getXmllang();
206 }
207 /**
208 * Corresponds to attribute <code>xml:lang</code> on the given element.
209 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
210 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
211 * attribute</a>.
212 */
213 public final void setXmllang(java.lang.String value) throws JavaScriptException {
214 ((SVGMarkerElement)ot).setXmllang(value);
215 }
216 /**
217 * Corresponds to attribute <code>xml:space</code> on the given element.
218 */
219 public final String getXmlspace() {
220 return ((SVGMarkerElement)ot).getXmlspace();
221 }
222 /**
223 * Corresponds to attribute <code>xml:space</code> on the given element.
224 * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an attempt
225 * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
226 * attribute</a>.
227 */
228 public final void setXmlspace(java.lang.String value) throws JavaScriptException {
229 ((SVGMarkerElement)ot).setXmlspace(value);
230 }
231
232 }