KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Copyright 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.util.SVGConstants;
21 import org.w3c.dom.svg.SVGAnimatedLengthList;
22
23 /**
24  * This class provide support for the SVGTextPositionningElement
25  * interface.
26  *
27  * @author <a HREF="mailto:nicolas.socheleau@bitflash.com">Nicolas Socheleau</a>
28  * @version $Id: SVGTextPositioningElementSupport.java,v 1.6 2004/08/18 07:13:19 vhardy Exp $
29  */

30 public class SVGTextPositioningElementSupport {
31
32     public final static String JavaDoc X_DEFAULT_VALUE
33         = "";
34     public final static String JavaDoc Y_DEFAULT_VALUE
35         = "";
36     public final static String JavaDoc DX_DEFAULT_VALUE
37         = "";
38     public final static String JavaDoc DY_DEFAULT_VALUE
39         = "";
40
41     /**
42      * <b>DOM</b>: Implements {@link
43      * org.w3c.dom.svg.SVGTextPositioningElement#getX()}.
44      */

45     public static SVGAnimatedLengthList getX(AbstractElement e){
46
47         SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
48             e.getLiveAttributeValue(null, SVGConstants.SVG_X_ATTRIBUTE);
49         if (result == null) {
50             result = new SVGOMAnimatedLengthList(e, null,
51                                                  SVGConstants.SVG_X_ATTRIBUTE,
52                                                  X_DEFAULT_VALUE,
53                                                  AbstractSVGLength.HORIZONTAL_LENGTH);
54             e.putLiveAttributeValue(null,
55                                     SVGConstants.SVG_X_ATTRIBUTE, result);
56         }
57         return result;
58     }
59
60     /**
61      * <b>DOM</b>: Implements {@link
62      * org.w3c.dom.svg.SVGTextPositioningElement#getY()}.
63      */

64     public static SVGAnimatedLengthList getY(AbstractElement e){
65
66         SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
67             e.getLiveAttributeValue(null, SVGConstants.SVG_Y_ATTRIBUTE);
68         if (result == null) {
69             result = new SVGOMAnimatedLengthList(e, null,
70                                                  SVGConstants.SVG_Y_ATTRIBUTE,
71                                                  Y_DEFAULT_VALUE,
72                                                  AbstractSVGLength.VERTICAL_LENGTH);
73             e.putLiveAttributeValue(null,
74                                     SVGConstants.SVG_Y_ATTRIBUTE, result);
75         }
76         return result;
77     }
78
79     /**
80      * <b>DOM</b>: Implements {@link
81      * org.w3c.dom.svg.SVGTextPositioningElement#getDx()}.
82      */

83     public static SVGAnimatedLengthList getDx(AbstractElement e){
84
85         SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
86             e.getLiveAttributeValue(null, SVGConstants.SVG_DX_ATTRIBUTE);
87         if (result == null) {
88             result = new SVGOMAnimatedLengthList(e, null,
89                                                  SVGConstants.SVG_DX_ATTRIBUTE,
90                                                  DX_DEFAULT_VALUE,
91                                                  AbstractSVGLength.HORIZONTAL_LENGTH);
92             e.putLiveAttributeValue(null,
93                                     SVGConstants.SVG_DX_ATTRIBUTE, result);
94         }
95         return result;
96     }
97
98     /**
99      * <b>DOM</b>: Implements {@link
100      * org.w3c.dom.svg.SVGTextPositioningElement#getDy()}.
101      */

102     public static SVGAnimatedLengthList getDy(AbstractElement e){
103
104         SVGOMAnimatedLengthList result =(SVGOMAnimatedLengthList)
105             e.getLiveAttributeValue(null, SVGConstants.SVG_DY_ATTRIBUTE);
106         if (result == null) {
107             result = new SVGOMAnimatedLengthList(e, null,
108                                                  SVGConstants.SVG_DY_ATTRIBUTE,
109                                                  DY_DEFAULT_VALUE,
110                                                  AbstractSVGLength.VERTICAL_LENGTH);
111             e.putLiveAttributeValue(null,
112                                     SVGConstants.SVG_DY_ATTRIBUTE, result);
113         }
114         return result;
115     }
116 }
117
Popular Tags