changeset 9078:fc02833dbcc1

SingleInputItem abstract
author gernotbelger
date Tue, 22 May 2018 17:44:05 +0200
parents 2b13de1b0897
children aafae1ab25f0
files artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/CollisionLoadEpochPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/CollisionLoadYearPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java
diffstat 9 files changed, 288 insertions(+), 270 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java	Tue May 22 15:32:00 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java	Tue May 22 17:44:05 2018 +0200
@@ -8,9 +8,16 @@
 
 package org.dive4elements.river.artifacts.uinfo.inundationduration;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.artifacts.common.utils.XMLUtils.ElementCreator;
+import org.dive4elements.river.artifacts.states.AddTableDataHelper;
 import org.dive4elements.river.artifacts.states.DefaultState;
+import org.w3c.dom.Element;
 
 /** State in which to fetch years for sedminent load calculation. */
 public class LoadScenarioSelect extends DefaultState {
@@ -27,7 +34,33 @@
     /** Year Select Widget. */
     @Override
     protected String getUIProvider() {
-        return "uinfo.sedimentheight_select"; // TODO: eigenes Panel oder allgemeineren Code und an SCENARIO AUS DB ANPASSEN!
+        return "uinfo.sedimentheight_select";
+    }
+
+    @Override
+    protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) {
+        final String datakey = "sedimentheight";
+        try {
+            if (datakey.equals(name)) {
+
+                final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "cm", context.getMeta());
+
+                helper.addColumn(0, "pinfrom", "40", "common.client.ui.from", "ICON", "CENTER", "from");
+                // helper.addColumn(1, "pinto", "40", "common.client.ui.to", "ICON", "CENTER", "to");
+                helper.addColumn(1, "cm", "60", "Delta [cm]", "INTEGER", "RIGHT", null);
+
+                for (int i = -200; i < 210; i = i + 10) {
+                    final Map<String, String> row = new HashMap<>();
+                    row.put("cm", Integer.toString(i));
+                    helper.addRow(row);
+
+                }
+                helper.submitMapToXml();
+            }
+        }
+        catch (final IllegalArgumentException iae) {
+            iae.printStackTrace();
+        }
     }
 
     @Override
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Tue May 22 17:44:05 2018 +0200
@@ -1421,6 +1421,8 @@
 
     String no_data_for_year();
 
+    String no_data_sediment_difference();
+
     String error_no_sedimentloadinfo_found();
 
     String error_no_sedimentloadinfo_data();
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties	Tue May 22 17:44:05 2018 +0200
@@ -756,6 +756,7 @@
 upper_time = to
 
 no_data_for_year = No data available for: $1
+no_data_sediment_difference = Invalid value: $1
 
 sinfo = S-INFO
 sinfo_flowdepth_export = Flie\u00dftiefen Export
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties	Tue May 22 17:44:05 2018 +0200
@@ -756,6 +756,7 @@
 upper_time = bis
 
 no_data_for_year = F\u00fcr das Jahr $1 liegen keine Daten vor.
