changeset 6017:bcaf66443b93

issue1261: when tab is created, jump navi to 'default'-km. This overcomes the issue that when editing a project (esp. range), the old value is remembered.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 14 May 2013 10:11:29 +0200
parents d24d29d9efa7
children ff70221c078b
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/NaviChartOutputTab.java
diffstat 1 files changed, 8 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/NaviChartOutputTab.java	Tue May 14 07:53:51 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/NaviChartOutputTab.java	Tue May 14 10:11:29 2013 +0200
@@ -137,24 +137,15 @@
         collectionView.setMaxKm(toKm);
 
         final NumberFormat nf = NumberFormat.getDecimalFormat();
-        if (collectionView.getCurrentKm() == -1d) {
-            try {
-                double d = Double.valueOf(fromKm);
-                currentkm.setValue(nf.format(d));
-            } catch (NumberFormatException e) {
-                currentkm.setValue(fromKm);
-            }
-            collectionView.setCurrentKm(fromKm);
+
+        // Always jump to the from km when initialized.
+        try {
+            double d = Double.valueOf(fromKm);
+            currentkm.setValue(nf.format(d));
+        } catch (NumberFormatException e) {
+            currentkm.setValue(fromKm);
         }
-        else {
-            try {
-                double d = Double.valueOf(fromKm);
-                currentkm.setValue(nf.format(d));
-            } catch (NumberFormatException e) {
-                currentkm.setValue(fromKm);
-            }
-            currentkm.setValue(collectionView.getCurrentKm());
-        }
+        collectionView.setCurrentKm(fromKm);
 
         lower.addClickHandler(new ClickHandler() {
             public void onClick(ClickEvent ce) {

http://dive4elements.wald.intevation.org