changeset 1297:887eb0cd7dfc

Bugfix: #375 Limit the number of fractions in the result of the measure controls (in the map). flys-client/trunk@2918 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 10 Oct 2011 09:31:08 +0000
parents c087137a8584
children b0ed67cb5197
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MeasureControl.java
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Oct 10 09:06:01 2011 +0000
+++ b/flys-client/ChangeLog	Mon Oct 10 09:31:08 2011 +0000
@@ -1,3 +1,11 @@
+2011-10-10  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue375 (ÜSK, Streckemessung)
+
+	* src/main/java/de/intevation/flys/client/client/ui/map/MeasureControl.java:
+	  Added a formatter for lines and areas which is used to limit the number
+	  of fractions.
+
 2011-10-10  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/DataList.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MeasureControl.java	Mon Oct 10 09:06:01 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MeasureControl.java	Mon Oct 10 09:31:08 2011 +0000
@@ -1,6 +1,7 @@
 package de.intevation.flys.client.client.ui.map;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.NumberFormat;
 
 import com.smartgwt.client.types.SelectionType;
 import com.smartgwt.client.widgets.ImgButton;
@@ -22,6 +23,8 @@
 
 public class MeasureControl extends HLayout {
 
+    public static final String NUMBER_FORMAT_PATTERN = "#.##";
+
     protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
     protected FloodMap floodMap;
@@ -33,6 +36,8 @@
     protected ImgButton measurePolyButton;
     protected Label     label;
 
+    protected NumberFormat formatter;
+
 
     public MeasureControl(FloodMap floodMap, EnableDisableCmd cmd) {
         this.floodMap = floodMap;
@@ -40,6 +45,8 @@
         measureLineButton = createMeasureLineControl(cmd);
         measurePolyButton = createMeasurePolyControl(cmd);
 
+        formatter = NumberFormat.getFormat(NUMBER_FORMAT_PATTERN);
+
         label = new Label();
 
         initLayout();
@@ -144,7 +151,7 @@
 
 
     protected void updateMeasure(float value, String unit) {
-        label.setContents(String.valueOf(value) + " " + unit);
+        label.setContents(formatter.format(value) + " " + unit);
     }
 
 

http://dive4elements.wald.intevation.org