Source code: com/port80/graph/impl/GraphStroke.java
1 //
2 // Copyright(c) 2002, Chris Leung
3 //
4
5 package com.port80.graph.impl;
6
7 import java.awt.Stroke;
8
9 import com.port80.graph.IGraphStroke;
10
11 /** Basic graph shape style class that implements IGraphStroke interface.
12 *
13 * . Wrapper around a java.awt.BasicStroke and a fill color.
14 */
15 public class GraphStroke implements IGraphStroke {
16
17 // Static fields ///////////////////////////////////////////////////////
18 //
19
20 // Instance fields /////////////////////////////////////////////////////
21 //
22
23 private String name;
24 private Stroke stroke;
25 private float lineWidth;
26
27 // Constructors ////////////////////////////////////////////////////////
28 //
29
30 public GraphStroke(String name, Stroke stroke, float lineWidth) {
31 this.name = name;
32 this.stroke = stroke;
33 this.lineWidth=lineWidth;
34 }
35
36 public GraphStroke(GraphStroke gs) {
37 this.name = gs.getName();
38 this.stroke = gs.getStroke();
39 this.lineWidth=gs.getLineWidth();
40 }
41
42 // IGraphShape interface ///////////////////////////////////////////////
43 //
44
45 public String getName() {
46 return name;
47 }
48 public Stroke getStroke() {
49 return stroke;
50 }
51
52 public float getLineWidth() {
53 return lineWidth;
54 }
55
56 public void setStroke(Stroke stroke) {
57 this.stroke = stroke;
58 }
59 public void setLineWidth(float width) {
60 this.lineWidth = width;
61 }
62
63 // Cloneable interface /////////////////////////////////////////////////
64
65 public Object clone() {
66 return new GraphStroke(this);
67 }
68
69 ////////////////////////////////////////////////////////////////////////
70
71 }
72