changeset 2922:71db63f67d31

FixA: Do not throw layout away if only the km chart needs reloading. flys-client/trunk@4777 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 25 Jun 2012 13:50:22 +0000
parents 96d02c6f44a2
children 43e0f6d96206
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java
diffstat 2 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Sat Jun 23 08:16:40 2012 +0000
+++ b/flys-client/ChangeLog	Mon Jun 25 13:50:22 2012 +0000
@@ -1,3 +1,9 @@
+2012-06-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java:
+	  Do not throw layout away if only the km chart needs reloading.
+	  Fix floating point vs. integer rounding issues.
+
 2012-06-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Sat Jun 23 08:16:40 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Mon Jun 25 13:50:22 2012 +0000
@@ -235,18 +235,15 @@
             km = 0;
         }
         art.getFilter().setCurrentKm(km);
-        if (chartContainer.hasMember(chartImg)) {
-            chartContainer.removeMember(chartImg);
-        }
 
         int hWidth = helperContainer.getWidth() - 12;
         int hHeight = helperContainer.getHeight() - 62;
 
-        if ((int)(hHeight *4/3) < hWidth) {
-            hWidth = (int)hHeight * 4/3;
+        if ((int)(hHeight *4f/3) < hWidth) {
+            hWidth = (int)(hHeight * 4f/3);
         }
         else {
-            hHeight = (int)hWidth *3/4;
+            hHeight = (int)(hWidth *3f/4);
         }
 
         String imgUrl = GWT.getModuleBaseURL();
@@ -254,9 +251,15 @@
         imgUrl += "?locale=" + locale;
         imgUrl += "&filter=" + art.getFilter().getChartFilter(hWidth, hHeight);
 
-        chartImg = new Img(imgUrl, hWidth, hHeight);
-        chartContainer.addMember(chartImg);
-
+        if (chartContainer.hasMember(chartImg)) {
+            chartImg.setWidth(hWidth);
+            chartImg.setHeight(hHeight);
+            chartImg.setSrc(imgUrl);
+        }
+        else {
+            chartImg = new Img(imgUrl, hWidth, hHeight);
+            chartContainer.addMember(chartImg);
+        }
     }
 
 

http://dive4elements.wald.intevation.org