# HG changeset patch # User Christian Lins # Date 1348352798 0 # Node ID 84a48acabd78245392e7fcf8480c1eeb6019b3f4 # Parent 9d0ea03a8e9e40048fe487bcd8ed8ad2628c5128 Show full function instead of internal function name (#873). flys-client/trunk@5573 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 9d0ea03a8e9e -r 84a48acabd78 flys-client/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, diff -r 9d0ea03a8e9e -r 84a48acabd78 flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java --- 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 funcDesc = new HashMap(); + + 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 it = new LinkedHashMap(); + LinkedHashMap funcTypes = new LinkedHashMap(); 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();