KickJava   Java API By Example, From Geeks To Geeks.

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


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.apache.batik.dom.util.XMLSupport;
22 import org.w3c.dom.svg.SVGAnimatedBoolean;
23 import org.w3c.dom.svg.SVGAnimatedTransformList;
24 import org.w3c.dom.svg.SVGElement;
25 import org.w3c.dom.svg.SVGException;
26 import org.w3c.dom.svg.SVGMatrix;
27 import org.w3c.dom.svg.SVGRect;
28 import org.w3c.dom.svg.SVGStringList;
29
30 /**
31  * This class provides a common superclass for all graphics elements.
32  *
33  * @author <a HREF="mailto:stephane@hillion.org">Stephane Hillion</a>
34  * @version $Id: SVGGraphicsElement.java,v 1.13 2004/08/18 07:13:14 vhardy Exp $
35  */

36 public abstract class SVGGraphicsElement extends SVGStylableElement {
37     
38     /**
39      * Creates a new SVGGraphicsElement.
40      */

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

49     protected SVGGraphicsElement(String JavaDoc prefix, AbstractDocument owner) {
50         super(prefix, owner);
51
52     }
53
54     // SVGLocatable support /////////////////////////////////////////////
55

56     /**
57      * <b>DOM</b>: Implements {@link
58      * org.w3c.dom.svg.SVGLocatable#getNearestViewportElement()}.
59      */

60     public SVGElement getNearestViewportElement() {
61     return SVGLocatableSupport.getNearestViewportElement(this);
62     }
63
64     /**
65      * <b>DOM</b>: Implements {@link
66      * org.w3c.dom.svg.SVGLocatable#getFarthestViewportElement()}.
67      */

68     public SVGElement getFarthestViewportElement() {
69     return SVGLocatableSupport.getFarthestViewportElement(this);
70     }
71
72     /**
73      * <b>DOM</b>: Implements {@link
74      * org.w3c.dom.svg.SVGLocatable#getBBox()}.
75      */

76     public SVGRect getBBox() {
77     return SVGLocatableSupport.getBBox(this);
78     }
79
80     /**
81      * <b>DOM</b>: Implements {@link
82      * org.w3c.dom.svg.SVGLocatable#getCTM()}.
83      */

84     public SVGMatrix getCTM() {
85     return SVGLocatableSupport.getCTM(this);
86     }
87
88     /**
89      * <b>DOM</b>: Implements {@link
90      * org.w3c.dom.svg.SVGLocatable#getScreenCTM()}.
91      */

92     public SVGMatrix getScreenCTM() {
93     return SVGLocatableSupport.getScreenCTM(this);
94     }
95
96     /**
97      * <b>DOM</b>: Implements {@link
98      * org.w3c.dom.svg.SVGLocatable#getTransformToElement(SVGElement)}.
99      */

100     public SVGMatrix getTransformToElement(SVGElement element)
101     throws SVGException {
102     return SVGLocatableSupport.getTransformToElement(this, element);
103     }
104
105     // SVGTransformable support //////////////////////////////////////////////
106

107     /**
108      * <b>DOM</b>: Implements {@link
109      * org.w3c.dom.svg.SVGTransformable#getTransform()}.
110      */

111     public SVGAnimatedTransformList getTransform() {
112     return SVGTransformableSupport.getTransform(this);
113     }
114
115     // SVGExternalResourcesRequired support /////////////////////////////
116

117     /**
118      * <b>DOM</b>: Implements {@link
119      * org.w3c.dom.svg.SVGExternalResourcesRequired#getExternalResourcesRequired()}.
120      */

121     public SVGAnimatedBoolean getExternalResourcesRequired() {
122     return SVGExternalResourcesRequiredSupport.
123             getExternalResourcesRequired(this);
124     }
125
126     // SVGLangSpace support //////////////////////////////////////////////////
127

128     /**
129      * <b>DOM</b>: Returns the xml:lang attribute value.
130      */

131     public String JavaDoc getXMLlang() {
132         return XMLSupport.getXMLLang(this);
133     }
134
135     /**
136      * <b>DOM</b>: Sets the xml:lang attribute value.
137      */

138     public void setXMLlang(String JavaDoc lang) {
139         setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
140                        XMLSupport.XML_LANG_ATTRIBUTE,
141                        lang);
142     }
143     
144     /**
145      * <b>DOM</b>: Returns the xml:space attribute value.
146      */

147     public String JavaDoc getXMLspace() {
148         return XMLSupport.getXMLSpace(this);
149     }
150
151     /**
152      * <b>DOM</b>: Sets the xml:space attribute value.
153      */

154     public void setXMLspace(String JavaDoc space) {
155         setAttributeNS(XMLSupport.XML_NAMESPACE_URI,
156                        XMLSupport.XML_SPACE_ATTRIBUTE,
157                        space);
158     }
159
160     // SVGTests support ///////////////////////////////////////////////////
161

162     /**
163      * <b>DOM</b>: Implements {@link
164      * org.w3c.dom.svg.SVGTests#getRequiredFeatures()}.
165      */

166     public SVGStringList getRequiredFeatures() {
167     return SVGTestsSupport.getRequiredFeatures(this);
168     }
169
170     /**
171      * <b>DOM</b>: Implements {@link
172      * org.w3c.dom.svg.SVGTests#getRequiredExtensions()}.
173      */

174     public SVGStringList getRequiredExtensions() {
175     return SVGTestsSupport.getRequiredExtensions(this);
176     }
177
178     /**
179      * <b>DOM</b>: Implements {@link
180      * org.w3c.dom.svg.SVGTests#getSystemLanguage()}.
181      */

182     public SVGStringList getSystemLanguage() {
183     return SVGTestsSupport.getSystemLanguage(this);
184     }
185
186     /**
187      * <b>DOM</b>: Implements {@link
188      * org.w3c.dom.svg.SVGTests#hasExtension(String)}.
189      */

190     public boolean hasExtension(String JavaDoc extension) {
191     return SVGTestsSupport.hasExtension(this, extension);
192     }
193 }
194
Popular Tags