+no_data_sediment_difference = Der Wert $1 ist ung\u00fcltig.
 
 sinfo = S-INFO
 sinfo_flowdepth_export = Flie\u00dftiefen Export
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java	Tue May 22 17:44:05 2018 +0200
@@ -0,0 +1,185 @@
+/** 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.client.client.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.dive4elements.river.client.client.ui.FromToTableHelperPanel.IColumnClickHandler;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataItem;
+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 com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * @author Domenico Nardi Tironi
+ *
+ */
+public abstract class AbstractSingleItemPanel extends AbstractUIProvider {
+
+    protected static final String FORM_ID = "FORM_ID";
+
+    protected TextItem inputItem;
+
+    protected List<String> validInputs = new ArrayList<String>();
+
+    protected ListGrid table;
+
+    protected abstract String getDatakey();
+
+    protected abstract void appendValue(final String value);
+
+    protected abstract boolean getTitleVisible();
+
+    protected abstract String errorForItemMsg();
+
+    @Override
+    public Canvas create(final DataList data) {
+        final VLayout layout = new VLayout();
+        final IColumnClickHandler fromHandler = new IColumnClickHandler() { // add to external class
+
+            @Override
+            public void columnClicked(final String value) {
+                appendValue(value);
+            }
+        };
+
+        final FromToTableHelperPanel helper = new FromToTableHelperPanel(data, getDatakey(), this.MSG, fromHandler, null);
+        final Canvas table = helper.getTable();
+        this.validInputs = helper.getKeycolEntries();
+
+        this.helperContainer.addMember(table);
+
+        final Canvas submit = getNextButton();
+        final Canvas widget = createWidget(data);
+
+        layout.addMember(widget);
+        layout.addMember(submit);
+
+        return layout;
+    }
+
+    public Canvas createWidget(final DataList data) {
+        final VLayout layout = new VLayout();
+
+        final Label title = new Label(data.get(0).getDescription());
+        title.setHeight("25px");
+
+        final DynamicForm form = new DynamicForm();
+        form.setID(FORM_ID);
+        form.setNumCols(4);
+        this.inputItem = new TextItem(this.MSG.years());
+        this.inputItem.setShowTitle(getTitleVisible());
+        this.inputItem.setValidators(new IsIntegerValidator()); // TODO: validator to be overriden...
+        form.setFields(this.inputItem);
+
+        layout.addMember(title);
+        layout.addMember(form);
+
+        return layout;
+    }
+
+    @Override
+    public Canvas createOld(final DataList dataList) {
+        final List<Data> items = dataList.getAll();
+        final Data years = getData(items, getDatakey());
+        final DataItem[] yearsItems = years.getItems();
+
+        final String v1 = yearsItems[0].getStringValue().replace(" ", ", ");
+
+        final Label old = new Label(v1);
+        final HLayout layout = new HLayout();
+        layout.setWidth("400px");
+
+        final Label label = new Label(dataList.getLabel());
+        label.setWidth("200px");
+
+        final Canvas back = getBackButton(dataList.getState());
+
+        layout.addMember(label);
+        layout.addMember(old);
+        layout.addMember(back);
+
+        return layout;
+    }
+
+    @Override
+    public List<String> validate() {
+        final List<String> errors = new ArrayList<String>();
+
+        if (this.inputItem.getValueAsString() == null || this.inputItem.getValueAsString().trim().isEmpty()) {
+            errors.add(this.MSG.empty_filter());
+            return errors;
+        }
+        final String sValue = this.inputItem.getValueAsString();
+        String filtered = "";
+        int goodValues = 0;
+
+        int value = 0;
+        try {
+            value = Integer.parseInt(sValue);
+        }
+        catch (final NumberFormatException e) {
+            errors.add(this.MSG.wrongFormat() + ": " + sValue);
+
+        }
+        boolean isGood = false;
+        for (final String validYear : this.validInputs) {
+            /* No list contains for strings? */
+            if (sValue.equals(validYear)) {
+                isGood = true;
+                break;
+            }
+        }
+        if (!isGood) {
+            String tmp = errorForItemMsg();
+            tmp = tmp.replace("$1", sValue);
+            errors.add(tmp);
+            // continue;
+        }
+        goodValues++;
+        if (goodValues > 1) {
+            filtered += " " + Integer.toString(value);
+        } else {
+            filtered = Integer.toString(value);
+        }
+
+        return errors;
+    }
+
+    @Override
+    protected Data[] getData() {
+        final List<String> errors = this.validate();
+        if (errors.size() > 0) {
+            showErrors(errors); // TODO: do not allow advance state
+            // return null;
+        }
+        if (this.inputItem != null && !this.inputItem.getValueAsString().isEmpty()) {
+            final List<Data> data = new ArrayList<Data>();
+
+            final DataItem yearsdata = new DefaultDataItem(getDatakey(), getDatakey(), this.inputItem.getValueAsString().trim());
+            data.add(new DefaultData(getDatakey(), null, null, new DataItem[] { yearsdata }));
+
+            return data.toArray(new Data[data.size()]);
+        }
+        return new Data[0];
+    }
+
+}
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/CollisionLoadEpochPanel.java	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/CollisionLoadEpochPanel.java	Tue May 22 17:44:05 2018 +0200
@@ -11,7 +11,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.dive4elements.river.client.client.FLYSConstants;
 import org.dive4elements.river.client.client.services.SedimentLoadInfoService;
 import org.dive4elements.river.client.client.services.SedimentLoadInfoServiceAsync;
 import org.dive4elements.river.client.client.ui.AbstractUIProvider;
