KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > dom > svg > SVGOMMarkerElement


1 /*
2
3    Copyright 2001-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.dom.svg;
19
20 import org.apache.batik.dom.AbstractDocument;
21 import org.apache.batik.dom.util.XMLSupport;
22 import org.w3c.dom.Node JavaDoc;
23 import org.w3c.dom.svg.SVGAngle;
24 import org.w3c.dom.svg.SVGAnimatedAngle;
25 import org.w3c.dom.svg.SVGAnimatedBoolean;
26 import org.w3c.dom.svg.SVGAnimatedEnumeration;
27 import org.w3c.dom.svg.SVGAnimatedLength;
28 import org.w3c.dom.svg.SVGAnimatedPreserveAspectRatio;
29 import org.w3c.dom.svg.SVGAnimatedRect;
30 import org.w3c.dom.svg.SVGMarkerElement;
31
32 /**
33  * This class implements {@link org.w3c.dom.svg.SVGMarkerElement}.
34  *
35  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
36  * @version $Id: SVGOMMarkerElement.java,v 1.9 2004/09/01 09:35:22 deweese Exp $
37  */

38 public class SVGOMMarkerElement
39     extends SVGStylableElement
40     implements SVGMarkerElement {
41     
42     /**
43      * The attribute initializer.
44      */

45     protected final static AttributeInitializer attributeInitializer;
46     static {
47         attributeInitializer = new AttributeInitializer(1);
48         attributeInitializer.addAttribute(null,
49                                           null,
50                                           SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
51                                           "xMidYMid meet");
52     }
53
54     /**
55      * The units values.
56      */

57     protected final static String JavaDoc[] UNITS_VALUES = {
58         "",
59         SVG_USER_SPACE_ON_USE_VALUE,
60         SVG_STROKE_WIDTH_ATTRIBUTE
61     };
62
63     /**
64      * Creates a new SVGOMMarkerElement object.
65      */

66     protected SVGOMMarkerElement() {
67     }
68
69     /**
70      * Creates a new SVGOMMarkerElement object.
71      * @param prefix The namespace prefix.
72      * @param owner The owner document.
73      */

74     public SVGOMMarkerElement(String JavaDoc prefix, AbstractDocument owner) {
75         super(prefix, owner);
76     }
77
78     /**
79      * <b>DOM</b>: Implements {@link Node#getLocalName()}.
80      */

81     public String JavaDoc getLocalName() {
82         return SVG_MARKER_TAG;
83     }
84
85     /**
86      * <b>DOM</b>: Implements {@link SVGMarkerElement#getRefX()}.
87      */

88     public SVGAnimatedLength getRefX() {
89         return getAnimatedLengthAttribute
90             (null, SVG_REF_X_ATTRIBUTE, SVG_MARKER_REF_X_DEFAULT_VALUE,
91              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
92     }
93
94     /**
95      * <b>DOM</b>: Implements {@link SVGMarkerElement#getRefY()}.
96      */

97     public SVGAnimatedLength getRefY() {
98         return getAnimatedLengthAttribute
99             (null, SVG_REF_Y_ATTRIBUTE, SVG_MARKER_REF_Y_DEFAULT_VALUE,
100              SVGOMAnimatedLength.VERTICAL_LENGTH);
101     }
102
103     /**
104      * <b>DOM</b>: Implements {@link SVGMarkerElement#getMarkerUnits()}.
105      */

106     public SVGAnimatedEnumeration getMarkerUnits() {
107         return getAnimatedEnumerationAttribute
108             (null, SVG_MARKER_UNITS_ATTRIBUTE, UNITS_VALUES,
109              (short)2);
110     }
111
112     /**
113      * <b>DOM</b>: Implements {@link SVGMarkerElement#getMarkerWidth()}.
114      */

115     public SVGAnimatedLength getMarkerWidth() {
116         return getAnimatedLengthAttribute
117             (null, SVG_MARKER_WIDTH_ATTRIBUTE,
118              SVG_MARKER_MARKER_WIDTH_DEFAULT_VALUE,
119              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
120     }
121
122     /**
123      * <b>DOM</b>: Implements {@link SVGMarkerElement#getMarkerHeight()}.
124      */

125     public SVGAnimatedLength getMarkerHeight() {
126         return getAnimatedLengthAttribute
127             (null, SVG_MARKER_HEIGHT_ATTRIBUTE,
128              SVG_MARKER_MARKER_HEIGHT_DEFAULT_VALUE,
129              SVGOMAnimatedLength.VERTICAL_LENGTH);
130     }
131
132     /**
133      * <b>DOM</b>: Implements {@link SVGMarkerElement#getOrientType()}.
134      */

135     public SVGAnimatedEnumeration getOrientType() {
136     throw new RuntimeException JavaDoc(" !!! TODO: getOrientType()");
137     }
138
139     /**
140      * <b>DOM</b>: Implements {@link SVGMarkerElement#getOrientAngle()}.
141      */

142     public SVGAnimatedAngle getOrientAngle() {
143     throw new RuntimeException JavaDoc(" !!! TODO: getOrientAngle()");
144     }
145
146     /**
147      * <b>DOM</b>: Implements {@link SVGMarkerElement#setOrientToAuto()}.
148      */

149     public void setOrientToAuto() {
150     throw new RuntimeException JavaDoc(" !!! TODO: setOrientToAuto()");
151     }
152
153     /**
154      * <b>DOM</b>: Implements {@link
155      * SVGMarkerElement#setOrientToAngle(SVGAngle)}.
156      */

157     public void setOrientToAngle(SVGAngle angle) {
158     throw new RuntimeException JavaDoc(" !!! TODO: setOrientToAngle()");
159     }
160
161     // SVGFitToViewBox support ////////////////////////////////////////////
162

163     /**
164      * <b>DOM</b>: Implements {@link
165      * org.w3c.dom.svg.SVGFitToViewBox#getViewBox()}.
166      */

167     public SVGAnimatedRect getViewBox() {
168     throw new RuntimeException JavaDoc(" !!! TODO: getViewBox()");
169     }
170
171     /**
172      * <b>DOM</b>: Implements {@link
173      * org.w3c.dom.svg.SVGFitToViewBox#getPreserveAspectRatio()}.
174      */

175     public SVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
176         return SVGPreserveAspectRatioSupport.getPreserveAspectRatio(this);
177     }
178
179     // SVGExternalResourcesRequired support /////////////////////////////
180

181     /**
182      * <b>DOM</b>: Implements {@link
183      * org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
184      */

185     public SVGAnimatedBoolean getExternalResourcesRequired() {
186         return SVGExternalResourcesRequiredSupport.
187             getExternalResourcesRequired(this);
188     }
189
190     // SVGLangSpace support //////////////////////////////////////////////////
191

192     /**
193      * <b>DOM</b>: Returns the xml:lang attribute value.
194      */

195     public String JavaDoc getXMLlang() {
196         return XMLSupport.getXMLLang(this);
197     }
198
199     /**
200      * <b>DOM</b>: Sets the xml:lang attribute value.
201      */

202     public void setXMLlang(String JavaDoc lang) {
203         setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
204                        XMLSupport.XML_LANG_ATTRIBUTE,
205                        lang);
206     }
207
208     /**
209      * <b>DOM</b>: Returns the xml:space attribute value.
210      */

211     public String JavaDoc getXMLspace() {
212         return XMLSupport.getXMLSpace(this);
213     }
214
215     /**
216      * <b>DOM</b>: Sets the xml:space attribute value.
217      */

218     public void setXMLspace(String JavaDoc space) {
219         setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
220                        XMLSupport.XML_SPACE_ATTRIBUTE,
221                        space);
222     }
223
224     /**
225      * Returns the AttributeInitializer for this element type.
226      * @return null if this element has no attribute with a default value.
227      */

228     protected AttributeInitializer getAttributeInitializer() {
229         return attributeInitializer;
230     }
231
232     /**
233      * Returns a new uninitialized instance of this object's class.
234      */

235     protected Node JavaDoc newNode() {
236         return new SVGOMMarkerElement();
237     }
238 }
239
Popular Tags