changeset 4279:8cec61ac5160

Refactored DoubleInputPanel to allow input to data different than "outliers".
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 26 Oct 2012 16:44:10 +0200
parents efc731efa4a3
children a27e68562f2a
files flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java	Fri Oct 26 16:42:51 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java	Fri Oct 26 16:44:10 2012 +0200
@@ -39,8 +39,16 @@
 
     private double value;
 
+    protected String dataName;
+
 
     public DoubleInputPanel() {
+        dataName = "outliers";
+    }
+
+
+    public DoubleInputPanel(String dataName) {
+        this.dataName = dataName;
     }
 
 
@@ -71,7 +79,7 @@
 
         DynamicForm form = new DynamicForm();
         inputPanel = new TextItem();
-        inputPanel.setTitle("outliers");
+        inputPanel.setTitle(dataName);
         inputPanel.setShowTitle(false);
 
         if (defaultItem != null) {
@@ -86,6 +94,7 @@
         return layout;
     }
 
+
     protected Canvas createHelper() {
         return new VLayout();
     }
@@ -96,7 +105,7 @@
     public Canvas createOld(DataList dataList) {
         List<Data> items = dataList.getAll();
 
-        Data d = getData(items, "outliers");
+        Data d = getData(items, dataName);
         DataItem[] item = d.getItems();
 
         String v = item[0].getLabel();
@@ -133,9 +142,9 @@
         if(valid) {
 
             String vs = Double.valueOf(this.value).toString();
-            DataItem item = new DefaultDataItem("outliers", "outliers", vs);
+            DataItem item = new DefaultDataItem(dataName, dataName, vs);
             data.add(new DefaultData(
-                "outliers",
+                dataName, 
                 null,
                 null,
                 new DataItem[] { item }));

http://dive4elements.wald.intevation.org