KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Copyright 2000-2004 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.XLinkSupport;
22 import org.apache.batik.dom.util.XMLSupport;
23 import org.w3c.dom.Node JavaDoc;
24 import org.w3c.dom.svg.SVGAnimatedEnumeration;
25 import org.w3c.dom.svg.SVGAnimatedLength;
26 import org.w3c.dom.svg.SVGAnimatedString;
27 import org.w3c.dom.svg.SVGTextPathElement;
28
29 /**
30  * This class implements {@link org.w3c.dom.svg.SVGTextPathElement}.
31  *
32  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
33  * @version $Id: SVGOMTextPathElement.java,v 1.8 2004/08/18 07:13:18 vhardy Exp $
34  */

35 public class SVGOMTextPathElement
36     extends SVGOMTextContentElement
37     implements SVGTextPathElement {
38
39     /**
40      * The attribute initializer.
41      */

42     protected final static AttributeInitializer attributeInitializer;
43     static {
44         attributeInitializer = new AttributeInitializer(4);
45         attributeInitializer.addAttribute(XMLSupport.XMLNS_NAMESPACE_URI,
46                                           null, "xmlns:xlink",
47                                           XLinkSupport.XLINK_NAMESPACE_URI);
48         attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI,
49                                           "xlink", "type", "simple");
50         attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI,
51                                           "xlink", "show", "other");
52         attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI,
53                                           "xlink", "actuate", "onLoad");
54     }
55
56     /**
57      * The 'method' attribute values.
58      */

59     protected final static String JavaDoc[] METHOD_VALUES = {
60         "",
61         SVG_ALIGN_VALUE,
62         SVG_STRETCH_VALUE
63     };
64
65     /**
66      * The 'spacing' attribute values.
67      */

68     protected final static String JavaDoc[] SPACING_VALUES = {
69         "",
70         SVG_AUTO_VALUE,
71         SVG_EXACT_VALUE
72     };
73
74     /**
75      * Creates a new SVGOMTextPathElement object.
76      */

77     protected SVGOMTextPathElement() {
78     }
79
80     /**
81      * Creates a new SVGOMTextPathElement object.
82      * @param prefix The namespace prefix.
83      * @param owner The owner document.
84      */

85     public SVGOMTextPathElement(String JavaDoc prefix, AbstractDocument owner) {
86         super(prefix, owner);
87     }
88
89     /**
90      * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getLocalName()}.
91      */

92     public String JavaDoc getLocalName() {
93         return SVG_TEXT_PATH_TAG;
94     }
95
96     /**
97      * <b>DOM</b>: Implements {@link SVGTextPathElement#getStartOffset()}.
98      */

99     public SVGAnimatedLength getStartOffset() {
100         return getAnimatedLengthAttribute
101             (null, SVG_START_OFFSET_ATTRIBUTE,
102              SVG_TEXT_PATH_START_OFFSET_DEFAULT_VALUE,
103              SVGOMAnimatedLength.OTHER_LENGTH);
104     }
105
106     /**
107      * <b>DOM</b>: Implements {@link SVGTextPathElement#getMethod()}.
108      */

109     public SVGAnimatedEnumeration getMethod() {
110         return getAnimatedEnumerationAttribute
111             (null, SVG_METHOD_ATTRIBUTE, METHOD_VALUES, (short)1);
112     }
113
114     /**
115      * <b>DOM</b>: Implements {@link SVGTextPathElement#getSpacing()}.
116      */

117     public SVGAnimatedEnumeration getSpacing() {
118         return getAnimatedEnumerationAttribute
119             (null, SVG_SPACING_ATTRIBUTE, SPACING_VALUES, (short)2);
120     }
121
122
123     // XLink support //////////////////////////////////////////////////////
124

125     /**
126      * <b>DOM</b>: Implements {@link
127      * org.w3c.dom.svg.SVGURIReference#getHref()}.
128      */

129     public SVGAnimatedString getHref() {
130         return SVGURIReferenceSupport.getHref(this);
131     }
132
133     /**
134      * Returns the AttributeInitializer for this element type.
135      * @return null if this element has no attribute with a default value.
136      */

137     protected AttributeInitializer getAttributeInitializer() {
138         return attributeInitializer;
139     }
140
141     /**
142      * Returns a new uninitialized instance of this object's class.
143      */

144     protected Node JavaDoc newNode() {
145         return new SVGOMTextPathElement();
146     }
147 }
148
Popular Tags