@@ -46,12 +45,14 @@
 public class CollisionLoadEpochPanel extends AbstractUIProvider {
     protected SedimentLoadInfoServiceAsync sedLoadInfoService = GWT.create(SedimentLoadInfoService.class);
 
-    protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
-
     protected ListGrid elements;
     private TextItem start;
     private TextItem end;
 
+    private final String getDatakey() {
+        return "epochs";
+    }
+
     protected List<String> validYears = new ArrayList<String>();
 
     public Canvas createWidget(final DataList data) {
@@ -154,7 +155,7 @@
         label.setHeight(25);
 
         final List<Data> items = dataList.getAll();
-        final Data str = getData(items, "epochs");
+        final Data str = getData(items, getDatakey());
         final DataItem[] strItems = str.getItems();
 
         final String[] pairs = strItems[0].getLabel().split(";");
@@ -184,7 +185,7 @@
         final IColumnClickHandler fromHandler = createHandler(this.start);
         final IColumnClickHandler toHandler = createHandler(this.end);
 
-        final FromToTableHelperPanel helper = new FromToTableHelperPanel(data, "epochs", this.MSG, fromHandler, toHandler);
+        final FromToTableHelperPanel helper = new FromToTableHelperPanel(data, getDatakey(), this.MSG, fromHandler, toHandler);
         this.validYears = helper.getKeycolEntries();
         final Canvas table = helper.getTable();
 
@@ -219,8 +220,8 @@
             d += ";";
         }
 
-        final DataItem item = new DefaultDataItem("epochs", null, d);
-        data.add(new DefaultData("epochs", null, null, new DataItem[] { item }));
+        final DataItem item = new DefaultDataItem(getDatakey(), null, d);
+        data.add(new DefaultData(getDatakey(), null, null, new DataItem[] { item }));
         return data.toArray(new Data[data.size()]);
     }
 
@@ -238,13 +239,13 @@
             iY1 = Integer.parseInt(y1);
         }
         catch (final NumberFormatException e) {
-            errors.add(this.MESSAGES.wrongFormat() + ": " + y1);
+            errors.add(this.MSG.wrongFormat() + ": " + y1);
         }
         try {
             iY2 = Integer.parseInt(y2);
         }
         catch (final NumberFormatException e) {
-            errors.add(this.MESSAGES.wrongFormat() + ": " + y2);
+            errors.add(this.MSG.wrongFormat() + ": " + y2);
         }
         if (!errors.isEmpty()) {
             showErrors(errors);
@@ -272,12 +273,12 @@
              */
         }
         if (!startIsGood) {
-            String tmp = this.MESSAGES.no_data_for_year();
+            String tmp = this.MSG.no_data_for_year();
             tmp = tmp.replace("$1", y1);
             errors.add(tmp);
         }
         if (!endIsGood) {
-            String tmp = this.MESSAGES.no_data_for_year();
+            String tmp = this.MSG.no_data_for_year();
             tmp = tmp.replace("$1", y2);
             errors.add(tmp);
         }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/CollisionLoadYearPanel.java	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sinfo/CollisionLoadYearPanel.java	Tue May 22 17:44:05 2018 +0200
@@ -8,9 +8,9 @@
 
 package org.dive4elements.river.client.client.ui.sinfo;
 
