[Dive4elements-commits] [PATCH 8 of 9] Refactored DoubleInputPanel to allow input to data different than "outliers"

Wald Commits scm-commit at wald.intevation.org
Fri Oct 26 16:40:54 CEST 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1351262650 -7200
# Node ID 8cec61ac51606d89f40c9080f127824496bc8929
# Parent  efc731efa4a34c51b74f2846876ddbe4261ea749
Refactored DoubleInputPanel to allow input to data different than "outliers".

diff -r efc731efa4a3 -r 8cec61ac5160 flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java
--- 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 }));


More information about the Dive4elements-commits mailing list