changeset 2538:c7da05282644

FixPeriodPanel: Make the names of state parameters configurable by constructor. flys-client/trunk@4458 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 22 May 2012 13:20:52 +0000
parents cc5969df0490
children a9cdd62aa73e
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java
diffstat 3 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon May 21 09:22:29 2012 +0000
+++ b/flys-client/ChangeLog	Tue May 22 13:20:52 2012 +0000
@@ -1,3 +1,12 @@
+2012-05-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java:
+	  Make the names of state parameters configurable by constructor.
+
+	* src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java:
+	  Create specialized FixPeriodPanels when using "fix.period_ref_panel" or
+	  "fix.period_ana_panel" provider types.
+
 2012-05-21  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Mon May 21 09:22:29 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Tue May 22 13:20:52 2012 +0000
@@ -91,6 +91,12 @@
         else if (uiProvider.equals("fix.period_panel")) {
             return new FixPeriodPanel();
         }
+        else if (uiProvider.equals("fix.period_ref_panel")) {
+            return new FixPeriodPanel("ref_start", "ref_end");
+        }
+        else if (uiProvider.equals("fix.period_ana_panel")) {
+            return new FixPeriodPanel("ana_start", "ana_end");
+        }
         else if (uiProvider.equals("fix.gaugeselect_panel")) {
             return new FixGaugeSelectPanel();
         }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Mon May 21 09:22:29 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Tue May 22 13:20:52 2012 +0000
@@ -43,7 +43,16 @@
     long start;
     long end;
 
+    protected String startName;
+    protected String endName;
+
     public FixPeriodPanel() {
+        this("start", "end");
+    }
+
+    public FixPeriodPanel(String startName, String endName) {
+        this.startName = startName;
+        this.endName   = endName;
         htmlOverview = "";
     }
 
@@ -72,8 +81,8 @@
     public Canvas createOld(DataList dataList) {
         List<Data> items = dataList.getAll();
 
-        Data start = getData(items, "start");
-        Data end   = getData(items, "end");
+        Data start = getData(items, startName);
+        Data end   = getData(items, endName);
         DataItem[] startItem = start.getItems();
         DataItem[] endItem = end.getItems();
 
@@ -132,15 +141,15 @@
             this.fixFilter.setToDate(this.end);
             String start = Long.valueOf(this.start).toString();
             String end   = Long.valueOf(this.end).toString();
-            DataItem startItem = new DefaultDataItem("start", "start", start);
-            DataItem endItem   = new DefaultDataItem("end", "end", end);
+            DataItem startItem = new DefaultDataItem(startName, startName, start);
+            DataItem endItem   = new DefaultDataItem(endName, endName, end);
             data.add(new DefaultData(
-                "start",
+                startName,
                 null,
                 null,
                 new DataItem[] { startItem }));
             data.add(new DefaultData(
-                "end",
+                endName,
                 null,
                 null,
                 new DataItem[] { endItem }));

http://dive4elements.wald.intevation.org