1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.vectomatic.common.model;
19
20 import com.google.gwt.user.client.rpc.IsSerializable;
21
22
23
24
25
26 public class Attribute implements IsSerializable {
27 public static final Attribute LINE_STYLE = new Attribute("stroke.style", null);
28 public static final Attribute LINE_OPACITY = new Attribute("stroke.opacity", new FloatAttributeValue(1.0f));
29 public static final Attribute LINE_PATTERN = new Attribute("stroke.pattern", null);
30 public static final Attribute LINE_CAP = new Attribute("stroke.cap", null);
31 public static final Attribute LINE_WIDTH = new Attribute("stroke.width", new FloatAttributeValue(1.0f));
32 public static final Attribute FILL_STYLE = new Attribute("fill.style", null);
33 public static final Attribute FILL_OPACITY = new Attribute("fill.opacity", new FloatAttributeValue(1.0f));
34 private String _id;
35 private transient String _name;
36 private IAttributeValue _defaultValue;
37
38 public Attribute() {
39
40 }
41 private Attribute(String id, IAttributeValue defaultValue) {
42 _id = id;
43 _defaultValue = defaultValue;
44 }
45
46 @Override
47 public boolean equals(Object obj) {
48 if (obj instanceof Attribute) {
49 return _id.equals(((Attribute)obj)._id);
50 }
51 return false;
52 }
53
54 @Override
55 public int hashCode() {
56 return _id.hashCode();
57 }
58
59
60
61
62
63
64 public String getId() {
65 return _id;
66 }
67
68
69
70
71
72
73 public String getName() {
74 return _name;
75 }
76
77
78
79
80
81
82 public void setName(String name) {
83 _name = name;
84 }
85
86 public IAttributeValue getDefaultValue() {
87 return _defaultValue;
88 }
89
90 @Override
91 public String toString() {
92 return _id;
93 }
94 }