changeset 1554:ae25566ce6f6

Implemented the createOld() method in RangePanel. flys-client/trunk@3793 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 27 Jan 2012 12:47:25 +0000
parents 9ad19e31d149
children c057ef91b268
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/RangePanel.java flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerRangeData.java flys-client/src/main/java/de/intevation/flys/client/shared/model/RangeData.java
diffstat 5 files changed, 79 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jan 27 12:03:04 2012 +0000
+++ b/flys-client/ChangeLog	Fri Jan 27 12:47:25 2012 +0000
@@ -1,3 +1,18 @@
+2012-01-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/RangeData.java: New
+	  interface for ranges that declares two methods getUpper() and getLower().
+
+	* src/main/java/de/intevation/flys/client/shared/model/IntegerRangeData.java:
+	  Subclasses RangeData.
+
+	* src/main/java/de/intevation/flys/client/client/ui/RangePanel.java:
+	  Implemented the createOld() method.
+
+	* src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java:
+	  Cast objects returned by IntegerRangeData's getLower() and getUpper()
+	  method to Integer. The signature of both methods have changed slightly.
+
 2012-01-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java	Fri Jan 27 12:03:04 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java	Fri Jan 27 12:47:25 2012 +0000
@@ -119,7 +119,7 @@
 
     protected void setMaxLower(DataList dataList) {
         IntegerRangeData range = (IntegerRangeData) dataList.get(0);
-        setMaxLower(range.getLower());
+        setMaxLower((Integer) range.getLower());
     }
 
 
@@ -135,7 +135,7 @@
 
     protected void setMaxUpper(DataList dataList) {
         IntegerRangeData range = (IntegerRangeData) dataList.get(0);
-        setMaxUpper(range.getUpper());
+        setMaxUpper((Integer) range.getUpper());
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/RangePanel.java	Fri Jan 27 12:03:04 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/RangePanel.java	Fri Jan 27 12:47:25 2012 +0000
@@ -15,6 +15,8 @@
 
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataItem;
+import de.intevation.flys.client.shared.model.RangeData;
 
 
 /**
@@ -49,9 +51,24 @@
 
 
     @Override
-    public Canvas createOld(DataList data) {
-        // TODO IMPLEMENT ME
-        return new Canvas();
+    public Canvas createOld(DataList dataList) {
+        Data       data  = dataList.get(0);
+        DataItem[] items = data.getItems();
+
+        HLayout layout = new HLayout();
+
+        Label label = new Label(dataList.getLabel());
+        label.setWidth(200);
+        label.setHeight(20);
+
+        Label value = new Label(items[0].getLabel());
+        value.setHeight(20);
+
+        layout.addMember(label);
+        layout.addMember(value);
+        layout.addMember(getBackButton(dataList.getState()));
+
+        return layout;
     }
 
 
@@ -77,6 +94,21 @@
     }
 
 
+    protected RangeData findRangeData(DataList dataList) {
+        RangeData data = null;
+
+        for (int i = 0, n = dataList.size(); i < n; i++) {
+            Data tmp = dataList.get(i);
+
+            if (tmp instanceof RangeData) {
+                return (RangeData) tmp;
+            }
+        }
+
+        return null;
+    }
+
+
     protected void setDataName(DataList dataList) {
         Data data = dataList.get(0);
 
@@ -100,9 +132,15 @@
 
 
     protected Canvas createLabel(DataList dataList) {
-        Label label = new Label(dataList.getLabel());
+        RangeData rangeData = findRangeData(dataList);
 
-        label.setWidth(100);
+        if (rangeData == null) {
+            return new Canvas();
+        }
+
+        Label label = new Label(rangeData.getDescription());
+
+        label.setWidth100();
         label.setHeight(25);
 
         return label;
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerRangeData.java	Fri Jan 27 12:03:04 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerRangeData.java	Fri Jan 27 12:47:25 2012 +0000
@@ -1,7 +1,10 @@
 package de.intevation.flys.client.shared.model;
 
 
-public class IntegerRangeData implements Data {
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class IntegerRangeData implements RangeData {
 
     protected String label;
     protected String description;
@@ -78,12 +81,12 @@
     }
 
 
-    public int getLower() {
+    public Object getLower() {
         return lower;
     }
 
 
-    public int getUpper() {
+    public Object getUpper() {
         return upper;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/RangeData.java	Fri Jan 27 12:47:25 2012 +0000
@@ -0,0 +1,13 @@
+package de.intevation.flys.client.shared.model;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface RangeData extends Data {
+
+    Object getLower();
+
+    Object getUpper();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org