changeset 1472:a2b0b2af529f

Tell master-artifact of collection when cross-section-master changed kilometer. flys-client/trunk@3517 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 22 Dec 2011 07:17:52 +0000
parents e125f889cf2f
children 71ba43bd0e3f
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
diffstat 2 files changed, 26 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Dec 22 07:07:54 2011 +0000
+++ b/flys-client/ChangeLog	Thu Dec 22 07:17:52 2011 +0000
@@ -1,3 +1,10 @@
+2011-12-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java:
+	  When changing cross-section-masters kilometer in cross sections,
+	  also feed the collection-master-artifact with the kilometer, so that
+	  it can be displayed in the diagrams subtitle.
+
 2011-12-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Thu Dec 22 07:07:54 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Thu Dec 22 07:17:52 2011 +0000
@@ -44,6 +44,8 @@
 import de.intevation.flys.client.client.services.LoadArtifactService;
 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
 
+import de.intevation.flys.client.client.ui.CollectionView;
+
 
 
 /**
@@ -126,7 +128,8 @@
                 }
                 if (!value.equals("0")) {
                     setCurrentCSMaster(theme.getArtifact());
-                    GWT.log("found a master: " + currentCSMasterUUID + "/" + theme.getDescription());
+                    GWT.log("found a master: " + currentCSMasterUUID
+                        + "/" + theme.getDescription());
                     return theme.getDescription();
                 }
             }
@@ -249,16 +252,10 @@
     }
 
 
-    /** Feed the master (WINFO) artifact with the km of the crosssection, 
-     * such that it can be displayed in the diagrams subtitle. */
-    public void sendFeed(double kmD) {
-        ;
-    }
-
     /** Feed a single artifact with the km of the crosssection to display. */
-    public void sendFeed(FacetRecord facetRecord, double kmD) {
-        Config config          = Config.getInstance();
-        final String locale    = config.getLocale();
+    public void sendFeed(final String artUUID, final double kmD) {
+        Config config       = Config.getInstance();
+        final String locale = config.getLocale();
 
         Data[] feedData =
             DefaultData.createSimpleStringDataArray("cross_section.km",
@@ -268,7 +265,7 @@
         feedService.feed(
             locale,
             new DefaultArtifact(
-                facetRecord.getTheme().getArtifact(),
+                artUUID,
                 "TODO:hash"),
             feedData,
             new AsyncCallback<Artifact>() {
@@ -280,10 +277,16 @@
                 }
                 @Override
                 public void onSuccess(Artifact artifact) {
-                    GWT.log("Successfully fed");
+                    GWT.log("Successfully fed with km");
                     requestRedraw();
-                    // TODO also feed the winfo/masterartifact? (for plot subtitle)
-                    enable();
+                    // Also feed the winfo/masterartifact (for plot subtitle)
+                    if (artUUID.equals(getCurrentCSMaster())
+                        && !artUUID.equals(view.getArtifact().getUuid())) {
+                        sendFeed(view.getArtifact().getUuid(), kmD);
+                    }
+                    else {
+                        enable();
+                    }
                 }
         });
     }
@@ -353,7 +356,8 @@
                                     + closest);
                                 SpinnerItem item = (SpinnerItem) ce.getItem();
                                 item.setValue(closest);
-                                sendFeed(facetRecord, closest);
+                                sendFeed(facetRecord.getTheme().getArtifact(),
+                                         closest);
                             }
                             });
                 }

http://dive4elements.wald.intevation.org