-import org.dive4elements.river.client.client.ui.AbstractPanel;
+import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel;
 
-public class CollisionLoadYearPanel extends AbstractPanel {
+public class CollisionLoadYearPanel extends AbstractSingleItemPanel {
 
     @Override
     protected String getDatakey() {
@@ -29,4 +29,14 @@
             super.inputItem.setValue(value);
         }
     }
+
+    @Override
+    protected boolean getTitleVisible() {
+        return true;
+    }
+
+    @Override
+    protected String errorForItemMsg() {
+        return this.MSG.no_data_for_year();
+    }
 }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java	Tue May 22 17:44:05 2018 +0200
@@ -8,281 +8,57 @@
 
 package org.dive4elements.river.client.client.ui.uinfo;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.dive4elements.river.client.client.Config;
-import org.dive4elements.river.client.client.FLYSConstants;
-import org.dive4elements.river.client.client.services.SedimentLoadInfoService;
-import org.dive4elements.river.client.client.services.SedimentLoadInfoServiceAsync;
-import org.dive4elements.river.client.client.ui.AbstractUIProvider;
-import org.dive4elements.river.client.shared.model.ArtifactDescription;
-import org.dive4elements.river.client.shared.model.Data;
-import org.dive4elements.river.client.shared.model.DataItem;
+import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel;
 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.SedimentLoadInfoObject;
-import org.dive4elements.river.client.shared.model.SedimentLoadInfoRecord;
 
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.NumberFormat;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.IntegerItem;
 import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
