Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartPropertiesEditor.java @ 3511:57eb38260015
Show logo selection box for logo chart property.
flys-client/trunk@5281 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 28 Aug 2012 13:15:13 +0000 |
parents | 6352244a4153 |
children | b8a8ecdebc0d |
comparison
equal
deleted
inserted
replaced
3510:abc5957bfe1c | 3511:57eb38260015 |
---|---|
1 package de.intevation.flys.client.client.ui.chart; | 1 package de.intevation.flys.client.client.ui.chart; |
2 | 2 |
3 import java.util.LinkedHashMap; | |
3 import java.util.List; | 4 import java.util.List; |
4 import java.util.Map; | 5 import java.util.Map; |
5 | 6 |
6 import com.google.gwt.core.client.GWT; | 7 import com.google.gwt.core.client.GWT; |
7 import com.google.gwt.user.client.rpc.AsyncCallback; | 8 import com.google.gwt.user.client.rpc.AsyncCallback; |
17 import com.smartgwt.client.widgets.Canvas; | 18 import com.smartgwt.client.widgets.Canvas; |
18 | 19 |
19 import com.smartgwt.client.widgets.form.DynamicForm; | 20 import com.smartgwt.client.widgets.form.DynamicForm; |
20 import com.smartgwt.client.widgets.form.fields.FormItem; | 21 import com.smartgwt.client.widgets.form.fields.FormItem; |
21 import com.smartgwt.client.widgets.form.fields.CheckboxItem; | 22 import com.smartgwt.client.widgets.form.fields.CheckboxItem; |
23 import com.smartgwt.client.widgets.form.fields.SelectItem; | |
22 import com.smartgwt.client.widgets.form.fields.TextItem; | 24 import com.smartgwt.client.widgets.form.fields.TextItem; |
23 | 25 |
24 import com.smartgwt.client.widgets.events.ClickEvent; | 26 import com.smartgwt.client.widgets.events.ClickEvent; |
25 import com.smartgwt.client.widgets.events.ClickHandler; | 27 import com.smartgwt.client.widgets.events.ClickHandler; |
26 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; | 28 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; |
47 | 49 |
48 import de.intevation.flys.client.client.services.CollectionAttributeService; | 50 import de.intevation.flys.client.client.services.CollectionAttributeService; |
49 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync; | 51 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync; |
50 | 52 |
51 /** | 53 /** |
54 * Dialog for the Chart-Properties, constructed from respective xml document. | |
55 * | |
52 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | 56 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> |
53 */ | 57 */ |
54 public class ChartPropertiesEditor | 58 public class ChartPropertiesEditor |
55 extends Window | 59 extends Window |
56 implements ClickHandler | 60 implements ClickHandler |
157 addItem(buttons); | 161 addItem(buttons); |
158 setWidth(380); | 162 setWidth(380); |
159 setHeight(470); | 163 setHeight(470); |
160 centerInPage(); | 164 centerInPage(); |
161 } | 165 } |
166 | |
162 | 167 |
163 /** | 168 /** |
164 * This method is called when the user aborts theming. | 169 * This method is called when the user aborts theming. |
165 * @param event The event. | 170 * @param event The event. |
166 */ | 171 */ |
264 return null; | 269 return null; |
265 } | 270 } |
266 | 271 |
267 | 272 |
268 /** | 273 /** |
269 * | 274 * Generate a form with items for the properties/settings, preset with |
275 * values. | |
270 */ | 276 */ |
271 protected DynamicForm generatePropertySetting( | 277 protected DynamicForm generatePropertySetting( |
272 Property setting, | 278 Property setting, |
273 Property orig) | 279 Property orig) |
274 { | 280 { |
286 else if (setting instanceof IntegerProperty) { | 292 else if (setting instanceof IntegerProperty) { |
287 item = createIntegerProperty((IntegerProperty)setting); | 293 item = createIntegerProperty((IntegerProperty)setting); |
288 item.setValue(((IntegerProperty)orig).getValue()); | 294 item.setValue(((IntegerProperty)orig).getValue()); |
289 } | 295 } |
290 else if (setting instanceof StringProperty) { | 296 else if (setting instanceof StringProperty) { |
291 item = createStringProperty((StringProperty)setting); | 297 StringProperty property = (StringProperty) setting; |
298 item = createStringProperty(property); | |
292 item.setValue(((StringProperty)orig).getValue()); | 299 item.setValue(((StringProperty)orig).getValue()); |
300 } | |
301 else { | |
302 GWT.log("generatePropertySetting: unknown setting type."); | |
293 } | 303 } |
294 form.setFields(item); | 304 form.setFields(item); |
295 return form; | 305 return form; |
296 } | 306 } |
297 | 307 |
299 protected FormItem createStringProperty(final StringProperty sp) { | 309 protected FormItem createStringProperty(final StringProperty sp) { |
300 String name = sp.getName(); | 310 String name = sp.getName(); |
301 if (name.contains("-")) { | 311 if (name.contains("-")) { |
302 name = name.replace("-", "_"); | 312 name = name.replace("-", "_"); |
303 } | 313 } |
314 | |
315 String choiceAttribute = sp.getAttribute("choice"); | |
316 if (choiceAttribute != null && choiceAttribute.equals("logo")) { | |
317 SelectItem logoChooser = new SelectItem(); | |
318 LinkedHashMap valueMap = new LinkedHashMap<String, String>(); | |
319 valueMap.put("BfG", "Bfg"); | |
320 valueMap.put("Intevation", "Intevation"); | |
321 logoChooser.setValueMap(valueMap); | |
322 logoChooser.setTitleStyle("color:#000;"); | |
323 logoChooser.setTitleAlign(Alignment.LEFT); | |
324 logoChooser.setTitle(MSG.getString(name)); | |
325 logoChooser.setTitleAlign(Alignment.LEFT); | |
326 logoChooser.addBlurHandler(new BlurHandler() { | |
327 public void onBlur(BlurEvent e) { | |
328 String val; | |
329 if (e.getItem().getValue() == null) { | |
330 val = ""; | |
331 } | |
332 else { | |
333 val = e.getItem().getValue().toString(); | |
334 } | |
335 sp.setValue(val); | |
336 } | |
337 }); | |
338 return logoChooser; | |
339 } | |
340 | |
304 TextItem item = new TextItem(); | 341 TextItem item = new TextItem(); |
305 item.setTitle(MSG.getString(name)); | 342 item.setTitle(MSG.getString(name)); |
306 item.setTitleAlign(Alignment.LEFT); | 343 item.setTitleAlign(Alignment.LEFT); |
307 item.addBlurHandler(new BlurHandler() { | 344 item.addBlurHandler(new BlurHandler() { |
308 public void onBlur(BlurEvent e) { | 345 public void onBlur(BlurEvent e) { |