changeset 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 abc5957bfe1c
children b8a8ecdebc0d
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartPropertiesEditor.java
diffstat 2 files changed, 44 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Aug 28 13:14:03 2012 +0000
+++ b/flys-client/ChangeLog	Tue Aug 28 13:15:13 2012 +0000
@@ -1,3 +1,8 @@
+2012-08-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartPropertiesEditor.java:
+	  Special chart properties should trigger different ui (logo select box).
+
 2012-08-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartPropertiesEditor.java	Tue Aug 28 13:14:03 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartPropertiesEditor.java	Tue Aug 28 13:15:13 2012 +0000
@@ -1,5 +1,6 @@
 package de.intevation.flys.client.client.ui.chart;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -19,6 +20,7 @@
 import com.smartgwt.client.widgets.form.DynamicForm;
 import com.smartgwt.client.widgets.form.fields.FormItem;
 import com.smartgwt.client.widgets.form.fields.CheckboxItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
 import com.smartgwt.client.widgets.form.fields.TextItem;
 
 import com.smartgwt.client.widgets.events.ClickEvent;
@@ -49,6 +51,8 @@
 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync;
 
 /**
+ * Dialog for the Chart-Properties, constructed from respective xml document.
+ *
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  */
 public class ChartPropertiesEditor
@@ -160,6 +164,7 @@
         centerInPage();
     }
 
+
     /**
      * This method is called when the user aborts theming.
      * @param event The event.
@@ -266,7 +271,8 @@
 
 
     /**
-     *
+     * Generate a form with items for the properties/settings, preset with
+     * values.
      */
     protected DynamicForm generatePropertySetting(
         Property setting,
@@ -288,9 +294,13 @@
             item.setValue(((IntegerProperty)orig).getValue());
         }
         else if (setting instanceof StringProperty) {
-            item = createStringProperty((StringProperty)setting);
+            StringProperty property = (StringProperty) setting;
+            item = createStringProperty(property);
             item.setValue(((StringProperty)orig).getValue());
         }
+        else {
+            GWT.log("generatePropertySetting: unknown setting type.");
+        }
         form.setFields(item);
         return form;
     }
@@ -301,6 +311,33 @@
         if (name.contains("-")) {
             name = name.replace("-", "_");
         }
+
+        String choiceAttribute = sp.getAttribute("choice");
+        if (choiceAttribute != null && choiceAttribute.equals("logo")) {
+            SelectItem logoChooser = new SelectItem();
+            LinkedHashMap valueMap = new LinkedHashMap<String, String>();
+            valueMap.put("BfG", "Bfg");
+            valueMap.put("Intevation", "Intevation");
+            logoChooser.setValueMap(valueMap);
+            logoChooser.setTitleStyle("color:#000;");
+            logoChooser.setTitleAlign(Alignment.LEFT);
+            logoChooser.setTitle(MSG.getString(name));
+            logoChooser.setTitleAlign(Alignment.LEFT);
+            logoChooser.addBlurHandler(new BlurHandler() {
+                public void onBlur(BlurEvent e) {
+                    String val;
+                    if (e.getItem().getValue() == null) {
+                        val = "";
+                    }
+                    else {
+                        val = e.getItem().getValue().toString();
+                    }
+                    sp.setValue(val);
+                }
+            });
+            return logoChooser;
+        }
+
         TextItem item = new TextItem();
         item.setTitle(MSG.getString(name));
         item.setTitleAlign(Alignment.LEFT);

http://dive4elements.wald.intevation.org