KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
26  * Used to represent an SVG Paint. This can be achieved with
27  * to values: an SVG paint value and an SVG opacity value
28  *
29  * @author <a HREF="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
30  * @version $Id: SVGStrokeDescriptor.java,v 1.7 2004/08/18 07:15:09 vhardy Exp $
31  */

32 public class SVGStrokeDescriptor implements SVGDescriptor, SVGSyntax{
33     private String JavaDoc strokeWidth;
34     private String JavaDoc capStyle;
35     private String JavaDoc joinStyle;
36     private String JavaDoc miterLimit;
37     private String JavaDoc dashArray;
38     private String JavaDoc dashOffset;
39
40
41     public SVGStrokeDescriptor(String JavaDoc strokeWidth, String JavaDoc capStyle,
42                                String JavaDoc joinStyle, String JavaDoc miterLimit,
43                                String JavaDoc dashArray, String JavaDoc dashOffset){
44         if(strokeWidth == null ||
45            capStyle == null ||
46            joinStyle == null ||
47            miterLimit == null ||
48            dashArray == null ||
49            dashOffset == null)
50             throw new SVGGraphics2DRuntimeException(ErrorConstants.ERR_STROKE_NULL);
51
52         this.strokeWidth = strokeWidth;
53         this.capStyle = capStyle;
54         this.joinStyle = joinStyle;
55         this.miterLimit = miterLimit;
56         this.dashArray = dashArray;
57         this.dashOffset = dashOffset;
58     }
59
60     String JavaDoc getStrokeWidth(){ return strokeWidth; }
61     String JavaDoc getCapStyle(){ return capStyle; }
62     String JavaDoc getJoinStyle(){ return joinStyle; }
63     String JavaDoc getMiterLimit(){ return miterLimit; }
64     String JavaDoc getDashArray(){ return dashArray; }
65     String JavaDoc getDashOffset(){ return dashOffset; }
66
67     public Map JavaDoc getAttributeMap(Map JavaDoc attrMap){
68         if(attrMap == null)
69             attrMap = new HashMap JavaDoc();
70
71         attrMap.put(SVG_STROKE_WIDTH_ATTRIBUTE, strokeWidth);
72         attrMap.put(SVG_STROKE_LINECAP_ATTRIBUTE, capStyle);
73         attrMap.put(SVG_STROKE_LINEJOIN_ATTRIBUTE, joinStyle);
74         attrMap.put(SVG_STROKE_MITERLIMIT_ATTRIBUTE, miterLimit);
75         attrMap.put(SVG_STROKE_DASHARRAY_ATTRIBUTE, dashArray);
76         attrMap.put(SVG_STROKE_DASHOFFSET_ATTRIBUTE, dashOffset);
77
78         return attrMap;
79     }
80
81     public List JavaDoc getDefinitionSet(List JavaDoc defSet){
82         if(defSet == null)
83             defSet = new LinkedList JavaDoc();
84
85         return defSet;
86     }
87 }
88
Popular Tags