changeset 9118:431f1c269be5

Veg-Zone Table improved, State change data recovery;
author gernotbelger
date Mon, 04 Jun 2018 19:38:59 +0200
parents 623b51bf03d7
children 36c80c7fd02f
files artifacts/doc/conf/jasper/templates/sinfo.flowdepth.jrxml artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZone.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneAccessHelper.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.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 11 files changed, 279 insertions(+), 185 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/jasper/templates/sinfo.flowdepth.jrxml	Mon Jun 04 17:31:51 2018 +0200
+++ b/artifacts/doc/conf/jasper/templates/sinfo.flowdepth.jrxml	Mon Jun 04 19:38:59 2018 +0200
@@ -110,7 +110,7 @@
 				<reportElement key="0" style="htmlStyle" positionType="Float" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="-5" y="0" width="55" height="24"/>
 				<box padding="5"/>
 				<textElement textAlignment="Right" verticalAlignment="Bottom">
-					<font fontName="Simply*Glamorous"/>
+					
 				</textElement>
 				<textFieldExpression><![CDATA[$F{meta:station_header}]]></textFieldExpression>
 			</textField>
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/InundationDurationCalculation.java	Mon Jun 04 19:38:59 2018 +0200
@@ -24,7 +24,7 @@
 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
 import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
