changeset 9069:1ffd38826175

access uinfo.vegetationzones+inundation_duration
author gernotbelger
date Tue, 15 May 2018 12:00:26 +0200
parents a5cf8d7bff3c
children 611a523fc42f
files artifacts/doc/conf/artifacts/uinfo.xml artifacts/src/main/java/org/dive4elements/river/artifacts/common/AccessHelper.java artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesState.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationzonesAccess.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SuperVegZonesTablePanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java
diffstat 15 files changed, 284 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/uinfo.xml	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/doc/conf/artifacts/uinfo.xml	Tue May 15 12:00:26 2018 +0200
@@ -104,9 +104,9 @@
         </outputmode>
       </outputmodes>
     </state>
-    
-    
-    
+
+
+
 
 
     <!-- Calculation Mode: Inundation Duration -->
@@ -183,8 +183,8 @@
 
     <state id="state.uinfo.inundation.scenario" description="state.uinfo.inundation.scenario" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadScenarioSelect" helpText="help.state.uinfo.use_scenario">
       <data name="sedimentheight" type="String" /> <!-- mittelwasserlage in cm! -->
-      </state>
-  
+    </state>
+
     <state id="state.uinfo.inundation.vegetation" description="state.uinfo.inundation.vegetation" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableState" helpText="help.state.uinfo.use_scenario">
       <data name="vegzones" type="String" />
     </state>
@@ -262,7 +262,7 @@
 
 
     <state id="state.uinfo.vegetation_zones.table" description="state.uinfo.vegetation_zones.table" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableEditState" helpText="help.state.uinfo.vegetation_zones">
-    <data name="vegzones" type="String" />
+      <data name="vegzones" type="String" />
     </state>
 
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AccessHelper.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AccessHelper.java	Tue May 15 12:00:26 2018 +0200
@@ -37,14 +37,14 @@
     }
 
     /** [year1, years2,..] if its about years. */
