changeset 3846:84a48acabd78

Show full function instead of internal function name (#873). flys-client/trunk@5573 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Sat, 22 Sep 2012 22:26:38 +0000
parents 9d0ea03a8e9e
children f3b821735e39
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java
diffstat 2 files changed, 30 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Sep 21 14:39:38 2012 +0000
+++ b/flys-client/ChangeLog	Sat Sep 22 22:26:38 2012 +0000
@@ -1,3 +1,8 @@
+2012-09-22	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java:
+	  Show full function instead of internal name (#873).
+
 2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java	Fri Sep 21 14:39:38 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java	Sat Sep 22 22:26:38 2012 +0000
@@ -1,9 +1,5 @@
 package de.intevation.flys.client.client.ui.fixation;
 
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
@@ -18,7 +14,24 @@
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.DefaultDataItem;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 public class FixFunctionSelect extends FixationPanel {
+    private static final Map<String, String> funcDesc = new HashMap<String, String>();
+
+    static {
+        funcDesc.put("log", "W(Q) = m*ln(Q + b)");
+        funcDesc.put("linear", "W(Q) = m * Q + b");
+        funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)");
+        funcDesc.put("exp", "W(Q) = m * a^Q + b");
+        funcDesc.put("quad", "W(Q) = n*Q^2+m*Q+b");
+        funcDesc.put("pow", "W(Q) = a * Q^c + d");
+        funcDesc.put("sq-pow", "S(Q) = a * Q^b");
+    }
+
     /** The combobox.*/
     protected DynamicForm form;
 
@@ -45,7 +58,7 @@
             SelectItem combobox = new SelectItem(d.getLabel());
             combobox.setWidth(250);
 
-            LinkedHashMap<String, String> it = new LinkedHashMap<String, String>();
+            LinkedHashMap<String, String> funcTypes = new LinkedHashMap<String, String>();
 
             boolean  defaultSet = false;
             boolean  first      = true;
@@ -65,11 +78,11 @@
                     first = false;
                 }
 
-                it.put(item.getStringValue(), item.getLabel());
+                funcTypes.put(item.getStringValue(), item.getLabel());
             }
 
             label.setWidth(50);
-            combobox.setValueMap(it);
+            combobox.setValueMap(funcTypes);
             combobox.setShowTitle(false);
             form.setItems(combobox);
 
@@ -85,6 +98,7 @@
     }
 
 
+    @Override
     public Canvas createOld(DataList dataList) {
         HLayout layout  = new HLayout();
         VLayout vLayout = new VLayout();
@@ -101,8 +115,10 @@
             for (DataItem item: items) {
                 HLayout hLayout = new HLayout();
 
+                String desc = funcDesc.containsKey(item.getLabel()) ?
+                        funcDesc.get(item.getLabel()) : item.getLabel();
                 hLayout.addMember(label);
-                hLayout.addMember(new Label(item.getLabel()));
+                hLayout.addMember(new Label(desc));
 
                 vLayout.addMember(hLayout);
                 vLayout.setWidth("130px");
@@ -119,6 +135,7 @@
     }
 
 
+    @Override
     public Data[] getData() {
         Map values    = form.getValues();
         Iterator keys = values.keySet().iterator();

http://dive4elements.wald.intevation.org