KickJava   Java API By Example, From Geeks To Geeks.

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


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.css.engine.CSSImportNode;
21 import org.apache.batik.css.engine.CSSImportedElementRoot;
22 import org.apache.batik.dom.AbstractDocument;
23 import org.apache.batik.dom.util.XLinkSupport;
24 import org.apache.batik.dom.util.XMLSupport;
25 import org.w3c.dom.Node JavaDoc;
26 import org.w3c.dom.svg.SVGAnimatedLength;
27 import org.w3c.dom.svg.SVGElementInstance;
28 import org.w3c.dom.svg.SVGUseElement;
29
30 /**
31  * This class implements {@link org.w3c.dom.svg.SVGUseElement}.
32  *
33  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
34  * @version $Id: SVGOMUseElement.java,v 1.10 2004/08/18 07:13:18 vhardy Exp $
35  */

36 public class SVGOMUseElement
37     extends SVGURIReferenceGraphicsElement
38     implements SVGUseElement,
39                CSSImportNode {
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", "embed");
54         attributeInitializer.addAttribute(XLinkSupport.XLINK_NAMESPACE_URI,
55                                           "xlink", "actuate", "onLoad");
56     }
57
58     /**
59      * Store the imported element.
60      */

61     protected CSSImportedElementRoot cssImportedElementRoot;
62
63     /**
64      * Creates a new SVGOMUseElement object.
65      */

66     protected SVGOMUseElement() {
67     }
68
69     /**
70      * Creates a new SVGOMUseElement object.
71      * @param prefix The namespace prefix.
72      * @param owner The owner document.
73      */

74     public SVGOMUseElement(String JavaDoc prefix, AbstractDocument owner) {
75         super(prefix, owner);
76     }
77
78     /**
79      * <b>DOM</b>: Implements {@link Node#getLocalName()}.
80      */

81     public String JavaDoc getLocalName() {
82         return SVG_USE_TAG;
83     }
84
85     /**
86      * <b>DOM</b>: Implements {@link SVGUseElement#getX()}.
87      */

88     public SVGAnimatedLength getX() {
89         return getAnimatedLengthAttribute
90             (null, SVG_X_ATTRIBUTE, SVG_USE_X_DEFAULT_VALUE,
91              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
92     }
93
94     /**
95      * <b>DOM</b>: Implements {@link SVGUseElement#getY()}.
96      */

97     public SVGAnimatedLength getY() {
98         return getAnimatedLengthAttribute
99             (null, SVG_Y_ATTRIBUTE, SVG_USE_Y_DEFAULT_VALUE,
100              SVGOMAnimatedLength.VERTICAL_LENGTH);
101     }
102
103     /**
104      * <b>DOM</b>: Implements {@link SVGUseElement#getWidth()}.
105      */

106     public SVGAnimatedLength getWidth() {
107         return getAnimatedLengthAttribute
108             (null, SVG_WIDTH_ATTRIBUTE, SVG_USE_WIDTH_DEFAULT_VALUE,
109              SVGOMAnimatedLength.HORIZONTAL_LENGTH);
110     }
111
112     /**
113      * <b>DOM</b>: Implements {@link SVGUseElement#getHeight()}.
114      */

115     public SVGAnimatedLength getHeight() {
116         return getAnimatedLengthAttribute
117             (null, SVG_HEIGHT_ATTRIBUTE, SVG_USE_HEIGHT_DEFAULT_VALUE,
118              SVGOMAnimatedLength.VERTICAL_LENGTH);
119     }
120
121     /**
122      * <b>DOM</b>: Implements {@link SVGUseElement#getInstanceRoot()}.
123      */

124     public SVGElementInstance getInstanceRoot() {
125     throw new RuntimeException JavaDoc(" !!! TODO: getInstanceRoot()");
126     }
127  
128     /**
129      * <b>DOM</b>: Implements {@link SVGUseElement#getAnimatedInstanceRoot()}.
130      */

131     public SVGElementInstance getAnimatedInstanceRoot() {
132     throw new RuntimeException JavaDoc(" !!! TODO: getAnimatedInstanceRoot()");
133     }
134
135     // CSSImportNode //////////////////////////////////////////////////
136

137     /**
138      * The CSSImportedElementRoot.
139      */

140     public CSSImportedElementRoot getCSSImportedElementRoot() {
141         return cssImportedElementRoot;
142     }
143
144     /**
145      * Sets the CSSImportedElementRoot.
146      */

147     public void setCSSImportedElementRoot(CSSImportedElementRoot r) {
148         cssImportedElementRoot = r;
149     }
150
151     /**
152      * Returns the AttributeInitializer for this element type.
153      * @return null if this element has no attribute with a default value.
154      */

155     protected AttributeInitializer getAttributeInitializer() {
156         return attributeInitializer;
157     }
158
159     /**
160      * Returns a new uninitialized instance of this object's class.
161      */

162     protected Node newNode() {
163         return new SVGOMUseElement();
164     }
165 }
166
Popular Tags