changeset 2526:a911e2968cb1

Changed some data types in states and filter and added new preprocessing state to ui provider factory. flys-client/trunk@4415 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 15 May 2012 15:33:43 +0000
parents da1d897ed66d
children c8413741339f
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/FixEventSelect.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java
diffstat 7 files changed, 95 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/ChangeLog	Tue May 15 15:33:43 2012 +0000
@@ -1,3 +1,19 @@
+2012-05-15  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java:
+	  Changed filter data types.
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java:
+	  Add data to filterobject.
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java:
+	  Changed data type for this state.
+
+	* src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java:
+	  Added preprocessing state.
+
 2012-05-15  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Tue May 15 15:33:43 2012 +0000
@@ -97,6 +97,9 @@
         else if (uiProvider.equals("fix.event_panel")) {
             return new FixEventSelect();
         }
+        else if (uiProvider.equals("fix.preprocessing_panel")) {
+            return new BooleanPanel();
+        }
         else if (uiProvider.equals("parameter-matrix")) {
             return new ParameterMatrixPanel();
         }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java	Tue May 15 15:33:43 2012 +0000
@@ -3,7 +3,12 @@
 import java.util.List;
 import java.util.ArrayList;
 
+import java.lang.NumberFormatException;
+
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import com.smartgwt.client.util.SC;
 
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
@@ -11,10 +16,20 @@
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
+import de.intevation.flys.client.client.Config;
 import de.intevation.flys.client.client.FLYSConstants;
 
 import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataItem;
 import de.intevation.flys.client.shared.model.DataList;
+import de.intevation.flys.client.shared.model.DefaultData;
+import de.intevation.flys.client.shared.model.DefaultDataItem;
+import de.intevation.flys.client.shared.model.IntegerArrayData;
+import de.intevation.flys.client.shared.model.FixingsOverviewInfo;
+import de.intevation.flys.client.shared.model.FixingsOverviewInfo.FixEvent;
+
+import de.intevation.flys.client.client.services.FixingsOverviewService;
+import de.intevation.flys.client.client.services.FixingsOverviewServiceAsync;
 
 /**
  * This UIProvider creates a panel for location or distance input.
@@ -27,6 +42,9 @@
     /** The message class that provides i18n strings. */
     protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
 
+    protected FixingsOverviewServiceAsync overviewService =
+        GWT.create(FixingsOverviewService.class);
+
     protected List<String> events;
 
     public FixEventSelect() {
@@ -48,6 +66,13 @@
 
     @Override
     public Canvas createOld(DataList dataList) {
+        List<Data> list = dataList.getAll();
+
+        Data data = getData(list, "events");
+
+        VLayout dataLayout = new VLayout();
+        dataLayout.setWidth(130);
+
         HLayout layout = new HLayout();
         layout.setWidth("400px");
 
@@ -57,6 +82,7 @@
         Canvas back = getBackButton(dataList.getState());
 
         layout.addMember(label);
+        layout.addMember(dataLayout);
         layout.addMember(back);
 
         return layout;
@@ -71,6 +97,26 @@
     public Data[] getData() {
         List<Data> data = new ArrayList<Data>();
 
+        if (events.size() > 0) {
+            int[] arr = new int[events.size()];
+            for (int i = 0; i < events.size(); i++) {
+                GWT.log("event: " + events.get(i));
+                try {
+                    Integer v = new Integer(events.get(i));
+                    arr[i] = v.intValue();
+                }
+                catch (NumberFormatException nfe) {
+                    return  (Data[]) data.toArray(new Data[data.size()]);
+                }
+            }
+            fixFilter.setEvents(arr);
+
+            IntegerArrayData iad =
+                new IntegerArrayData("events", "events", arr);
+
+            data.add(iad);
+        }
+
         return (Data[]) data.toArray(new Data[data.size()]);
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Tue May 15 15:33:43 2012 +0000
@@ -174,6 +174,9 @@
             if (v1i <= v2i) {
                 this.first = v1;
                 this.second = v2;
+
+                this.fixFilter.setFromClass(v1i);
+                this.fixFilter.setToClass(v2i);
                 return true;
             }
         }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java	Tue May 15 15:33:43 2012 +0000
@@ -123,6 +123,8 @@
 
         boolean valid = saveRangeValues(inputPanel);
         if (valid) {
+            this.fixFilter.setFromKm(this.from);
+            this.fixFilter.setToKm(this.to);
             String f = Double.valueOf(this.from).toString();
             String t = Double.valueOf(this.to).toString();
             String s = Double.valueOf(this.step).toString();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Tue May 15 15:33:43 2012 +0000
@@ -107,6 +107,8 @@
 
         boolean valid = saveDateValues();
         if(valid) {
+            this.fixFilter.setFromDate(this.start);
+            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);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Tue May 15 14:24:09 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Tue May 15 15:33:43 2012 +0000
@@ -128,7 +128,7 @@
         final HTMLPane eventPane = new HTMLPane();
 
         String river = artifact.getArtifactDescription().getRiver();
-
+        fixFilter.setRiver(river);
         createCallback();
 /*
 Filter example.
@@ -139,7 +139,7 @@
         overviewService.generateOverview(
             locale,
             artifact.getUuid(),
-            "{\"fixings\": {\"river\": {\"name\": \"" + river + "\"}}}",
+            fixFilter.getOverviewFilter(),
             renderCheckboxes(),
             callBack,
             new AsyncCallback<FixingsOverviewInfo>() {
@@ -303,11 +303,23 @@
         protected double currentKm;
         protected int fromClass;
         protected int toClass;
-        protected Date fromDate;
-        protected Date toDate;
+        protected long fromDate;
+        protected long toDate;
+        protected boolean hasDate;
         protected int[] events;
 
-        public FixFilter() {}
+        public FixFilter() {
+            this.river = "";
+            this.fromKm = -1d;
+            this.toKm = -1;
+            this.currentKm = -1;
+            this.fromClass = -1;
+            this.toClass = -1;
+            this.fromDate = -1;
+            this.toDate = -1;
+            this.hasDate = false;
+            this.events = new int[0];
+        }
 
         public void setRiver(String river) {
             this.river = river;
@@ -333,11 +345,13 @@
             this.toClass = to;
         }
 
-        public void setFromDate(Date from) {
+        public void setFromDate(long from) {
+            this.hasDate = true;
             this.fromDate = from;
         }
 
-        public void setToDate(Date to) {
+        public void setToDate(long to) {
+            this.hasDate = true;
             this.toDate = to;
         }
 
@@ -369,11 +383,11 @@
             return this.toClass;
         }
 
-        public Date getFromDate() {
+        public long getFromDate() {
             return this.fromDate;
         }
 
-        public Date getToDate() {
+        public long getToDate() {
             return this.toDate;
         }
 

http://dive4elements.wald.intevation.org