-    public int[] getYears(final String yearSelectedValue) {
+    public int[] getYears(final String yearSelectedValue, final String yearKey) {
         int[] years = null;
         // if (years != null) {
         // return years;
         // }
         if (getYearEpoch().equals(yearSelectedValue)) {
             final TIntArrayList ints = new TIntArrayList();
-            final String yearsData = getString("years");
+            final String yearsData = getString(yearKey);
             if (yearsData == null || yearsData.isEmpty()) {
                 log.warn("No years provided");
                 return null;
@@ -69,7 +69,7 @@
         return null;
     }
 
-    public int[][] getEpochs(final String epochSelectedValue) {
+    public int[][] getEpochs(final String epochSelectedValue, final String epochKey) {
         int epochs[][] = null;
         // if (epochs != null) {
         // return epochs;
@@ -79,7 +79,7 @@
             return null;
         }
 
-        final String data = getString("epochs");
+        final String data = getString(epochKey);
 
         if (data == null) {
             log.warn("No 'epochs' parameter specified!");
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/CollisionAccess.java	Tue May 15 12:00:26 2018 +0200
@@ -52,11 +52,11 @@
     }
 
     public int[] getYears() {
-        return this.helper.getYears("state.sinfo.year");
+        return this.helper.getYears("state.sinfo.year", "years");
     }
 
     public int[][] getEpochs() {
-        return this.helper.getEpochs("state.sinfo.epoch");
+        return this.helper.getEpochs("state.sinfo.epoch", "epochs");
     }
 
 }
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/commons/UInfoResultType.java	Tue May 15 12:00:26 2018 +0200
@@ -110,8 +110,9 @@
 
         @Override
         public String exportValue(final CallContext context, final Object value) {
-            final double doubleValue = asDouble(value);
-            return exportDoubleValue(context, doubleValue);
+            return exportStringValue(value);
+            // final double doubleValue = asDouble(value);
+            // return exportDoubleValue(context, doubleValue);
         }
 
         @Override
@@ -127,8 +128,9 @@
 
         @Override
         public String exportValue(final CallContext context, final Object value) {
-            final double doubleValue = asDouble(value);
-            return exportDoubleValue(context, doubleValue);
+            return exportStringValue(value);
+            // final double doubleValue = asDouble(value);
+            // return exportDoubleValue(context, doubleValue);
         }
 
         @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationAccess.java	Tue May 15 12:00:26 2018 +0200
@@ -0,0 +1,102 @@
+/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.uinfo.inundationduration;
+
+import java.util.ArrayList;
+
+import org.apache.commons.lang.math.DoubleRange;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+import org.dive4elements.river.artifacts.common.AccessHelper;
+import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
+import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode;
+
+/**
+ * Access to the flow depth calculation type specific SInfo artifact data.
+ * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent
+ * reference to the artifact instance.
+ * Hence we do NOT cache any data.
+ *
+ * @author Gernot Belger
+ */
+final class InundationDurationAccess extends RangeAccess {
+
+    // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR
+    public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
+    public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
+    private final AccessHelper helper;
+
+    // Fields from state:
+    //
+    // calculation_mode (String)
+    // ld_from, ld_to
+    // ye_select (String; state.uinfo.totalepoch oder state.uinfo.year)
+    // singleyear (String)
+    // totalepoch (String; TODO: minmax totalEpoch herausfinden und setzen (nicht hier.. aber trotzdem die Erinnerung hier))
+    // use_scenario boolean (danach kommt kein radioBtn, sondern sedimentheight-Eingabe)
+    // sedimentheight String
+    //
+    // vegzones (String) TODO: MIT VegetationzonesAccess zusammenlegen
+
+    public InundationDurationAccess(final UINFOArtifact uinfo) {
+        super(uinfo);
+
+        /* assert calculation mode */
+        final UinfoCalcMode calculationMode = uinfo.getCalculationMode();
+        this.helper = new AccessHelper(uinfo);
+        assert (calculationMode == UinfoCalcMode.uinfo_inundation_duration);
+    }
+
+    public DoubleRange getRange() {
+        final double from = getFrom();
+        final double to = getTo();
+        return new DoubleRange(from, to);
+    }
+
+    public Double getSedimentHeight() {
+        if (super.getBoolean("use_scenario")) {
+            return super.getDouble("sedimentheight"); // TODO: INPUT Valdiation (nicht hier, sondern im Panel. Erinnerung)
+        }
+        return null;
+    }
+
+    public Integer getYear() {
+        final int[] years = this.helper.getYears("state.uinfo.year", "singleyear");
+        if (years != null) {
+            return years[0];
+        }
+        return null;
+    }
+
+    public int[] getTotalEpoch() {
+        final int[][] epochs = this.helper.getEpochs("state.uinfo.totalepoch", "totalepoch");
+        if (epochs != null) {
+            return epochs[0];
+        }
+        return null;
+    }
+
+    public ArrayList<String[]> getVegZones() {
+        // TODO: MIT VegetationzonesAccess zusammenlegen
+        final ArrayList<String[]> results = new ArrayList<>();
+        final String zonesRaw = super.getString("vegzones");
+        if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) {
+            final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR);
+            for (final String row : rows) {
+                if (row.contains(TABLE_CELL_SEPARATOR)) {
+                    final String[] result = row.split(TABLE_CELL_SEPARATOR);
+                    results.add(result);
+                }
+            }
+        }
+        return results;
+    }
+
+}
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java	Tue May 15 12:00:26 2018 +0200
@@ -1,6 +1,6 @@
 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
- * Software engineering by 
- *  Björnsen Beratende Ingenieure GmbH 
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
  *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
  *
  * This file is Free Software under the GNU AGPL (>=v3)
@@ -31,13 +31,13 @@
  */
 final class InundationDurationCalculation {
 
-    private CallContext context;
+    private final CallContext context;
 
-    public InundationDurationCalculation(CallContext context) {
+    public InundationDurationCalculation(final CallContext context) {
         this.context = context;
     }
 
-    public CalculationResult calculate(UINFOArtifact uinfo) {
+    public CalculationResult calculate(final UINFOArtifact uinfo) {
         final Calculation problems = new Calculation();
 
         final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name());
@@ -45,21 +45,27 @@
 
         final RiverAccess access = new RiverAccess(uinfo);
         final River river = access.getRiver();
-        DoubleRange calcRange = null;
+        final DoubleRange calcRange = null;
         final RiverInfo riverInfo = new RiverInfo(river);
-        
+
+        final InundationDurationAccess indurax = new InundationDurationAccess(uinfo);
+        final int[] totalEpoch = indurax.getTotalEpoch();
+        final Integer year = indurax.getYear(); // null bei year -> Integer.. evtl ungünstig.. evtl. anders lösen
+        final DoubleRange range = indurax.getRange();
+        final Double sedimentHeight = indurax.getSedimentHeight();
+
         final InundationDurationCalculationResults results = new InundationDurationCalculationResults(calcModeLabel, user, riverInfo, calcRange);
 
-        final Collection<ResultRow> rows = new ArrayList<ResultRow>();
-        
-        final ResultRow row1 = ResultRow.create(). // 
+        final Collection<ResultRow> rows = new ArrayList<>();
+
+        final ResultRow row1 = ResultRow.create(). //
                 putValue(SInfoResultType.discharge, 100). //
-        putValue(SInfoResultType.waterlevel, 2). //
-        putValue(SInfoResultType.gaugeLabel, "Torgau");
+                putValue(SInfoResultType.waterlevel, 2). //
+                putValue(SInfoResultType.gaugeLabel, "Torgau");
 
         rows.add(row1);
 
-        ResultRow row2 = ResultRow.create(). // 
+        final ResultRow row2 = ResultRow.create(). //
                 putValue(SInfoResultType.discharge, 200). //
                 putValue(SInfoResultType.waterlevel, 3). //
                 putValue(SInfoResultType.gaugeLabel, "Zollenspieker");
@@ -67,9 +73,9 @@
         rows.add(row2);
 
         final InundationDurationCalculationResult result = new InundationDurationCalculationResult("Ergebnis 1", null, rows);
-        
+
         results.addResult(result, problems);
-        
+
         return new CalculationResult(results, problems);
     }
 }
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java	Tue May 15 12:00:26 2018 +0200
@@ -66,14 +66,17 @@
         final Collection<ResultRow> rows = new ArrayList<>();
 
         final ResultRow row1 = ResultRow.create(). //
-                putValue(GeneralResultType.station, 100).putValue(UInfoResultType.salixline, 28).putValue(UInfoResultType.salixlinehist, 2)
-                .putValue(UInfoResultType.salixlinescen, 82);
+                putValue(GeneralResultType.station, 100).//
+                putValue(UInfoResultType.salixline, 28).//
+                putValue(UInfoResultType.salixlinehist, 2).//
+                putValue(UInfoResultType.salixlinescen, 82);
         rows.add(row1);
 
         final ResultRow row2 = ResultRow.create(). //
                 putValue(GeneralResultType.station, 200). //
                 putValue(UInfoResultType.salixline, 3). //
-                putValue(UInfoResultType.salixlinehist, 2).putValue(UInfoResultType.salixlinescen, 822);
+                putValue(UInfoResultType.salixlinehist, 2).//
+                putValue(UInfoResultType.salixlinescen, 822);
 
         rows.add(row2);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java	Tue May 15 12:00:26 2018 +0200
@@ -48,18 +48,21 @@
         final DoubleRange calcRange = null;
         final RiverInfo riverInfo = new RiverInfo(river);
 
+        final VegetationzonesAccess vAccess = new VegetationzonesAccess(uinfo);
+        final ArrayList<String[]> zones = vAccess.getVegZones();
+
         final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange);
 
         final Collection<ResultRow> rows = new ArrayList<>();
-        // TODO: get results from access!
-        final ResultRow row2 = ResultRow.create(). //
-                putValue(UInfoResultType.vegname, "Zonaler Wald"). //
-                putValue(UInfoResultType.vegdauervon, 0). //
-                putValue(UInfoResultType.vegdauerbis, 5);
+        for (final String[] zone : zones) {
+            final ResultRow row2 = ResultRow.create().//
+                    putValue(UInfoResultType.vegname, zone[0]).//
+                    putValue(UInfoResultType.vegdauervon, zone[1]).//
+                    putValue(UInfoResultType.vegdauerbis, zone[2]);
+            rows.add(row2);
+        }
 
-        rows.add(row2);
-
-        final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", null, rows);
+        final VegetationZonesCalculationResult result = new VegetationZonesCalculationResult("Ergebnis 1", rows);
 
         results.addResult(result, problems);
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResult.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculationResult.java	Tue May 15 12:00:26 2018 +0200
@@ -1,6 +1,6 @@
 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
- * Software engineering by 
- *  Björnsen Beratende Ingenieure GmbH 
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
  *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
  *
  * This file is Free Software under the GNU AGPL (>=v3)
@@ -13,7 +13,6 @@
 
 import org.dive4elements.river.artifacts.common.AbstractCalculationResult;
 import org.dive4elements.river.artifacts.common.ResultRow;
-import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
 
 /**
  * @author Domenico Nardi Tironi
@@ -22,8 +21,8 @@
 
     private static final long serialVersionUID = 1L;
 
-    public VegetationZonesCalculationResult(final String label, final WstInfo wst, final Collection< ResultRow> rows) {
-        super(label,  rows);
+    public VegetationZonesCalculationResult(final String label, final Collection<ResultRow> rows) {
+        super(label, rows);
     }
-    
+
 }
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesState.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesState.java	Tue May 15 12:00:26 2018 +0200
@@ -95,10 +95,10 @@
         return res;
     }
 
-    private CalculationResult doCompute(final UINFOArtifact sinfo, final CallContext context, final Object old) {
+    private CalculationResult doCompute(final UINFOArtifact uinfo, final CallContext context, final Object old) {
         if (old instanceof CalculationResult)
             return (CalculationResult) old;
 
-        return new VegetationZonesCalculation(context).calculate(sinfo); // Test2
+        return new VegetationZonesCalculation(context).calculate(uinfo);
     }
 }
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java	Mon May 14 18:24:35 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java	Tue May 15 12:00:26 2018 +0200
@@ -9,6 +9,7 @@
  */
 package org.dive4elements.river.artifacts.uinfo.vegetationzones;
 
+import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.river.artifacts.states.DefaultState;
 
 /**
@@ -22,4 +23,19 @@
     protected String getUIProvider() {
         return "uinfo.vegetationzones.table.edit";
     }
+
+    @Override
+    public boolean validate(final Artifact artifact) throws IllegalArgumentException {
+        // TODO: check verstehen
+
+        // final InundationDurationAccess access = new InundationDurationAccess((SINFOArtifact) artifact);
+
+        // Second year should be later than first.
+
+        // if (access.getYears() == null || access.getYears().length == 0)
+        return true;
+        // throw new IllegalArgumentException("error_years_wrong");
+
+        // return true;
+    }
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationzonesAccess.java	Tue May 15 12:00:26 2018 +0200
@@ -0,0 +1,71 @@
+/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ *  Björnsen Beratende Ingenieure GmbH
+ *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.uinfo.vegetationzones;
+
+import java.util.ArrayList;
+
+import org.apache.commons.lang.math.DoubleRange;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+import org.dive4elements.river.artifacts.common.AccessHelper;
+import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
+import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode;
+
+/**
+ * Access to the flow depth calculation type specific SInfo artifact data.
+ * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent
+ * reference to the artifact instance.
+ * Hence we do NOT cache any data.
+ *
+ * @author Gernot Belger
+ */
+final class VegetationzonesAccess extends RangeAccess {
+
+    // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR
+    public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
+    public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
+    private final AccessHelper helper;
+
+    // Fields from state:
+    // calculation_mode (String)
+    // ld_from, ld_to,ld_step
+    // vegzones (String)
+
+    public VegetationzonesAccess(final UINFOArtifact uinfo) {
+        super(uinfo);
+
+        /* assert calculation mode */
+        final UinfoCalcMode calculationMode = uinfo.getCalculationMode();
+        this.helper = new AccessHelper(uinfo);
+        assert (calculationMode == UinfoCalcMode.uinfo_vegetation_zones);
+    }
+
+    public DoubleRange getRange() {
+        final double from = getFrom();
+        final double to = getTo();
+        return new DoubleRange(from, to);
+    }
+
+    public ArrayList<String[]> getVegZones() {
+        final ArrayList<String[]> results = new ArrayList<>();
+        final String zonesRaw = super.getString("vegzones");
+        if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) {
+            final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR);
+            for (final String row : rows) {
+                if (row.contains(TABLE_CELL_SEPARATOR)) {
+                    final String[] result = row.split(TABLE_CELL_SEPARATOR);
+                    results.add(result);
+                }
+            }
+        }
+        return results;
+    }
+
+}
\ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SuperVegZonesTablePanel.java	Mon May 14 18:24:35 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/SuperVegZonesTablePanel.java	Tue May 15 12:00:26 2018 +0200
@@ -34,8 +34,8 @@
  */
 public abstract class SuperVegZonesTablePanel extends AbstractUIProvider {
     private static final long serialVersionUID = 1L;
-    public static final String tableCellSeparator = "tableCellSeparator";
-    public static final String tableRowSeparator = "tableRowSeparator";
+    public static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
+    public static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
 
     protected static final String datakey = "vegzones";
 
@@ -117,9 +117,9 @@
         for (final Data dataItemContainer : data.getAll()) {
             if (dataItemContainer.getItems() != null) {
                 for (final DataItem dataItem : dataItemContainer.getItems()) {
-                    if (dataItem.getStringValue() != null && dataItem.getStringValue().contains(tableRowSeparator)) {
+                    if (dataItem.getStringValue() != null && dataItem.getStringValue().contains(TABLE_ROW_SEPARATOR)) {
 
-                        final String[] rows = dataItem.getStringValue().split(tableRowSeparator);
+                        final String[] rows = dataItem.getStringValue().split(TABLE_ROW_SEPARATOR);
                         for (final String row : rows) {
                             this.elements.addData(createEntry(row));
                         }
@@ -160,9 +160,9 @@
         final Data str = getData(items, datakey);
         final DataItem[] strItems = str.getItems();
 
-        final String[] entries = strItems[0].getLabel().split(VegetationzonesTablePanel.tableRowSeparator);
+        final String[] entries = strItems[0].getLabel().split(VegetationzonesTablePanel.TABLE_ROW_SEPARATOR);
         for (final String entry : entries) {
-            final String[] vals = entry.split(VegetationzonesTablePanel.tableCellSeparator);
+            final String[] vals = entry.split(VegetationzonesTablePanel.TABLE_CELL_SEPARATOR);
             final Label dateLabel = new Label(vals[0] + " (" + vals[1] + "-" + vals[2] + ")");
             dateLabel.setHeight(20);
             vLayout.addMember(dateLabel);
@@ -178,15 +178,16 @@
     protected static final Data[] getDummyData() {
         final List<Data> data = new ArrayList<Data>();
         String d = "";
-        d = d + "Zonaler Wald" + tableCellSeparator + "0" + tableCellSeparator + "5" + tableRowSeparator;
-        d = d + "Hartholzaue, trocken" + tableCellSeparator + "5" + tableCellSeparator + "40" + tableRowSeparator;
-        d = d + "Hartholzaue, feucht" + tableCellSeparator + "40" + tableCellSeparator + "80" + tableRowSeparator;
-        d = d + "Silberweidenwald" + tableCellSeparator + "80" + tableCellSeparator + "140" + tableRowSeparator;
-        d = d + "Weidengebüsch" + tableCellSeparator + "140" + tableCellSeparator + "200" + tableRowSeparator;
-        d = d + "Uferröhricht" + tableCellSeparator + "200" + tableCellSeparator + "260" + tableRowSeparator;
-        d = d + "Uferpioniere" + tableCellSeparator + "260" + tableCellSeparator + "320" + tableRowSeparator;
-        d = d + "Vegetationslos" + tableCellSeparator + "320" + tableCellSeparator + "365" + tableRowSeparator;
-        d = d + "Wasserfläche" + tableCellSeparator + "365" + tableCellSeparator + "365" + tableRowSeparator;
+        // TODO: move to messages
+        d = d + "Zonaler Wald" + TABLE_CELL_SEPARATOR + "0" + TABLE_CELL_SEPARATOR + "5" + TABLE_ROW_SEPARATOR;
+        d = d + "Hartholzaue, trocken" + TABLE_CELL_SEPARATOR + "5" + TABLE_CELL_SEPARATOR + "40" + TABLE_ROW_SEPARATOR;
+        d = d + "Hartholzaue, feucht" + TABLE_CELL_SEPARATOR + "40" + TABLE_CELL_SEPARATOR + "80" + TABLE_ROW_SEPARATOR;
+        d = d + "Silberweidenwald" + TABLE_CELL_SEPARATOR + "80" + TABLE_CELL_SEPARATOR + "140" + TABLE_ROW_SEPARATOR;
+        d = d + "Weidengebüsch" + TABLE_CELL_SEPARATOR + "140" + TABLE_CELL_SEPARATOR + "200" + TABLE_ROW_SEPARATOR;
+        d = d + "Uferröhricht" + TABLE_CELL_SEPARATOR + "200" + TABLE_CELL_SEPARATOR + "260" + TABLE_ROW_SEPARATOR;
+        d = d + "Uferpioniere" + TABLE_CELL_SEPARATOR + "260" + TABLE_CELL_SEPARATOR + "320" + TABLE_ROW_SEPARATOR;
+        d = d + "Vegetationslos" + TABLE_CELL_SEPARATOR + "320" + TABLE_CELL_SEPARATOR + "365" + TABLE_ROW_SEPARATOR;
+        d = d + "Wasserfläche" + TABLE_CELL_SEPARATOR + "365" + TABLE_CELL_SEPARATOR + "365" + TABLE_ROW_SEPARATOR;
 
         final DataItem item = new DefaultDataItem(datakey, "entryDescription", d); // DATA-key
         data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
@@ -204,9 +205,9 @@
         String d = "";
         for (final ListGridRecord element : lgr) {
             final Record r = element;
-            d += r.getAttribute("vegzone") + VegetationzonesTablePanel.tableCellSeparator + r.getAttribute("from")
-                    + VegetationzonesTablePanel.tableCellSeparator + r.getAttribute("to");
-            d += VegetationzonesTablePanel.tableRowSeparator;
+            d += r.getAttribute("vegzone") + VegetationzonesTablePanel.TABLE_CELL_SEPARATOR + r.getAttribute("from")
+                    + VegetationzonesTablePanel.TABLE_CELL_SEPARATOR + r.getAttribute("to");
+            d += VegetationzonesTablePanel.TABLE_ROW_SEPARATOR;
         }
 
         final DataItem item = new DefaultDataItem(datakey, null, d); // DATA-key
@@ -216,9 +217,9 @@
 
     public final ListGridRecord createEntry(final String row) {
 
-        if (row.contains(tableCellSeparator)) {
+        if (row.contains(TABLE_CELL_SEPARATOR)) {
 
-            final String[] vals = row.split(tableCellSeparator);
+            final String[] vals = row.split(TABLE_CELL_SEPARATOR);
             if (vals.length == 3) {
                 final String vegzone = vals[0];
                 final String from = vals[1];
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java	Mon May 14 18:24:35 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java	Tue May 15 12:00:26 2018 +0200
@@ -63,6 +63,15 @@
                 if (v1 == null || v2 == null || v3 == null) {
                     return;
                 }
+                try {
+                    final double test = Double.valueOf(v1);
+                    final double test2 = Double.valueOf(v2);
+                    // TODO: MAKE MESSAGE, Apply Format (1.000,00)
+                }
+                catch (final Exception e) {
+                    e.printStackTrace();
+                    return;
+                }
 
                 final ListGridRecord r = new ListGridRecord();
                 r.setAttribute("vegzone", v3);
@@ -75,7 +84,7 @@
         final Label sel = new Label(this.MSG.select());
         sel.setHeight(25);
         this.elements.setWidth(450); // 185
-        this.elements.setHeight(500); // 120
+        this.elements.setHeight(300); // 120
         this.elements.setShowHeaderContextMenu(false);
         this.elements.setCanReorderFields(false);
         this.elements.setCanSort(false);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java	Mon May 14 18:24:35 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java	Tue May 15 12:00:26 2018 +0200
@@ -36,7 +36,7 @@
         final Label sel = new Label(this.MSG.select());
         sel.setHeight(25);
         this.elements.setWidth(420); // 185
-        this.elements.setHeight(500); //
+        this.elements.setHeight(300); //
         this.elements.setShowHeaderContextMenu(false);
         this.elements.setCanReorderFields(false);
         this.elements.setCanSort(false);

http://dive4elements.wald.intevation.org