KickJava   Java API By Example, From Geeks To Geeks.

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


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.SVGAnimatedBoolean;
25 import org.w3c.dom.svg.SVGAnimatedEnumeration;
26 import org.w3c.dom.svg.SVGAnimatedString;
27 import org.w3c.dom.svg.SVGAnimatedTransformList;
28 import org.w3c.dom.svg.SVGGradientElement;
29
30 /**
31  * This class implements {@link org.w3c.dom.svg.SVGGradientElement}.
32  *
33  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
34  * @version $Id: SVGOMGradientElement.java,v 1.9 2004/08/18 07:13:17 vhardy Exp $
35  */

36 public abstract class SVGOMGradientElement
37     extends SVGStylableElement
38     implements SVGGradientElement {
39
40     /**
41      * The attribute initializer.
42      */

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

60     protected final static String JavaDoc[] UNITS_VALUES = {
61         "",
62         SVG_USER_SPACE_ON_USE_VALUE,
63         SVG_OBJECT_BOUNDING_BOX_VALUE
64     };
65
66     /**
67      * The 'spreadMethod' attribute values.
68      */

69     protected final static String JavaDoc[] SPREAD_METHOD_VALUES = {
70         "",
71         SVG_PAD_VALUE,
72         SVG_REFLECT_VALUE,
73         SVG_REPEAT_VALUE
74     };
75
76     /**
77      * Creates a new SVGOMGradientElement object.
78      */

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

87     protected SVGOMGradientElement(String JavaDoc prefix, AbstractDocument owner) {
88         super(prefix, owner);
89     }
90
91     /**
92      * To implement {@link
93      * org.w3c.dom.svg.SVGGradientElement#getGradientTransform()}.
94      */

95     public SVGAnimatedTransformList getGradientTransform() {
96     throw new RuntimeException JavaDoc(" !!! TODO: getGradientTransform()");
97     }
98
99     /**
100      * <b>DOM</b>: Implements {@link
101      * org.w3c.dom.svg.SVGGradientElement#getGradientUnits()}.
102      */

103     public SVGAnimatedEnumeration getGradientUnits() {
104         return getAnimatedEnumerationAttribute
105             (null, SVG_GRADIENT_UNITS_ATTRIBUTE, UNITS_VALUES,
106              (short)2);
107     }
108  
109     /**
110      * <b>DOM</b>: Implements {@link
111      * org.w3c.dom.svg.SVGGradientElement#getSpreadMethod()}.
112      */

113     public SVGAnimatedEnumeration getSpreadMethod() {
114         return getAnimatedEnumerationAttribute
115             (null, SVG_SPREAD_METHOD_ATTRIBUTE, SPREAD_METHOD_VALUES,
116              (short)1);
117     }
118  
119     /**
120      * <b>DOM</b>: Implements {@link
121      * org.w3c.dom.svg.SVGURIReference#getHref()}.
122      */

123     public SVGAnimatedString getHref() {
124         return SVGURIReferenceSupport.getHref(this);
125     }
126
127     // SVGExternalResourcesRequired support /////////////////////////////
128

129     /**
130      * <b>DOM</b>: Implements {@link
131      * org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
132      */

133     public SVGAnimatedBoolean getExternalResourcesRequired() {
134     return SVGExternalResourcesRequiredSupport.
135             getExternalResourcesRequired(this);
136     }
137
138     /**
139      * Returns the AttributeInitializer for this element type.
140      * @return null if this element has no attribute with a default value.
141      */

142     protected AttributeInitializer getAttributeInitializer() {
143         return attributeInitializer;
144     }
145
146     /**
147      * Returns a new uninitialized instance of this object's class.
148      */

149     protected Node JavaDoc newNode() {
150         return new SVGOMAElement();
151     }
152 }
153
Popular Tags