-import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZoneAccessHelper;
+import org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZone;
 import org.dive4elements.river.model.River;
 
 /**
@@ -56,7 +56,7 @@
         final DoubleRange range = indurax.getRange();
         final Double sedimentHeight = indurax.getSedimentHeight();
         final String zonesRaw = indurax.getVegZones();
-        final List<VegetationZoneAccessHelper> zones = VegetationZoneAccessHelper.parse(zonesRaw);
+        final List<VegetationZone> zones = VegetationZone.parse(zonesRaw);
 
         final InundationDurationCalculationResults results = new InundationDurationCalculationResults(calcModeLabel, user, riverInfo, calcRange);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZone.java	Mon Jun 04 19:38:59 2018 +0200
@@ -0,0 +1,112 @@
+/** 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 java.util.List;
+
+/**
+ * @author Domenico Nardi Tironi
+ *
+ */
+public class VegetationZone implements Comparable<VegetationZone> {
+
+    // IMMER ABGLEICHEN MIT VEGETATIONZONE IM CLIENT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR
+    private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
+    private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
+    private final String zoneName;
+    private final int min_day_overflow;
+    private final int max_day_overflow;
+
+    public static List<VegetationZone> parse(final String zonesRaw) {
+        final List<VegetationZone> resultList = new ArrayList<>();
+
+        final List<String[]> results = new ArrayList<>();
+        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);
+                }
+            }
+        }
+        for (final String[] zone : results) {
+
+            final VegetationZone helper = new VegetationZone(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2]));
+            resultList.add(helper);
+        }
+
+        return resultList;
+    }
+
+    public static VegetationZone createFromTableEntry(final String zone, final String min_day_overflow, final String max_day_overflow) {
+        return new VegetationZone(zone, Integer.valueOf(min_day_overflow), Integer.valueOf(max_day_overflow)); // Error-Handling?
+    }
+
+    private VegetationZone(final String zone, final Integer min_day_overflow, final Integer max_day_overflow) {
+        this.zoneName = zone;
+        this.min_day_overflow = min_day_overflow;
+        this.max_day_overflow = max_day_overflow;
+    }
+
+    public int getMax_day_overflow() {
+        return this.max_day_overflow;
+    }
+
+    public String getZoneName() {
+        return this.zoneName;
+    }
+
+    public int getMin_day_overflow() {
+        return this.min_day_overflow;
+    }
+
+    public static final List<VegetationZone> getStandardList() {
+
+        final List<VegetationZone> list = new ArrayList<>();
+        list.add(new VegetationZone("Zonaler Wald", 0, 5));
+        list.add(new VegetationZone("Hartholzaue, trocken", 5, 40));
+        list.add(new VegetationZone("Hartholzaue, feucht", 40, 80));
+        list.add(new VegetationZone("Silberweidenwald", 80, 140));
+        list.add(new VegetationZone("Weidengebüsch", 140, 200));
+        list.add(new VegetationZone("Uferröhricht", 200, 260));
+        list.add(new VegetationZone("Uferpioniere", 260, 320));
+        list.add(new VegetationZone("Vegetationslos", 320, 365));
+        list.add(new VegetationZone("Wasserfläche", 365, 365));
+
+        return list;
+    }
+
+    public static final String parseListToDataString(final List<VegetationZone> list) {
+
+        java.util.Collections.sort(list);
+        final StringBuilder builder = new StringBuilder();
+        for (final VegetationZone zone : list) {
+            builder.append(zone.getZoneName());
+            builder.append(TABLE_CELL_SEPARATOR);
+            builder.append(zone.getMin_day_overflow());
+            builder.append(TABLE_CELL_SEPARATOR);
+            builder.append(zone.getMax_day_overflow());
+            builder.append(TABLE_ROW_SEPARATOR);
+        }
+        return builder.toString();
+
+    }
+
+    @Override
+    public int compareTo(final VegetationZone o) {
+        final int basicCompare = Integer.valueOf(this.getMin_day_overflow()).compareTo(o.getMin_day_overflow());
+        if (basicCompare == 0)
+            return Integer.compare(this.getMax_day_overflow(), o.getMax_day_overflow()); // wenn min==min && max==max, alphabetisch sortieren?
+        return basicCompare;
+    }
+
+}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneAccessHelper.java	Mon Jun 04 17:31:51 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/** 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 java.util.List;
-
-/**
- * @author Domenico Nardi Tironi
- *
- */
-public class VegetationZoneAccessHelper {
-    // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR
-    private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
-    private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
-    private final String zoneName;
-    private final int min_day_overflow;
-    private final int max_day_overflow;
-
-    public static List<VegetationZoneAccessHelper> parse(final String zonesRaw) {
-        final List<VegetationZoneAccessHelper> resultList = new ArrayList<>();
-
-        final List<String[]> results = new ArrayList<>();
-        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);
-                }
-            }
-        }
-        for (final String[] zone : results) {
-
-            final VegetationZoneAccessHelper helper = new VegetationZoneAccessHelper(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2]));
-            resultList.add(helper);
-        }
-
-        return resultList;
-    }
-
-    private VegetationZoneAccessHelper(final String zone, final Integer min_day_overflow, final Integer max_day_overflow) {
-        // TODO Auto-generated constructor stub
-        this.zoneName = zone;
-        this.min_day_overflow = min_day_overflow;
-        this.max_day_overflow = max_day_overflow;
-    }
-
-    public int getMax_day_overflow() {
-        return this.max_day_overflow;
-    }
-
-    public String getZoneName() {
-        return this.zoneName;
-    }
-
-    public int getMin_day_overflow() {
-        return this.min_day_overflow;
-    }
-}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCalculation.java	Mon Jun 04 19:38:59 2018 +0200
@@ -15,7 +15,6 @@
 
 import org.apache.commons.lang.math.DoubleRange;
 import org.dive4elements.artifacts.CallContext;
-import org.dive4elements.river.artifacts.access.RangeAccess;
 import org.dive4elements.river.artifacts.common.ResultRow;
 import org.dive4elements.river.artifacts.model.Calculation;
 import org.dive4elements.river.artifacts.model.CalculationResult;
@@ -44,19 +43,17 @@
         final String calcModeLabel = Resources.getMsg(this.context.getMeta(), uinfo.getCalculationMode().name());
         final String user = CalculationUtils.findArtifactUser(this.context, uinfo);
 
-        // FIXME: remove, check other states as well
-        final RangeAccess access = new RangeAccess(uinfo);
-        final River river = access.getRiver();
-        final DoubleRange calcRange = access.getRange();
+        final VegetationzonesAccess vAccess = new VegetationzonesAccess(uinfo);
+        final River river = vAccess.getRiver();
+        final DoubleRange calcRange = vAccess.getRange();
         final RiverInfo riverInfo = new RiverInfo(river);
 
