changeset 9225:001a8ed1e71d

klasse vergessen
author gernotbelger
date Wed, 04 Jul 2018 17:13:31 +0200
parents c3994657c15d
children 83aee0942eae
files artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleYearSelectState.java
diffstat 1 files changed, 73 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleYearSelectState.java	Wed Jul 04 17:13:31 2018 +0200
@@ -0,0 +1,73 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * 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.salix;
+
+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 LoadSingleYearSelectState extends DefaultState {
+    private static final long serialVersionUID = 1L;
+    /** The log used in this class. */
+    private static Logger log = Logger.getLogger(LoadSingleYearSelectState.class);
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public LoadSingleYearSelectState() {
+    }
+
+    /** Year Select Widget. */
+    @Override
+    protected String getUIProvider() {
+        return "common.state.load_single_year_select";
+    }
+
+    @Override
+    protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) {
+        // TODO: MAKE DATASOURCE
+        try {
+            final String dataKeyofState = "singleyear";// siehe .xml
+            if (dataKeyofState.equals(name)) {
+
+                final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", context.getMeta()); // "year" not to be confused with datakey
+
+                helper.addColumn(0, "pinfrom", "60", "common.client.ui.selection", "ICON", "CENTER", "from");
+                helper.addColumn(1, "year", "60", "year", "INTEGER", "LEFT", null);
+                helper.addColumn(2, "sounding", "200", "uinfo.salix.soundings", "STRING", "LEFT", null);
+                // TODO: MAKE DATASOURCE
+                // final CollisionAccess access = new CollisionAccess((SINFOArtifact) artifact); // TODO: MAKE DATASOURCE
+                // TODO: MAKE DATASOURCE
+                // final List<Collision> collisions = CollisionHibernateFactory.getCollisionsByRiver(access.getRiver());
+                // for (final Collision coll : collisions) {
+                for (int i = 0; i < 3; i++) {// : Collision.getYearsOfRiver(access.getRiver())) {
+                    // final Integer year = coll.getYear();
+                    final Map<String, String> row = new HashMap<>();
+                    row.put("year", String.valueOf(1995 + i)); // Nullpointer?
+                    row.put("sounding", "TODO: Peilungen für das Jahr in dieser Zelle auflisten.");
+                    helper.addRow(row);
+                }
+                helper.submitMapToXml();
+            }
+        }
+        catch (final IllegalArgumentException iae) {
+            iae.printStackTrace();
+        }
+    }
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org