-public class LoadSedimentHeightPanel extends AbstractUIProvider {
+public class LoadSedimentHeightPanel extends AbstractSingleItemPanel {
     private static final long serialVersionUID = 1L;
 
-    protected SedimentLoadInfoServiceAsync sedLoadInfoService = GWT.create(SedimentLoadInfoService.class); // TODO: find right datasource
-
-    private static final String datakey = "sedimentheight";
-    protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
-
-    private TextItem inputItem;
-
-    private ListGrid sedLoadTable;
-
-    protected List<String> validInputs;
-
     public LoadSedimentHeightPanel() {
     }
 
     @Override
-    public Canvas createOld(final DataList dataList) {
-        final List<Data> items = dataList.getAll();
-        final Data item = getData(items, datakey);
-        final DataItem[] alreadySetItems = item.getItems();
-
-        final String v1 = alreadySetItems[0].getStringValue().replace(" ", ", ");
+    protected String getDatakey() {
+        return "sedimentheight";
+    }
 
-        final Label old = new Label(v1);
-        final HLayout layout = new HLayout();
-        layout.setWidth("400px");
+    @Override
+    protected boolean getTitleVisible() {
+        return false;
+    }
 
-        final Label label = new Label(dataList.getLabel());
-        label.setWidth("200px");
+    @Override
+    protected String errorForItemMsg() {
+        return this.MSG.no_data_sediment_difference();
+    }
 
-        final Canvas back = getBackButton(dataList.getState());
+    @Override
+    public Canvas createWidget(final DataList data) {
+        final VLayout layout = (VLayout) super.createWidget(data);
 
-        layout.addMember(label);
-        layout.addMember(old);
-        layout.addMember(back);
+        //
+        // final Label title = new Label(data.get(0).getDescription());
+        // title.setHeight("35px");
+        //
+        // sorgt dafür, dass HINTER dem Eingabefeld noch ein Textfeld erscheint
+        final DynamicForm form = (DynamicForm) layout.getMember(FORM_ID);
+        final StaticTextItem textItem = new StaticTextItem("IRRELEVANT_NAME");
+        textItem.setValue("cm");
+        textItem.setShowTitle(false);
+
+        form.setFields(this.inputItem, textItem);
 
         return layout;
     }
 
     @Override
-    public List<String> validate() {
-        return validateYears();
-    }
-
-    @Override
-    public Canvas create(final DataList data) {
-        final VLayout layout = new VLayout();
-
-        final Canvas helper = createHelper();
-        this.helperContainer.addMember(helper);
-
-        final Canvas submit = getNextButton();
-        final Canvas widget = createWidget(data);
-
-        layout.addMember(widget);
-        layout.addMember(submit);
-
-        fetchSedimentLoadData();
-
-        return layout;
-    }
-
-    private Canvas createHelper() {
-        this.sedLoadTable = new ListGrid();
-        this.sedLoadTable.setShowHeaderContextMenu(false);
-        this.sedLoadTable.setWidth100();
-        this.sedLoadTable.setShowRecordComponents(true);
-        this.sedLoadTable.setShowRecordComponentsByCell(true);
-        this.sedLoadTable.setHeight100();
-        this.sedLoadTable.setEmptyMessage(this.MSG.empty_table());
-        this.sedLoadTable.setCanReorderFields(false);
-
-        final ListGridField date = new ListGridField("date", this.MSG.year());
-        date.setType(ListGridFieldType.TEXT);
-        date.setWidth(100);
-
-        final ListGridField descr = new ListGridField("description", this.MSG.description());
-        descr.setType(ListGridFieldType.TEXT);
-        descr.setWidth("*");
-
-        final String baseUrl = GWT.getHostPageBaseURL();
-        final ListGridField pinFrom = new ListGridField("fromIcon", this.MESSAGES.selection());
-        pinFrom.setWidth(60);
-        pinFrom.setType(ListGridFieldType.ICON);
-        pinFrom.setCellIcon(baseUrl + this.MESSAGES.markerGreen());
-
-        pinFrom.addRecordClickHandler(new RecordClickHandler() {
-            @Override
-            public void onRecordClick(final RecordClickEvent e) {
-                final Record r = e.getRecord();
-                appendValue(r.getAttribute("date"));
-            }
-        });
-
-        this.sedLoadTable.setFields(pinFrom, date, descr);
-        return this.sedLoadTable;
-    }
-
-    public Canvas createWidget(final DataList data) {
-        final VLayout layout = new VLayout();
-
-        final Label title = new Label(data.get(0).getDescription());
-        title.setHeight("35px");
-
-        final DynamicForm form = new DynamicForm();
-        form.setNumCols(4);
-
-        final StaticTextItem textItem = new StaticTextItem("TEST");
-        textItem.setValue("cm");
-        textItem.setShowTitle(false);
-
-        this.inputItem = new IntegerItem(this.MSG.year());
-        this.inputItem.setShowTitle(false);
-        form.setFields(this.inputItem, textItem);
-
-        layout.addMember(title);
-        layout.addMember(form);
-
-        return layout;
-    }
-
-    @Override
-    protected Data[] getData() {
-        validateYears();
-        if (this.inputItem != null && !this.inputItem.getValueAsString().isEmpty()) {
-            final List<Data> data = new ArrayList<Data>();
-
-            final DataItem yearsdata = new DefaultDataItem(datakey, datakey, this.inputItem.getValueAsString().trim()); // DATA-STRING: years (in
-                                                                                                                        // uinfo.xml)
-            data.add(new DefaultData(datakey, null, null, new DataItem[] { yearsdata }));
-
-            return data.toArray(new Data[data.size()]);
-        }
-        return new Data[0];
+    protected void appendValue(final String value) { // SINGLE-Input: COPY -> TODO: helper
+        this.inputItem.setValue(value);
     }
 
-    protected List<String> validateYears() {
-        final List<String> errors = new ArrayList<String>();
-        final NumberFormat nf = NumberFormat.getDecimalFormat();
-
-        if (this.inputItem.getValueAsString() == null || this.inputItem.getValueAsString().trim().isEmpty()) {
-            errors.add(this.MESSAGES.empty_filter());
-            return errors;
-        }
-
-        final String sValue = this.inputItem.getValueAsString();// .trim().split(" ");
-        String filtered = "";
-        int goodValues = 0;
-
-        int value = 0;
-        try {
-            value = Integer.parseInt(sValue);
-        }
-        catch (final NumberFormatException e) {
-            errors.add(this.MESSAGES.wrongFormat() + ": " + sValue);
-
-        }
-        boolean isGood = false;
-        for (final String validYear : this.validInputs) {
-            /* No list contains for strings? */
-            if (sValue.equals(validYear)) {
-                isGood = true;
-                break;
-            }
-        }
-        if (!isGood) {
-            String tmp = this.MESSAGES.no_data_for_year();
-            tmp = tmp.replace("$1", sValue);
-            errors.add(tmp);
-            // continue;
-        }
-        goodValues++;
-        if (goodValues > 1) {
-            filtered += " " + Integer.toString(value);
-        } else {
-            filtered = Integer.toString(value);
-        }
-
-        return errors;
-    }
-
-    protected void fetchSedimentLoadData() {
-        final Config config = Config.getInstance();
-        final String locale = config.getLocale();
-
-        final ArtifactDescription adescr = this.artifact.getArtifactDescription();
-        final DataList[] data = adescr.getOldData();
-
-        final double[] km = this.artifact.getArtifactDescription().getKMRange();
-        final String river = this.artifact.getArtifactDescription().getRiver();
-
-        String sq_ti_id = "";
-        this.validInputs = new ArrayList<String>(data.length);
-        for (final DataList element : data) {
-            final Data str = getData(element.getAll(), "sq_ti_id");
-            if (str != null) {
-                final DataItem[] strItems = str.getItems();
-                sq_ti_id = strItems[0].getStringValue();
-                break;
-            }
-        }
-
-        if (sq_ti_id.isEmpty()) {
-            GWT.log("Failed to find sq time interval id in data.");
-        }
-
-        this.sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id, new AsyncCallback<SedimentLoadInfoObject[]>() {
-            @Override
-            public void onFailure(final Throwable caught) {
-                GWT.log("Could not recieve sediment load informations.");
-                SC.warn(LoadSedimentHeightPanel.this.MSG.getString(caught.getMessage()));
-            }
-
-            @Override
-            public void onSuccess(final SedimentLoadInfoObject[] sedLoad) {
-                final int num = sedLoad != null ? sedLoad.length : 0;
-                GWT.log("Recieved " + num + " sediment load informations.");
-
-                if (num == 0) {
-                    return;
-                }
-
-                addSedimentLoadInfo(sedLoad);
-            }
-        });
-    }
-
-    protected void addSedimentLoadInfo(final SedimentLoadInfoObject[] sedLoad) {
-        for (final SedimentLoadInfoObject sl : sedLoad) {
-            final SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
-            this.sedLoadTable.addData(rec);
-            this.validInputs.add(rec.getDate());
-        }
-    }
-
-    protected void appendValue(final String year) { // SINGLE-Input
-        final String oldYears = this.inputItem.getValueAsString();
-        this.inputItem.setValue(year);
-    }
 }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java	Tue May 22 15:32:00 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java	Tue May 22 17:44:05 2018 +0200
@@ -8,9 +8,9 @@
 
 package org.dive4elements.river.client.client.ui.uinfo;
 
-import org.dive4elements.river.client.client.ui.AbstractPanel;
+import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel;
 
-public class LoadSingleYearPanel extends AbstractPanel {
+public class LoadSingleYearPanel extends AbstractSingleItemPanel {
 
     @Override
     protected String getDatakey() {
@@ -22,7 +22,16 @@
 
     @Override
     protected void appendValue(final String year) { // SINGLE-Input
-        final String oldYears = this.inputItem.getValueAsString();
         this.inputItem.setValue(year);
     }
+
+    @Override
+    protected boolean getTitleVisible() {
+        return false;
+    }
+
+    @Override
+    protected String errorForItemMsg() {
+        return this.MSG.no_data_for_year();
+    }
 }

http://dive4elements.wald.intevation.org