diff artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadScenarioSelectLimit5.java @ 9222:5a0e8d76582e

uinfo.salix regional workflow
author gernotbelger
date Wed, 04 Jul 2018 13:06:28 +0200
parents
children c08d5cfa4981
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/LoadScenarioSelectLimit5.java	Wed Jul 04 13:06:28 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 LoadScenarioSelectLimit5 extends DefaultState {
+    private static final long serialVersionUID = 1L;
+    /** The log used in this class. */
+    private static Logger log = Logger.getLogger(LoadScenarioSelectLimit5.class);
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public LoadScenarioSelectLimit5() {
+    }
+
+    /** Year Select Widget. */
+    @Override
+    protected String getUIProvider() {
+        return "uinfo.sedimentheight_select.limit5";
+    }
+
+    @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());
+                // no input help wanted
+                // 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
+    public boolean validate(final Artifact artifact) throws IllegalArgumentException {
+        return true;
+
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org