[PATCH 1 of 2] klasse vergessen

Wald Commits scm-commit at wald.intevation.org
Wed Jul 4 17:14:26 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1530717211 -7200
# Node ID 001a8ed1e71dc39ba34974268e675f49b7c99b37
# Parent  c3994657c15da11e5b7c615822a6d6f61af728d2
klasse vergessen

diff -r c3994657c15d -r 001a8ed1e71d artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadSingleYearSelectState.java
--- /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 :


More information about the Dive4Elements-commits mailing list