-        final VegetationzonesAccess vAccess = new VegetationzonesAccess(uinfo);
         final String zonesRaw = vAccess.getVegZones();
-        final List<VegetationZoneAccessHelper> helpers = VegetationZoneAccessHelper.parse(zonesRaw);
+        final List<VegetationZone> helpers = VegetationZone.parse(zonesRaw);
         final VegetationZonesCalculationResults results = new VegetationZonesCalculationResults(calcModeLabel, user, riverInfo, calcRange);
 
         final Collection<ResultRow> rows = new ArrayList<>();
-        for (final VegetationZoneAccessHelper zone : helpers) {
+        for (final VegetationZone zone : helpers) {
             final ResultRow row2 = ResultRow.create().//
                     putValue(UInfoResultType.vegname, zone.getZoneName()).//
                     putValue(UInfoResultType.vegdauervon, zone.getMin_day_overflow()).//
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java	Mon Jun 04 19:38:59 2018 +0200
@@ -9,8 +9,13 @@
  */
 package org.dive4elements.river.artifacts.uinfo.vegetationzones;
 
+import org.dive4elements.artifactdatabase.ProtocolUtils;
 import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
+import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.states.DefaultState;
+import org.w3c.dom.Element;
 
 /**
  * @author Domenico Nardi Tironi
@@ -25,6 +30,25 @@
     }
 
     @Override
+    protected Element[] createItems(final ElementCreator cr, final Artifact artifact, final String name, final CallContext context) {
+        final String datakey = "vegzones";
+        if (name.equals(datakey)) {
+            final Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
+            final Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
+            final Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
+            final D4EArtifact flys = (D4EArtifact) artifact;
+            final String s = flys.getDataAsString(datakey) == null ? VegetationZone.parseListToDataString(VegetationZone.getStandardList())
+                    : flys.getDataAsString(datakey);
+
+            value.setTextContent(s);
+            item.appendChild(label);
+            item.appendChild(value);
+            return new Element[] { item };
+        }
+        return new Element[] {};
+    }
+
+    @Override
     public boolean validate(final Artifact artifact) throws IllegalArgumentException {
         // TODO: check verstehen
 
@@ -38,4 +62,32 @@
 
         // return true;
     }
+
+    /**
+     * Creats the data element used for the static part of DESCRIBE document.
+     */
+    // @Override
+    // protected Element createStaticData(final D4EArtifact flys, final ElementCreator creator, final CallContext cc, final
+    // String name, final String value,
+    // final String type) {
+    // final Element dataElement = creator.create("data");
+    // creator.addAttr(dataElement, "name", name, true);
+    // creator.addAttr(dataElement, "type", type, true);
+    //
+    // final Element itemElement = creator.create("item");
+    // creator.addAttr(itemElement, "value", value, true);
+    //
+    // final String[] labels = getLabels(cc, value);
+    // final Object[] obj = new Object[] { labels[0] };
+    //
+    // // TODO own i18n
+    // final String attrValue = Resources.getMsg(cc.getMeta(), "wsp.selected.string", "wsp.selected.string", obj);
+    // // I18N_STATIC_KEY, I18N_STATIC_KEY, obj);
+    //
+    // creator.addAttr(itemElement, "label", attrValue, true);
+    // dataElement.appendChild(itemElement);
+    //
+    // return dataElement;
+    // }
+
 }
\ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Mon Jun 04 19:38:59 2018 +0200
@@ -10,18 +10,23 @@
 
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
+import com.lowagie.text.ExceptionConverter;
 import com.lowagie.text.PageSize;
 import com.lowagie.text.Rectangle;
-
+import com.lowagie.text.pdf.BaseFont;
+import com.lowagie.text.pdf.DefaultFontMapper;
+import com.lowagie.text.pdf.DefaultFontMapper.BaseFontParameters;
+import com.lowagie.text.pdf.FontMapper;
 import com.lowagie.text.pdf.PdfContentByte;
 import com.lowagie.text.pdf.PdfTemplate;
 import com.lowagie.text.pdf.PdfWriter;
 
+import java.awt.Font;
 import java.awt.Graphics2D;
 import java.awt.Transparency;
 
 import java.awt.geom.Rectangle2D;
-
+import java.awt.image.BufferedImage;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
@@ -266,7 +271,10 @@
                 PdfContentByte content  = writer.getDirectContent();
 
                 PdfTemplate template = content.createTemplate(width, height);
-                Graphics2D  graphics = template.createGraphics(width, height);
+
+                final FontMapper mapper = new ChartExportfontMapper();
+                
+                final Graphics2D  graphics = template.createGraphics(width, height );
 
                 double[] origin = getCenteredAnchor(
                     marginLeft, marginRight, marginBottom, marginTop,
@@ -277,10 +285,11 @@
                     origin[0], origin[1], size[0], size[1]);
 
                 ChartRenderingInfo info = new ChartRenderingInfo();
+                chart.draw(graphics, area, info);
 
-                chart.draw(graphics, area, info);
                 graphics.dispose();
                 content.addTemplate(template, 0f, 0f);
+
             }
             finally {
                 document.close();
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java	Mon Jun 04 19:38:59 2018 +0200
@@ -25,7 +25,7 @@
 
     }
 
