1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package pl.edu.agh.cast.model.visual.backward;
19
20 import java.beans.PropertyChangeListener;
21
22 import pl.edu.agh.cast.data.model.property.PropertyChangeProviderHelper;
23
24 import com.thoughtworks.xstream.annotations.XStreamAlias;
25 import com.thoughtworks.xstream.annotations.XStreamOmitField;
26
27
28
29
30
31
32 @XStreamAlias("diagramSettings")
33 public class DiagramSettings implements IDiagramSettings {
34
35 private static final long serialVersionUID = 5036382806995356626L;
36
37
38
39
40 public static final String LEGEND_SHOWN = "DiagramSettings.LegendShown";
41
42
43
44
45 public static final String DISPLAY_NAME = "DiagramSettings.DisplayName";
46
47 @XStreamAlias("defaultLayoutManager")
48 private String defaultLayoutManager;
49
50 @XStreamAlias("showLegend")
51 private boolean showLegend = true;
52
53 @XStreamAlias("displayName")
54 private String displayName = "";
55
56 @XStreamAlias("needsLayout")
57 private boolean needsInitialLayout = true;
58
59 @XStreamAlias("editorId")
60 private String editorId;
61
62
63
64
65 @XStreamOmitField
66 private transient PropertyChangeProviderHelper pcpHelper;
67
68 protected Object readResolve() {
69 pcpHelper = new PropertyChangeProviderHelper(this);
70 return this;
71 }
72
73 public boolean isShowLegend() {
74 return showLegend;
75 }
76
77
78
79
80
81
82 public void setShowLegend(boolean showLegend) {
83 boolean oldValue = this.showLegend;
84 this.showLegend = showLegend;
85 firePropertyChange(LEGEND_SHOWN, oldValue, showLegend);
86 }
87
88
89
90
91
92
93 public String getDisplayName() {
94 return displayName;
95 }
96
97
98
99
100
101
102 public void setDisplayName(String displayName) {
103 String oldValue = this.displayName;
104 this.displayName = displayName;
105 firePropertyChange(DISPLAY_NAME, oldValue, displayName);
106 }
107
108
109
110
111
112
113 public boolean needsInitialLayout() {
114 return needsInitialLayout;
115 }
116
117
118
119
120
121
122 public void setNeedsInitialLayout(boolean in) {
123 needsInitialLayout = in;
124 }
125
126
127
128
129
130
131 public void setDefaultLayoutManagerClass(String layoutManagerClass) {
132 defaultLayoutManager = layoutManagerClass;
133 }
134
135
136
137
138
139
140 public String getDefaultLayoutManagerClass() {
141 return defaultLayoutManager;
142 }
143
144
145
146
147
148
149 public String getEditorId() {
150 return editorId;
151 }
152
153
154
155
156
157
158 public void setEditorId(String id) {
159 editorId = id;
160 }
161
162
163
164
165
166
167
168
169 public void addPropertyChangeListener(PropertyChangeListener l) {
170 if (pcpHelper == null) {
171 pcpHelper = new PropertyChangeProviderHelper(this);
172 }
173 pcpHelper.addPropertyChangeListener(l);
174 }
175
176
177
178
179
180
181
182 public void removePropertyChangeListener(PropertyChangeListener l) {
183 pcpHelper.removePropertyChangeListener(l);
184 }
185
186
187
188
189
190
191
192
193
194
195
196 protected void firePropertyChange(String property, Object oldValue, Object newValue) {
197 pcpHelper.firePropertyChange(property, oldValue, newValue);
198 }
199
200
201
202 }