changeset 1549:42f1213dfbcc

Let ManualPointEditor use RedrawRequests to let freshly edited points show up in Chart. flys-client/trunk@3780 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Jan 2012 09:26:53 +0000
parents e2f74131ffc1
children 9bf1ffd53dfb
files flys-client/ChangeLog 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 3 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jan 27 08:49:16 2012 +0000
+++ b/flys-client/ChangeLog	Fri Jan 27 09:26:53 2012 +0000
@@ -1,3 +1,11 @@
+2012-01-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
+	  Fire RedrawRequest when finished adding points.
+	
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
+	  Register RedrawRequestHandler with ManualPointsEditor.
+
 2012-01-27  Felix Wolfsteller <felix.wolfsteller@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/chart/ChartToolbar.java	Fri Jan 27 08:49:16 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Fri Jan 27 09:26:53 2012 +0000
@@ -208,7 +208,8 @@
 
     /** Open editor for custom points. */
     protected void openPointWindow() {
-        new ManualPointsEditor(chartTab.getView().getCollection()).show();
+        new ManualPointsEditor(chartTab.getView().getCollection(),
+            this.chartTab).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	Fri Jan 27 08:49:16 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Fri Jan 27 09:26:53 2012 +0000
@@ -33,8 +33,6 @@
 import de.intevation.flys.client.shared.model.CollectionItem;
 import de.intevation.flys.client.client.utils.DoubleValidator;
 
-import de.intevation.flys.client.client.services.CollectionAttributeService;
-import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync;
 import de.intevation.flys.client.client.services.LoadArtifactService;
 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
 import de.intevation.flys.client.client.services.FeedService;
@@ -45,6 +43,10 @@
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.Recommendation;
 
+import de.intevation.flys.client.client.event.RedrawRequestHandler;
+import de.intevation.flys.client.client.event.RedrawRequestEvent;
+import de.intevation.flys.client.client.event.RedrawRequestEvent.Type;
+
 
 /**
  * UI to enter point data and save it to an PointArtifact.
@@ -61,8 +63,8 @@
     // TODO with separate point sets in multiple diagrams, we might need
     //      different POINT_DATA-names (e.g. one per diagram).
 
-    protected CollectionAttributeServiceAsync updater =
-        GWT.create(CollectionAttributeService.class);
+    /** When we chaged something, we need a RedrawRequest(Handler). */
+    protected RedrawRequestHandler redrawRequestHandler;
 
     /** The collection */
     protected Collection collection;
@@ -86,8 +88,11 @@
      * Setup editor dialog.
      * @param collection The collection to use.
      */
-    public ManualPointsEditor(Collection collection) {
+    public ManualPointsEditor(Collection collection,
+        RedrawRequestHandler handler
+    ) {
         this.collection = collection;
+        this.redrawRequestHandler = handler;
         init();
     }
 
@@ -191,11 +196,14 @@
                             }
                             public void onSuccess(Artifact fartifact) {
                                 GWT.log("Successfully set points ");
-                                // TODO refresh view
+                                // TODO refresh collection such that next time
+                                //      the new points are shown.
                                 //requestRedraw();
                                 //updateCollection();
                                 //updateGrid();
                                 //enable();
+                                redrawRequestHandler.onRedrawRequest(
+                                    new RedrawRequestEvent(Type.DEFAULT));
                                 destroy();
                             }
                         });

http://dive4elements.wald.intevation.org