-    public static final TextItem createItem(final String identifier, final String title, final int width, final Validator... validator) {
+    public static final TextItem createItem(final String identifier, final String title, final String width, final Validator... validator) {
         final TextItem item = new TextItem(identifier, title);
         item.setWidth(width);
         item.setWrapTitle(false);
@@ -33,7 +33,7 @@
         return item;
     }
 
-    public static final IntegerItem createIntegerItem(final String identifier, final String title, final int width, final Validator... validator) {
+    public static final IntegerItem createIntegerItem(final String identifier, final String title, final String width, final Validator... validator) {
         final IntegerItem item = new IntegerItem(identifier, title);
         item.setWidth(width);
         item.setWrapTitle(false);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/AbstractVegZonesTablePanel.java	Mon Jun 04 19:38:59 2018 +0200
@@ -19,6 +19,7 @@
 import org.dive4elements.river.client.shared.model.DataList;
 import org.dive4elements.river.client.shared.model.DefaultData;
 import org.dive4elements.river.client.shared.model.DefaultDataItem;
+import org.dive4elements.river.client.shared.model.VegetationZone;
 
 import com.google.gwt.core.client.GWT;
 import com.smartgwt.client.data.Record;
@@ -44,18 +45,11 @@
 public abstract class AbstractVegZonesTablePanel extends AbstractUIProvider {
     private static final long serialVersionUID = 1L;
 
-    private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR";
-
-    private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR";
-
     private static final String datakey = "vegzones";
 
     private final ListGrid elements = new ListGrid();
 
-    // private final HLayout input = new HLayout();
-
-    protected final ListGrid createTable(final Layout root, final DataList data, final int width, final boolean editable) {
-        data.add(VegetationzonesTablePanel.getDummyData()); // TODO: GET REAL DATA!
+    protected final ListGrid createTable(final Layout root, final DataList data, final String width, final boolean editable) {
 
         final Label title = new Label(data.get(0).getDescription());
         title.setHeight("35px"); // orig:25
@@ -64,13 +58,47 @@
         this.elements.setHeight(300); //
         this.elements.setShowHeaderContextMenu(false);
         this.elements.setCanReorderFields(false);
-        // this.elements.setCanSort(true);
+        this.elements.setCanSort(true);
+        this.elements.setSortField(1);
+        this.elements.setCanResizeFields(false);
 
         this.elements.setCanEdit(editable);
 
         final ListGridField vegzoneField = new ListGridField("vegzone", this.MSG.uinfo_vegetation_zones_label());
         vegzoneField.setType(ListGridFieldType.TEXT);
-        vegzoneField.setWidth(245);
+        vegzoneField.setWidth("*"); // 245
+        vegzoneField.setCanSort(false);
+        vegzoneField.setCanDragResize(true);
+
+        final ListGridField fromField = createIntTableField("from", this.MSG.uinfo_vegetation_zones_from(), true);
+
+        final ListGridField toField = createIntTableField("to", this.MSG.uinfo_vegetation_zones_to(), false);// nicht sortierbar nach "ÜFDauer bis"
+
+        if (editable) {
+            final ListGridField removeField = createRemoveField();
+            this.elements.setFields(vegzoneField, fromField, toField, removeField);
+        } else {
+            this.elements.setFields(vegzoneField, fromField, toField);
+        }
+
+        addDataInit(data);
+        root.setWidth(width);
+        root.addMember(title);
+        root.addMember(this.elements);
+        root.addMember(PanelHelper.getSpacer(10));
+
+        return this.elements;
+    }
+
+    private IntegerRangeValidator getValidator() {
+        final IntegerRangeValidator validator = new IntegerRangeValidator();
+        validator.setMin(0);
+        validator.setMax(365);
+        validator.setErrorMessage(this.MSG.uinfo_vegetation_zones_validation_range());
+        return validator;
+    }
+
+    private SortNormalizer getNormalizer() {
         final SortNormalizer normalizer = new SortNormalizer() {
 
             @Override
@@ -81,43 +109,20 @@
                 return numberFormat.substring(numberFormat.length() - 3);
             }
         };
-        final IntegerRangeValidator validator = new IntegerRangeValidator();
-        validator.setMin(0);
-        validator.setMax(365);
-        validator.setErrorMessage(this.MSG.uinfo_vegetation_zones_validation_range());
-
-        final ListGridField fromField = new ListGridField("from", this.MSG.uinfo_vegetation_zones_from());
-        fromField.setType(ListGridFieldType.INTEGER);
-        fromField.setCanSort(true);
-        fromField.setSortNormalizer(normalizer);
-        fromField.setValidators(validator);
-        fromField.setWidth(80);
-        fromField.setAlign(Alignment.RIGHT);
+        return normalizer;
+    }
 
-        final ListGridField toField = new ListGridField("to", this.MSG.uinfo_vegetation_zones_to());
-        toField.setType(ListGridFieldType.INTEGER);
-        toField.setValidators(validator);
-        toField.setWidth(80);
-        toField.setAlign(Alignment.RIGHT);
-        toField.setSortNormalizer(normalizer);
-
-        if (editable)
+    private ListGridField createIntTableField(final String key, final String msg, final boolean canSort) {
+        final ListGridField intField = new ListGridField(key, msg);
+        intField.setType(ListGridFieldType.INTEGER);
+        intField.setValidators(getValidator());
+        intField.setWidth(90);
+        intField.setAlign(Alignment.RIGHT);
+        intField.setSortNormalizer(getNormalizer());
+        intField.setCanSort(canSort);
+        intField.setCanDragResize(false);
 
-        {
-            final ListGridField removeField = createRemoveField();
-            this.elements.setFields(vegzoneField, fromField, toField, removeField);
-
-        } else {
-            this.elements.setFields(vegzoneField, fromField, toField);
-        }
-
-        addDataInit(data);
-
-        root.addMember(title);
-        root.addMember(this.elements);
-        root.addMember(PanelHelper.getSpacer(10));
-
-        return this.elements;
+        return intField;
     }
 
     private ListGridField createRemoveField() {
@@ -132,6 +137,8 @@
                 setCanGroupBy(false);
                 setCanFreeze(false);
                 setWidth(25);
+                setCanDragResize(false);
+                super.setCanToggle(false);
             }
         };
 
@@ -155,10 +162,10 @@
         for (final Data dataItemContainer : data.getAll()) {
             if (dataItemContainer.getItems() != null) {
                 for (final DataItem dataItem : dataItemContainer.getItems()) {
-                    if (dataItem.getStringValue() != null && dataItem.getStringValue().contains(TABLE_ROW_SEPARATOR)) {
+                    if (dataItem.getStringValue() != null) {
 
-                        final String[] rows = dataItem.getStringValue().split(TABLE_ROW_SEPARATOR);
-                        for (final String row : rows) {
+                        final List<VegetationZone> rows = VegetationZone.parse(dataItem.getStringValue());
+                        for (final VegetationZone row : rows) {
                             this.elements.addData(createEntry(row));
                         }
                     }
@@ -177,6 +184,7 @@
         final Canvas submit = getNextButton();
 
         final VLayout root = new VLayout();
+        root.setWidth(450);
         createWidget(root, data);
 
         layout.addMember(root);
@@ -199,10 +207,10 @@
         final Data str = getData(items, datakey);
         final DataItem[] strItems = str.getItems();
 
-        final String[] entries = strItems[0].getLabel().split(AbstractVegZonesTablePanel.TABLE_ROW_SEPARATOR);
-        for (final String entry : entries) {
-            final String[] vals = entry.split(AbstractVegZonesTablePanel.TABLE_CELL_SEPARATOR);
-            final Label dateLabel = new Label(vals[0] + " (" + vals[1] + "-" + vals[2] + ")");
+        final List<VegetationZone> entries = VegetationZone.parse(strItems[0].getLabel());
+
+        for (final VegetationZone entry : entries) {
+            final Label dateLabel = new Label(entry.getZoneName() + " (" + entry.getMin_day_overflow() + "-" + entry.getMax_day_overflow() + ")");
             dateLabel.setHeight(20);
             vLayout.addMember(dateLabel);
         }
@@ -214,24 +222,14 @@
         return layout;
     }
 
-    protected static final Data[] getDummyData() {
-        final List<Data> data = new ArrayList<Data>();
-
-        // TODO: move to messages
-        final String d = "Zonaler Wald" + TABLE_CELL_SEPARATOR + "0" + TABLE_CELL_SEPARATOR + "5" + TABLE_ROW_SEPARATOR//
-                + "Hartholzaue, trocken" + TABLE_CELL_SEPARATOR + "5" + TABLE_CELL_SEPARATOR + "40" + TABLE_ROW_SEPARATOR//
-                + "Hartholzaue, feucht" + TABLE_CELL_SEPARATOR + "40" + TABLE_CELL_SEPARATOR + "80" + TABLE_ROW_SEPARATOR//
-                + "Silberweidenwald" + TABLE_CELL_SEPARATOR + "80" + TABLE_CELL_SEPARATOR + "140" + TABLE_ROW_SEPARATOR//
-                + "Weidengebüsch" + TABLE_CELL_SEPARATOR + "140" + TABLE_CELL_SEPARATOR + "200" + TABLE_ROW_SEPARATOR//
-                + "Uferröhricht" + TABLE_CELL_SEPARATOR + "200" + TABLE_CELL_SEPARATOR + "260" + TABLE_ROW_SEPARATOR//
-                + "Uferpioniere" + TABLE_CELL_SEPARATOR + "260" + TABLE_CELL_SEPARATOR + "320" + TABLE_ROW_SEPARATOR//
-                + "Vegetationslos" + TABLE_CELL_SEPARATOR + "320" + TABLE_CELL_SEPARATOR + "365" + TABLE_ROW_SEPARATOR//
-                + "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 }));
-        return data.toArray(new Data[data.size()]);
-    }
+    // protected static final Data[] getDataToAdd(final List<VegetationZone> list) {
+    // final List<Data> data = new ArrayList<Data>();
+    // final String d = VegetationZone.parseListToDataString(list);
+    //
+    // final DataItem item = new DefaultDataItem(datakey, "entryDescription", d);
+    // data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
+    // return data.toArray(new Data[data.size()]);
+    // }
 
     @Override
     protected final Data[] getData() {
@@ -239,44 +237,35 @@
 
         final ListGridRecord[] lgr = this.elements.getRecords();
         if (lgr.length == 0) {
-            return getDummyData();// new Data[0]; // return getDummyData();
+            return null; // getDataToAdd(VegetationZone.getStandardList());// new Data[0]; //SHOULD NOT HAPPEN
         }
-        String d = "";
+        final List<VegetationZone> zoneList = new ArrayList<VegetationZone>();
         for (final ListGridRecord element : lgr) {
             final Record r = element;
-            d += r.getAttribute("vegzone") + AbstractVegZonesTablePanel.TABLE_CELL_SEPARATOR + r.getAttribute("from")
-                    + AbstractVegZonesTablePanel.TABLE_CELL_SEPARATOR + r.getAttribute("to");
-            d += AbstractVegZonesTablePanel.TABLE_ROW_SEPARATOR;
+            final VegetationZone zone = VegetationZone.createFromTableEntry(r.getAttribute("vegzone"), r.getAttribute("from"), r.getAttribute("to"));
+            zoneList.add(zone);
         }
 
-        final DataItem item = new DefaultDataItem(datakey, null, d); // DATA-key
+        final DataItem item = new DefaultDataItem(datakey, null, VegetationZone.parseListToDataString(zoneList)); // DATA-key
         data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
         return data.toArray(new Data[data.size()]);
     }
 
-    public final ListGridRecord createEntry(final String row) {
-
-        if (row.contains(TABLE_CELL_SEPARATOR)) {
-
-            final String[] vals = row.split(TABLE_CELL_SEPARATOR);
-            if (vals.length == 3) {
-                final String vegzone = vals[0];
-                final String from = vals[1];
-                final String to = vals[2];
+    public final ListGridRecord createEntry(final VegetationZone row) {
 
-                if (vegzone == null || from == null || to == null) {
-                    return null;
-                }
+        final String vegzone = row.getZoneName();
+        final Integer from = row.getMin_day_overflow();
+        final Integer to = row.getMax_day_overflow();
 
-                final ListGridRecord r = new ListGridRecord();
-                r.setAttribute("vegzone", vegzone);
-                r.setAttribute("from", from);
-                r.setAttribute("to", to);
-                return r;
+        if (vegzone == null || from == null || to == null) {
+            return null;
+        }
 
-            }
+        final ListGridRecord r = new ListGridRecord();
+        r.setAttribute("vegzone", vegzone);
+        r.setAttribute("from", from);
+        r.setAttribute("to", to);
+        return r;
 
-        }
-        return null;
     }
 }
\ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java	Mon Jun 04 19:38:59 2018 +0200
@@ -34,17 +34,18 @@
     @Override
     public void createWidget(final Layout root, final DataList data) {
 
-        final ListGrid elements = super.createTable(root, data, 450, true);
+        final ListGrid elements = super.createTable(root, data, "450", true);
 
-        this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200);
+        this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), "*");// 450);
         this.vegzone.setColSpan(4);
-        this.start = PanelHelper.createIntegerItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 50);
-        this.end = PanelHelper.createIntegerItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 50);
+        this.start = PanelHelper.createIntegerItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), "*");
+        this.end = PanelHelper.createIntegerItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), "*");
         final VLayout fields = new VLayout();
 
         final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific
 
         final DynamicForm form1 = new DynamicForm();
+
         form1.setNumCols(4); // für Layout untereinander muss 2 eingestellt werden
 
         form1.setFields(this.vegzone, this.start, this.end);
@@ -75,6 +76,7 @@
         });
 
         fields.addMember(form1);
+
         root.addMember(fields);
         root.addMember(PanelHelper.getSpacer(10));
         root.addMember(add);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java	Mon Jun 04 17:31:51 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java	Mon Jun 04 19:38:59 2018 +0200
@@ -19,7 +19,7 @@
     @Override
     public void createWidget(final Layout root, final DataList data) {
 
-        createTable(root, data, 420, false);
+        createTable(root, data, "420", false);
 
         // fetchSedimentLoadData(); //TODO: feed from database...
     }

http://dive4elements.wald.intevation.org