KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Copyright 2001-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.DOMException JavaDoc;
24 import org.w3c.dom.Node JavaDoc;
25 import org.w3c.dom.svg.SVGAnimatedString;
26 import org.w3c.dom.svg.SVGGlyphRefElement;
27
28 /**
29  * This class implements {@link SVGGlyphRefElement}.
30  *
31  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
32  * @version $Id: SVGOMGlyphRefElement.java,v 1.7 2004/08/18 07:13:17 vhardy Exp $
33  */

34 public class SVGOMGlyphRefElement
35     extends SVGStylableElement
36     implements SVGGlyphRefElement {
37     
38     /**
39      * The attribute initializer.
40      */

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

58     protected SVGOMGlyphRefElement() {
59     }
60
61     /**
62      * Creates a new SVGOMGlyphRefElement object.
63      * @param prefix The namespace prefix.
64      * @param owner The owner document.
65      */

66     public SVGOMGlyphRefElement(String JavaDoc prefix, AbstractDocument owner) {
67         super(prefix, owner);
68     }
69
70     /**
71      * <b>DOM</b>: Implements {@link Node#getLocalName()}.
72      */

73     public String JavaDoc getLocalName() {
74         return SVG_GLYPH_REF_TAG;
75     }
76
77     /**
78      * <b>DOM</b>: Implements {@link org.w3c.dom.svg.SVGURIReference#getHref()}.
79      */

80     public SVGAnimatedString getHref() {
81         return SVGURIReferenceSupport.getHref(this);
82     }
83
84     /**
85      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#getGlyphRef()}.
86      */

87     public String JavaDoc getGlyphRef() {
88         return getAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE);
89     }
90
91     /**
92      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#setGlyphRef(String)}.
93      */

94     public void setGlyphRef(String JavaDoc glyphRef) throws DOMException JavaDoc {
95         setAttributeNS(null, SVG_GLYPH_REF_ATTRIBUTE, glyphRef);
96     }
97
98     /**
99      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#getFormat()}.
100      */

101     public String JavaDoc getFormat() {
102         return getAttributeNS(null, SVG_FORMAT_ATTRIBUTE);
103     }
104
105     /**
106      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#setFormat(String)}.
107      */

108     public void setFormat(String JavaDoc format) throws DOMException JavaDoc {
109         setAttributeNS(null, SVG_FORMAT_ATTRIBUTE, format);
110     }
111
112     /**
113      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#getX()}.
114      */

115     public float getX() {
116         return Float.parseFloat(getAttributeNS(null, SVG_X_ATTRIBUTE));
117     }
118
119     /**
120      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#setX(float)}.
121      */

122     public void setX(float x) throws DOMException JavaDoc {
123         setAttributeNS(null, SVG_X_ATTRIBUTE, String.valueOf(x));
124     }
125
126     /**
127      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#getY()}.
128      */

129     public float getY() {
130         return Float.parseFloat(getAttributeNS(null, SVG_Y_ATTRIBUTE));
131     }
132
133     /**
134      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#setY(float)}.
135      */

136     public void setY(float y) throws DOMException JavaDoc {
137         setAttributeNS(null, SVG_Y_ATTRIBUTE, String.valueOf(y));
138     }
139
140     /**
141      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#getDx()}.
142      */

143     public float getDx() {
144         return Float.parseFloat(getAttributeNS(null, SVG_DX_ATTRIBUTE));
145     }
146
147     /**
148      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#setDx(float)}.
149      */

150     public void setDx(float dx) throws DOMException JavaDoc {
151         setAttributeNS(null, SVG_DX_ATTRIBUTE, String.valueOf(dx));
152     }
153
154     /**
155      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#getDy()}.
156      */

157     public float getDy() {
158         return Float.parseFloat(getAttributeNS(null, SVG_DY_ATTRIBUTE));
159     }
160
161     /**
162      * <b>DOM</b>: Implements {@link SVGGlyphRefElement#setDy(float)}.
163      */

164     public void setDy(float dy) throws DOMException JavaDoc {
165         setAttributeNS(null, SVG_DY_ATTRIBUTE, String.valueOf(dy));
166     }
167
168     /**
169      * Returns the AttributeInitializer for this element type.
170      * @return null if this element has no attribute with a default value.
171      */

172     protected AttributeInitializer getAttributeInitializer() {
173         return attributeInitializer;
174     }
175
176     /**
177      * Returns a new uninitialized instance of this object's class.
178      */

179     protected Node JavaDoc newNode() {
180         return new SVGOMGlyphRefElement();
181     }
182 }
183
Popular Tags