KickJava   Java API By Example, From Geeks To Geeks.

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


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.SVGAnimatedInteger;
27 import org.w3c.dom.svg.SVGAnimatedLength;
28 import org.w3c.dom.svg.SVGAnimatedString;
29 import org.w3c.dom.svg.SVGFilterElement;
30
31 /**
32  * This class implements {@link SVGFilterElement}.
33  *
34  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
35  * @version $Id: SVGOMFilterElement.java,v 1.16 2004/08/18 07:13:16 vhardy Exp $
36  */

37 public class SVGOMFilterElement
38     extends SVGStylableElement
39     implements SVGFilterElement {
40
41     /**
42      * The attribute initializer.
43      */

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

61     protected final static String JavaDoc[] UNITS_VALUES = {
62         "",
63         SVG_USER_SPACE_ON_USE_VALUE,
64         SVG_OBJECT_BOUNDING_BOX_VALUE
65     };
66
67     /**
68      * Creates a new SVGOMFilterElement object.
69      */

70     protected SVGOMFilterElement() {
71     }
72
73     /**
74      * Creates a new SVGOMFilterElement object.
75      * @param prefix The namespace prefix.
76      * @param owner The owner document.
77      */

78     public SVGOMFilterElement(String JavaDoc prefix, AbstractDocument owner) {
79         super(prefix, owner);
80     }
81
82     /**
83      * <b>DOM</b>: Implements {@link Node#getLocalName()}.
84      */

85     public String JavaDoc getLocalName() {
86         return SVG_FILTER_TAG;
87     }
88
89     /**
90      * <b>DOM</b>: Implements {@link SVGFilterElement#getFilterUnits()}.
91      */

92     public SVGAnimatedEnumeration getFilterUnits() {
93         return getAnimatedEnumerationAttribute
94             (null, SVG_FILTER_UNITS_ATTRIBUTE, UNITS_VALUES,
95              (short)2);
96     }
97
98     /**
99      * <b>DOM</b>: Implements {@link SVGFilterElement#getPrimitiveUnits()}.
100      */

101     public SVGAnimatedEnumeration getPrimitiveUnits() {
102         return getAnimatedEnumerationAttribute
103             (null, SVG_PRIMITIVE_UNITS_ATTRIBUTE, UNITS_VALUES,
104              (short)1);
105     }
106
107     /**
108      * <b>DOM</b>: Implements {@link SVGFilterElement#getX()}.
109      */

110     public SVGAnimatedLength getX() {
111         return getAnimatedLengthAttribute
112             (null, SVG_X_ATTRIBUTE, SVG_FILTER_X_DEFAULT_VALUE,
113              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
114     }
115
116     /**
117      * <b>DOM</b>: Implements {@link SVGFilterElement#getY()}.
118      */

119     public SVGAnimatedLength getY() {
120         return getAnimatedLengthAttribute
121             (null, SVG_Y_ATTRIBUTE, SVG_FILTER_Y_DEFAULT_VALUE,
122              SVGOMAnimatedLength.VERTICAL_LENGTH);
123     }
124
125     /**
126      * <b>DOM</b>: Implements {@link SVGFilterElement#getWidth()}.
127      */

128     public SVGAnimatedLength getWidth() {
129         return getAnimatedLengthAttribute
130             (null, SVG_WIDTH_ATTRIBUTE, SVG_FILTER_WIDTH_DEFAULT_VALUE,
131              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
132     }
133
134     /**
135      * <b>DOM</b>: Implements {@link SVGFilterElement#getHeight()}.
136      */

137     public SVGAnimatedLength getHeight() {
138         return getAnimatedLengthAttribute
139             (null, SVG_HEIGHT_ATTRIBUTE, SVG_FILTER_HEIGHT_DEFAULT_VALUE,
140              SVGOMAnimatedLength.VERTICAL_LENGTH);
141     }
142
143     /**
144      * <b>DOM</b>: Implements {@link SVGFilterElement#getFilterResX()}.
145      */

146     public SVGAnimatedInteger getFilterResX() {
147         throw new RuntimeException JavaDoc(" !!! TODO: getFilterResX()");
148     }
149
150     /**
151      * <b>DOM</b>: Implements {@link SVGFilterElement#getFilterResY()}.
152      */

153     public SVGAnimatedInteger getFilterResY() {
154         throw new RuntimeException JavaDoc(" !!! TODO: getFilterResY()");
155     }
156
157     /**
158      * <b>DOM</b>: Implements {@link SVGFilterElement#setFilterRes(int,int)}.
159      */

160     public void setFilterRes(int filterResX, int filterResY) {
161         throw new RuntimeException JavaDoc(" !!! TODO: setFilterRes()");
162     }
163
164     // SVGURIReference support /////////////////////////////////////////////
165

166     /**
167      * <b>DOM</b>: Implements {@link org.w3c.dom.svg.SVGURIReference#getHref()}.
168      */

169     public SVGAnimatedString getHref() {
170         return SVGURIReferenceSupport.getHref(this);
171     }
172
173     // SVGExternalResourcesRequired support /////////////////////////////
174

175     /**
176      * <b>DOM</b>: Implements {@link
177      * org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
178      */

179     public SVGAnimatedBoolean getExternalResourcesRequired() {
180         return SVGExternalResourcesRequiredSupport.
181             getExternalResourcesRequired(this);
182     }
183
184     // SVGLangSpace support //////////////////////////////////////////////////
185

186     /**
187      * <b>DOM</b>: Returns the xml:lang attribute value.
188      */

189     public String JavaDoc getXMLlang() {
190         return XMLSupport.getXMLLang(this);
191     }
192
193     /**
194      * <b>DOM</b>: Sets the xml:lang attribute value.
195      */

196     public void setXMLlang(String JavaDoc lang) {
197         setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
198                        XMLSupport.XML_LANG_ATTRIBUTE,
199                        lang);
200     }
201
202     /**
203      * <b>DOM</b>: Returns the xml:space attribute value.
204      */

205     public String JavaDoc getXMLspace() {
206         return XMLSupport.getXMLSpace(this);
207     }
208
209     /**
210      * <b>DOM</b>: Sets the xml:space attribute value.
211      */

212     public void setXMLspace(String JavaDoc space) {
213         setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
214                        XMLSupport.XML_SPACE_ATTRIBUTE,
215                        space);
216     }
217
218     /**
219      * Returns the AttributeInitializer for this element type.
220      * @return null if this element has no attribute with a default value.
221      */

222     protected AttributeInitializer getAttributeInitializer() {
223         return attributeInitializer;
224     }
225
226     /**
227      * Returns a new uninitialized instance of this object's class.
228      */

229     protected Node JavaDoc newNode() {
230         return new SVGOMFilterElement();
231     }
232 }
233
Popular Tags