KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > svggen > SVGCompositeDescriptor


1 /*
2
3    Copyright 2001,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.svggen;
19
20 import java.util.HashMap JavaDoc;
21 import java.util.LinkedList JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24
25 import org.w3c.dom.Element JavaDoc;
26
27 /**
28  * Used to represent an SVG Composite. This can be achieved with
29  * to values: an SVG opacity and a filter
30  *
31  * @author <a HREF="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
32  * @version $Id: SVGCompositeDescriptor.java,v 1.6 2004/08/18 07:14:59 vhardy Exp $
33  */

34 public class SVGCompositeDescriptor implements SVGDescriptor, SVGSyntax{
35     private Element JavaDoc def;
36     private String JavaDoc opacityValue;
37     private String JavaDoc filterValue;
38
39     public SVGCompositeDescriptor(String JavaDoc opacityValue,
40                                   String JavaDoc filterValue){
41         this.opacityValue = opacityValue;
42         this.filterValue = filterValue;
43     }
44
45     public SVGCompositeDescriptor(String JavaDoc opacityValue,
46                                   String JavaDoc filterValue,
47                                   Element JavaDoc def){
48         this(opacityValue, filterValue);
49         this.def = def;
50     }
51
52     public String JavaDoc getOpacityValue(){
53         return opacityValue;
54     }
55
56     public String JavaDoc getFilterValue(){
57         return filterValue;
58     }
59
60     public Element JavaDoc getDef(){
61         return def;
62     }
63
64     public Map JavaDoc getAttributeMap(Map JavaDoc attrMap) {
65         if(attrMap == null)
66             attrMap = new HashMap JavaDoc();
67
68         attrMap.put(SVG_OPACITY_ATTRIBUTE, opacityValue);
69         attrMap.put(SVG_FILTER_ATTRIBUTE, filterValue);
70
71         return attrMap;
72     }
73
74     public List JavaDoc getDefinitionSet(List JavaDoc defSet) {
75         if (defSet == null)
76             defSet = new LinkedList JavaDoc();
77
78         if (def != null)
79             defSet.add(def);
80
81         return defSet;
82     }
83 }
84
Popular Tags