KickJava   Java API By Example, From Geeks To Geeks.

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


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.SVGPathSegList;
22
23 /**
24  * This class provide support for the SVGAnimatedPathData
25  * interface.
26  *
27  * @author <a HREF="mailto:nicolas.socheleau@bitflash.com">Nicolas Socheleau</a>
28  * @version $Id: SVGAnimatedPathDataSupport.java,v 1.5 2004/08/18 07:13:13 vhardy Exp $
29  */

30 public class SVGAnimatedPathDataSupport {
31
32     /**
33      * Default value for the 'd' attribute.
34      */

35     public static final String JavaDoc D_DEFAULT_VALUE
36         = "";
37
38     /**
39      * <b>DOM</b>: Implements {@link
40      * org.w3c.dom.svg.SVGAnimatedPathData#getPathSegList()}.
41      */

42     public static SVGPathSegList getPathSegList(AbstractElement e){
43         SVGOMAnimatedPathData result =(SVGOMAnimatedPathData)
44             e.getLiveAttributeValue(null, SVGConstants.SVG_D_ATTRIBUTE);
45         if (result == null) {
46             result = new SVGOMAnimatedPathData(e, null,
47                                                SVGConstants.SVG_D_ATTRIBUTE,
48                                                D_DEFAULT_VALUE);
49             e.putLiveAttributeValue(null, SVGConstants.SVG_D_ATTRIBUTE,result);
50         }
51         return result.getPathSegList();
52     }
53
54
55     /**
56      * <b>DOM</b>: Implements {@link
57      * org.w3c.dom.svg.SVGAnimatedPathData#getNormalizedPathSegList()}.
58      */

59     public static SVGPathSegList getNormalizedPathSegList(AbstractElement e){
60
61         SVGOMAnimatedPathData result =(SVGOMAnimatedPathData)
62             e.getLiveAttributeValue(null, SVGConstants.SVG_D_ATTRIBUTE);
63         if (result == null) {
64             result = new SVGOMAnimatedPathData(e, null,
65                                                SVGConstants.SVG_D_ATTRIBUTE,
66                                                D_DEFAULT_VALUE);
67             e.putLiveAttributeValue(null,
68                                     SVGConstants.SVG_D_ATTRIBUTE, result);
69         }
70         return result.getNormalizedPathSegList();
71     }
72
73     /**
74      * <b>DOM</b>: Implements {@link
75      * org.w3c.dom.svg.SVGAnimatedPathData#getAnimatedPathSegList()}.
76      */

77     public static SVGPathSegList getAnimatedPathSegList(AbstractElement e){
78         SVGOMAnimatedPathData result =(SVGOMAnimatedPathData)
79             e.getLiveAttributeValue(null, SVGConstants.SVG_D_ATTRIBUTE);
80         if (result == null) {
81             result = new SVGOMAnimatedPathData(e, null,
82                                                SVGConstants.SVG_D_ATTRIBUTE,
83                                                D_DEFAULT_VALUE);
84             e.putLiveAttributeValue(null,
85                                     SVGConstants.SVG_D_ATTRIBUTE, result);
86         }
87         return result.getAnimatedPathSegList();
88     }
89
90
91     /**
92      * <b>DOM</b>: Implements {@link
93      * org.w3c.dom.svg.SVGAnimatedPathData#getNormalizedPathSegList()}.
94      */

95     public static SVGPathSegList getAnimatedNormalizedPathSegList(AbstractElement e){
96
97         SVGOMAnimatedPathData result =(SVGOMAnimatedPathData)
98             e.getLiveAttributeValue(null, SVGConstants.SVG_D_ATTRIBUTE);
99         if (result == null) {
100             result = new SVGOMAnimatedPathData(e, null,
101                                                SVGConstants.SVG_D_ATTRIBUTE,
102                                                D_DEFAULT_VALUE);
103             e.putLiveAttributeValue(null,
104                                     SVGConstants.SVG_D_ATTRIBUTE,result);
105         }
106         return result.getAnimatedNormalizedPathSegList();
107     }
108
109 }
110
Popular Tags