changeset 1568:2432973ccced

Handle manual points on a per-chart(type) basis. flys-client/trunk@3831 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 30 Jan 2012 13:36:10 +0000
parents 7e738bc8ed75
children b85761d21975
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/OutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java
diffstat 6 files changed, 35 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Jan 30 13:05:14 2012 +0000
+++ b/flys-client/ChangeLog	Mon Jan 30 13:36:10 2012 +0000
@@ -1,3 +1,16 @@
+2012-01-30  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
+	  Use outputmodes name to handle manual points on a per-chart basis.
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
+	  Pass outputmode name to ManualPointEditor.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/OutputTab.java:
+	  Add accessor to outputmode.
+
 2012-01-30  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/OutputTab.java	Mon Jan 30 13:05:14 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/OutputTab.java	Mon Jan 30 13:36:10 2012 +0000
@@ -62,5 +62,10 @@
     public Collection getCollection() {
         return collection;
     }
+
+
+    public OutputMode getMode() {
+        return mode;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Mon Jan 30 13:05:14 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Mon Jan 30 13:36:10 2012 +0000
@@ -638,5 +638,11 @@
         win.centerInPage();
         win.show();
     }
+
+
+    /** Get OutputMode of this Panel. */
+    public OutputMode getMode() {
+        return this.mode;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java	Mon Jan 30 13:05:14 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java	Mon Jan 30 13:36:10 2012 +0000
@@ -310,7 +310,7 @@
         editManualPoints.addClickHandler(new ClickHandler() {
                 public void onClick(MenuItemClickEvent evt) {
                     new ManualPointsEditor(view.getCollection(),
-                        redrawRequestHandlers.get(0)).show();
+                        redrawRequestHandlers.get(0), mode.getName()).show();
                 }
             });
         menu.addItem(editManualPoints);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Mon Jan 30 13:05:14 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Mon Jan 30 13:36:10 2012 +0000
@@ -209,7 +209,7 @@
     /** Open editor for custom points. */
     protected void openPointWindow() {
         new ManualPointsEditor(chartTab.getView().getCollection(),
-            this.chartTab).show();
+            this.chartTab, this.chartTab.getMode().getName()).show();
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Mon Jan 30 13:05:14 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Mon Jan 30 13:36:10 2012 +0000
@@ -90,16 +90,20 @@
     /** UUID of artifact to feed. */
     protected String uuid;
 
+    /** Name of the outputmode, important when feeding data. */
+    protected String outputModeName;
+
 
     /**
      * Setup editor dialog.
      * @param collection The collection to use.
      */
     public ManualPointsEditor(Collection collection,
-        RedrawRequestHandler handler
+        RedrawRequestHandler handler, String outputModeName
     ) {
         this.collection = collection;
         this.redrawRequestHandler = handler;
+        this.outputModeName = outputModeName;
         init();
     }
 
@@ -111,7 +115,8 @@
 
         for (int i = 0; i < size; i++) {
             CollectionItem item = collection.getItem(i);
-            String dataValue = (String) item.getData().get(POINT_DATA);
+            String dataValue = (String) item.getData().get(outputModeName
+                + "." + POINT_DATA);
             if (dataValue != null) {
                 // Found it.
                 uuid = item.identifier();
@@ -232,7 +237,7 @@
 
         // Add points to grid.
         if (item != null) {
-            String jsonData = item.getData().get(POINT_DATA);
+            String jsonData = item.getData().get(outputModeName + "." + POINT_DATA);
             JSONArray jsonArray = (JSONArray) JSONParser.parse(jsonData);
             for (int i = 0; i < jsonArray.size(); i++) {
                 JSONArray point = (JSONArray) jsonArray.get(i);
@@ -321,7 +326,7 @@
             JSONArray list = jsonArrayFromListGrid();
 
             Data[] feedData = new Data[] {
-                DefaultData.createSimpleStringData(POINT_DATA,
+                DefaultData.createSimpleStringData(outputModeName + "." + POINT_DATA,
                     list.toString())
             };
 

http://dive4elements.wald.intevation.org