1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.surf.studio;
20
21 import java.io.Serializable;
22 import java.util.HashMap;
23 import java.util.Map;
24
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28
29
30
31
32
33 public class BrowserStateBean implements Serializable
34 {
35 private static Log logger = LogFactory.getLog(BrowserStateBean.class);
36
37 private String id = null;
38
39 private String title = null;
40 private String description = null;
41
42 private String className = null;
43
44 private Map<String, String> jsFiles = null;
45 private Map<String, String> cssFiles = null;
46 private Map<String, String> domFiles = null;
47
48 private Map<String, String> properties = null;
49
50
51
52
53
54
55 public BrowserStateBean(String id)
56 {
57 this.id = id;
58
59 this.jsFiles = new HashMap<String, String>(16, 1.0f);
60 this.cssFiles = new HashMap<String, String>(16, 1.0f);
61 this.domFiles = new HashMap<String, String>(16, 1.0f);
62
63 this.properties = new HashMap<String, String>(16, 1.0f);
64
65
66 put("enabled", "true");
67 }
68
69
70
71
72
73
74 public String getId()
75 {
76 return this.id;
77 }
78
79
80
81
82
83
84 public String getTitle()
85 {
86 return this.title;
87 }
88
89
90
91
92
93
94 public void setTitle(String title)
95 {
96 this.title = title;
97 }
98
99
100
101
102
103
104 public String getDescription()
105 {
106 return this.description;
107 }
108
109
110
111
112
113
114 public void setDescription(String description)
115 {
116 this.description = description;
117 }
118
119
120
121
122
123
124 public String[] getJsFiles()
125 {
126 return jsFiles.values().toArray(new String[jsFiles.size()]);
127 }
128
129
130
131
132
133
134 public void addJsFile(String file)
135 {
136 jsFiles.put(file, file);
137 }
138
139
140
141
142
143
144 public String[] getCssFiles()
145 {
146 return cssFiles.values().toArray(new String[cssFiles.size()]);
147 }
148
149
150
151
152
153
154 public void addCssFile(String file)
155 {
156 cssFiles.put(file, file);
157 }
158
159
160
161
162
163
164 public String[] getDomFiles()
165 {
166 return domFiles.values().toArray(new String[domFiles.size()]);
167 }
168
169
170
171
172
173
174 public void addDomFile(String file)
175 {
176 domFiles.put(file, file);
177 }
178
179
180
181
182
183
184 public String getClassname()
185 {
186 return this.className;
187 }
188
189
190
191
192
193
194 public void setClassname(String className)
195 {
196 this.className = className;
197 }
198
199
200
201
202
203
204
205
206 public void put(String key, String value)
207 {
208 this.properties.put(key, value);
209 }
210
211
212
213
214
215
216 public String get(String key)
217 {
218 return this.properties.get(key);
219 }
220
221
222
223
224
225
226 public Map<String, String> getProperties()
227 {
228 return this.properties;
229 }
230
231
232
233
234
235
236 public void remove(String key)
237 {
238 this.properties.remove(key);
239 }
240
241
242
243
244 public void removeProperties()
245 {
246 this.properties = new HashMap<String, String>(16, 1.0f);
247 }
248
249
250
251
252 public void enable()
253 {
254 put("enabled", "true");
255 }
256
257
258
259
260 public void disable()
261 {
262 remove("enabled");
263 }
264
265
266
267
268
269
270 public boolean isEnabled()
271 {
272 return "true".equals(get("enabled"));
273 }
274
275
276
277
278 public void clearDependencies()
279 {
280 this.jsFiles = new HashMap<String, String>(16, 1.0f);
281 this.cssFiles = new HashMap<String, String>(16, 1.0f);
282 this.domFiles = new HashMap<String, String>(16, 1.0f);
283 }
284 }