Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 1348:fb224f54c643
Prepared editor UI for annotation styling.
flys-client/trunk@3015 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 18 Oct 2011 15:20:24 +0000 |
parents | 92074508a387 |
children | fd408dfbd3b8 |
comparison
equal
deleted
inserted
replaced
1347:d81533df4138 | 1348:fb224f54c643 |
---|---|
91 /** | 91 /** |
92 * Initialize the window and set the layout. | 92 * Initialize the window and set the layout. |
93 */ | 93 */ |
94 protected void init() { | 94 protected void init() { |
95 setTitle(MSG.properties()); | 95 setTitle(MSG.properties()); |
96 setWidth(270); | |
97 setHeight(200); | |
98 setCanDragReposition(true); | 96 setCanDragReposition(true); |
99 setCanDragResize(true); | 97 setCanDragResize(true); |
100 | 98 |
101 layout.setWidth100(); | 99 layout.setWidth100(); |
102 layout.setHeight100(); | 100 layout.setHeight100(); |
119 | 117 |
120 buttons.addMember(accept); | 118 buttons.addMember(accept); |
121 buttons.addMember(cancel); | 119 buttons.addMember(cancel); |
122 buttons.setAlign(Alignment.RIGHT); | 120 buttons.setAlign(Alignment.RIGHT); |
123 | 121 |
124 layout.addMember(createPropertyGrid());; | 122 VLayout propGrid = createPropertyGrid(); |
123 | |
124 layout.addMember(propGrid); | |
125 layout.addMember(buttons); | 125 layout.addMember(buttons); |
126 addItem(layout); | 126 addItem(layout); |
127 setWidth(270); | |
128 setHeight(propGrid.getChildren().length * 25 + 50); | |
127 } | 129 } |
128 | 130 |
129 | 131 |
130 /** | 132 /** |
131 * Setter for the parent panel. | 133 * Setter for the parent panel. |
196 DynamicForm df = new DynamicForm(); | 198 DynamicForm df = new DynamicForm(); |
197 | 199 |
198 FormItem f; | 200 FormItem f; |
199 if(type.equals("int")) { | 201 if(type.equals("int")) { |
200 f = new SelectItem(name, dname); | 202 f = new SelectItem(name, dname); |
201 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>(); | 203 if (name.equals("linesize")) { |
202 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-"); | 204 f = createLineSizeUI(f); |
203 f.setImageURLSuffix("px.png"); | 205 } |
204 f.setValueIconHeight(20); | 206 else if (name.equals("textsize")) { |
205 f.setValueIconWidth(80); | 207 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); |
206 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); | 208 valueMap.put("3", "3"); |
207 valueMap.put("1", ""); | 209 valueMap.put("5", "5"); |
208 valueMap.put("2", ""); | 210 valueMap.put("8", "8"); |
209 valueMap.put("3", ""); | 211 valueMap.put("10", "10"); |
210 valueMap.put("4", ""); | 212 valueMap.put("12", "12"); |
211 valueMap.put("5", ""); | 213 valueMap.put("14", "14"); |
212 valueMap.put("6", ""); | 214 valueMap.put("18", "18"); |
213 valueMap.put("7", ""); | 215 valueMap.put("24", "24"); |
214 valueMap.put("8", ""); | 216 f.setValueMap(valueMap); |
215 valueIcons.put("1", "1"); | 217 } |
216 valueIcons.put("2", "2"); | |
217 valueIcons.put("3", "3"); | |
218 valueIcons.put("4", "4"); | |
219 valueIcons.put("5", "5"); | |
220 valueIcons.put("6", "6"); | |
221 valueIcons.put("7", "7"); | |
222 valueIcons.put("8", "8"); | |
223 f.setValueIcons(valueIcons); | |
224 f.setValueMap(valueMap); | |
225 f.setValue(value); | 218 f.setValue(value); |
226 } | 219 } |
227 else if (type.equals("boolean")) { | 220 else if (type.equals("boolean")) { |
228 CheckboxItem c = new CheckboxItem(name, dname); | 221 CheckboxItem c = new CheckboxItem(name, dname); |
229 if(value.equals("true")) { | 222 if(value.equals("true")) { |
245 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>(); | 238 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>(); |
246 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-dash-"); | 239 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-dash-"); |
247 f.setImageURLSuffix(".png"); | 240 f.setImageURLSuffix(".png"); |
248 f.setValueIconHeight(20); | 241 f.setValueIconHeight(20); |
249 f.setValueIconWidth(80); | 242 f.setValueIconWidth(80); |
250 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); | 243 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); |
251 valueMap.put("10", ""); | 244 valueMap.put("10", ""); |
252 valueMap.put("10,5", ""); | 245 valueMap.put("10,5", ""); |
253 valueMap.put("20,10", ""); | 246 valueMap.put("20,10", ""); |
254 valueMap.put("30,10", ""); | 247 valueMap.put("30,10", ""); |
255 valueMap.put("20,5,15,5", ""); | 248 valueMap.put("20,5,15,5", ""); |
260 valueIcons.put("20,5,15,5", "20-5-15-5"); | 253 valueIcons.put("20,5,15,5", "20-5-15-5"); |
261 f.setValueIcons(valueIcons); | 254 f.setValueIcons(valueIcons); |
262 f.setValueMap(valueMap); | 255 f.setValueMap(valueMap); |
263 f.setValue(value); | 256 f.setValue(value); |
264 } | 257 } |
258 else if (type.equals("Font")) { | |
259 f = new SelectItem(name, dname); | |
260 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); | |
261 valueMap.put("arial", "<span style='font-family:arial'>Arial</span>"); | |
262 valueMap.put("courier", "<span style='font-family:courier'>Courier</span>"); | |
263 valueMap.put("verdana", "<span style='font-family:verdana'>Verdana</span>"); | |
264 valueMap.put("times", "<span style='font-family:times'>Times</span>"); | |
265 f.setValueMap(valueMap); | |
266 f.setValue(value); | |
267 } | |
265 else { | 268 else { |
266 f = new FormItem(); | 269 f = new FormItem(); |
267 } | 270 } |
268 f.setTitleStyle("color:#000; width:120px"); | 271 f.setTitleStyle("color:#000; width:120px"); |
269 f.setTitleAlign(Alignment.LEFT); | 272 f.setTitleAlign(Alignment.LEFT); |
275 setNewValue(name, newValue); | 278 setNewValue(name, newValue); |
276 } | 279 } |
277 }); | 280 }); |
278 | 281 |
279 return df; | 282 return df; |
283 } | |
284 | |
285 | |
286 protected FormItem createLineSizeUI(FormItem f) { | |
287 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>(); | |
288 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-"); | |
289 f.setImageURLSuffix("px.png"); | |
290 f.setValueIconHeight(20); | |
291 f.setValueIconWidth(80); | |
292 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); | |
293 valueMap.put("1", ""); | |
294 valueMap.put("2", ""); | |
295 valueMap.put("3", ""); | |
296 valueMap.put("4", ""); | |
297 valueMap.put("5", ""); | |
298 valueMap.put("6", ""); | |
299 valueMap.put("7", ""); | |
300 valueMap.put("8", ""); | |
301 valueIcons.put("1", "1"); | |
302 valueIcons.put("2", "2"); | |
303 valueIcons.put("3", "3"); | |
304 valueIcons.put("4", "4"); | |
305 valueIcons.put("5", "5"); | |
306 valueIcons.put("6", "6"); | |
307 valueIcons.put("7", "7"); | |
308 valueIcons.put("8", "8"); | |
309 f.setValueIcons(valueIcons); | |
310 f.setValueMap(valueMap); | |
311 return f; | |
280 } | 312 } |
281 | 313 |
282 | 314 |
283 /** | 315 /** |
284 * Static method to convert a color from RGB to HTML notation. | 316 * Static method to convert a color from RGB to HTML notation. |