KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Copyright 2000-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.w3c.dom.Attr JavaDoc;
22 import org.w3c.dom.Node JavaDoc;
23 import org.w3c.dom.svg.SVGAnimatedLength;
24 import org.w3c.dom.svg.SVGRadialGradientElement;
25
26 /**
27  * This class implements {@link SVGRadialGradientElement}.
28  *
29  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
30  * @version $Id: SVGOMRadialGradientElement.java,v 1.9 2004/08/18 07:13:17 vhardy Exp $
31  */

32 public class SVGOMRadialGradientElement
33     extends SVGOMGradientElement
34     implements SVGRadialGradientElement {
35
36     /**
37      * Creates a new SVGOMRadialGradientElement object.
38      */

39     protected SVGOMRadialGradientElement() {
40     }
41
42     /**
43      * Creates a new SVGOMRadialGradientElement object.
44      * @param prefix The namespace prefix.
45      * @param owner The owner document.
46      */

47     public SVGOMRadialGradientElement(String JavaDoc prefix, AbstractDocument owner) {
48         super(prefix, owner);
49     }
50
51     /**
52      * <b>DOM</b>: Implements {@link Node#getLocalName()}.
53      */

54     public String JavaDoc getLocalName() {
55         return SVG_RADIAL_GRADIENT_TAG;
56     }
57
58     /**
59      * <b>DOM</b>: Implements {@link
60      * org.w3c.dom.svg.SVGRadialGradientElement#getCx()}.
61      */

62     public SVGAnimatedLength getCx() {
63         return getAnimatedLengthAttribute
64             (null, SVG_CX_ATTRIBUTE, SVG_RADIAL_GRADIENT_CX_DEFAULT_VALUE,
65              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
66     }
67
68     /**
69      * <b>DOM</b>: Implements {@link
70      * org.w3c.dom.svg.SVGRadialGradientElement#getCy()}.
71      */

72     public SVGAnimatedLength getCy() {
73         return getAnimatedLengthAttribute
74             (null, SVG_CY_ATTRIBUTE, SVG_RADIAL_GRADIENT_CY_DEFAULT_VALUE,
75              SVGOMAnimatedLength.VERTICAL_LENGTH);
76     }
77
78     /**
79      * <b>DOM</b>: Implements {@link
80      * org.w3c.dom.svg.SVGRadialGradientElement#getR()}.
81      */

82     public SVGAnimatedLength getR() {
83         return getAnimatedLengthAttribute
84             (null, SVG_R_ATTRIBUTE, SVG_RADIAL_GRADIENT_R_DEFAULT_VALUE,
85              SVGOMAnimatedLength.OTHER_LENGTH);
86     }
87
88     /**
89      * <b>DOM</b>: Implements {@link
90      * org.w3c.dom.svg.SVGRadialGradientElement#getFx()}.
91      */

92     public SVGAnimatedLength getFx() {
93         SVGAnimatedLength result =
94             (SVGAnimatedLength)getLiveAttributeValue(null, SVG_FX_ATTRIBUTE);
95         if (result == null) {
96             result = new AbstractSVGAnimatedLength
97                 (this, null, SVG_FX_ATTRIBUTE,
98                  SVGOMAnimatedLength.HORIZONTAL_LENGTH) {
99                     protected String JavaDoc getDefaultValue() {
100                         Attr JavaDoc attr = getAttributeNodeNS(null, SVG_CX_ATTRIBUTE);
101                         if (attr == null) {
102                             return SVG_RADIAL_GRADIENT_CX_DEFAULT_VALUE;
103                         }
104                         return attr.getValue();
105                     }
106                 };
107             putLiveAttributeValue(null, SVG_FX_ATTRIBUTE,
108                                   (LiveAttributeValue)result);
109         }
110         return result;
111     }
112
113     /**
114      * <b>DOM</b>: Implements {@link
115      * org.w3c.dom.svg.SVGRadialGradientElement#getFy()}.
116      */

117     public SVGAnimatedLength getFy() {
118         SVGAnimatedLength result =
119             (SVGAnimatedLength)getLiveAttributeValue(null, SVG_FY_ATTRIBUTE);
120         if (result == null) {
121             result = new AbstractSVGAnimatedLength
122                 (this, null, SVG_FY_ATTRIBUTE,
123                  SVGOMAnimatedLength.VERTICAL_LENGTH) {
124                     protected String JavaDoc getDefaultValue() {
125                         Attr JavaDoc attr = getAttributeNodeNS(null, SVG_CY_ATTRIBUTE);
126                         if (attr == null) {
127                             return SVG_RADIAL_GRADIENT_CY_DEFAULT_VALUE;
128                         }
129                         return attr.getValue();
130                     }
131                 };
132             putLiveAttributeValue(null, SVG_FY_ATTRIBUTE,
133                                   (LiveAttributeValue)result);
134         }
135         return result;
136     }
137
138     /**
139      * Returns a new uninitialized instance of this object's class.
140      */

141     protected Node JavaDoc newNode() {
142         return new SVGOMRadialGradientElement();
143     }
144 }
145
Popular Tags