# HG changeset patch
# User gernotbelger
# Date 1530705613 -7200
# Node ID bfe97ad35df57c1ef71536a27fcd81829114af43
# Parent 5a0e8d76582ed45aa2f9eba1a777d450c8cf15e9
uinfo.salix.scen_historical workflow
diff -r 5a0e8d76582e -r bfe97ad35df5 artifacts/doc/conf/artifacts/uinfo.xml
--- a/artifacts/doc/conf/artifacts/uinfo.xml Wed Jul 04 13:06:28 2018 +0200
+++ b/artifacts/doc/conf/artifacts/uinfo.xml Wed Jul 04 14:00:13 2018 +0200
@@ -76,6 +76,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -92,7 +145,7 @@
-
+
@@ -185,6 +238,7 @@
+
diff -r 5a0e8d76582e -r bfe97ad35df5 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadMultipleEpochSelectState.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadMultipleEpochSelectState.java Wed Jul 04 14:00:13 2018 +0200
@@ -0,0 +1,76 @@
+/* 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;
+
+public class LoadMultipleEpochSelectState extends DefaultState {
+ /** The log used in this class. */
+ private static Logger log = Logger.getLogger(LoadMultipleEpochSelectState.class);
+
+ /**
+ * The default constructor that initializes an empty State object.
+ */
+ public LoadMultipleEpochSelectState() {
+ }
+
+ @Override
+ protected String getUIProvider() {
+ return "sinfo.collision.load_epoch_select";
+ }
+
+ @Override
+ protected void appendItems(final Artifact artifact, final ElementCreator creator, final String name, final CallContext context, final Element select) {
+ final String datakey = "epochs";
+ // TODO: MAKE DATASOURCE
+ try {
+ if (datakey.equals(name)) {
+
+ final AddTableDataHelper helper = new AddTableDataHelper(creator, select, "year", 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(2, "year", "60", "year", "INTEGER", "LEFT", null);
+
+ // final CollisionAccess access = new CollisionAccess((SINFOArtifact) artifact); // Der River wurde im vorigen State
+ // bereits gesetzt
+
+ // final List collisions = CollisionHibernateFactory.getCollisionsByRiver(access.getRiver());
+ // for (final Collision coll : collisions) { // TODO: Filter on Range (?)
+ // final Integer year = coll.getYear();
+ final Map row = new HashMap<>();
+ row.put("year", "1995");// year.toString()); // Nullpointer?
+ helper.addRow(row);
+ final Map row2 = new HashMap<>();
+ row2.put("year", "1996");
+ helper.addRow(row2);
+ final Map row3 = new HashMap<>();
+ row3.put("year", "1998");
+ helper.addRow(row3);
+
+ // }
+ helper.submitMapToXml();
+ }
+ }
+ catch (
+
+ final IllegalArgumentException iae) {
+ iae.printStackTrace();
+ }
+ }
+}
diff -r 5a0e8d76582e -r bfe97ad35df5 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadMultipleYearSelectState.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/LoadMultipleYearSelectState.java Wed Jul 04 14:00:13 2018 +0200
@@ -0,0 +1,88 @@
+/* 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.sinfo.SINFOArtifact;
+import org.dive4elements.river.artifacts.sinfo.collision.CollisionAccess;
+import org.dive4elements.river.artifacts.states.AddTableDataHelper;
+import org.dive4elements.river.artifacts.states.DefaultState;
+import org.dive4elements.river.model.sinfo.Collision;
+import org.w3c.dom.Element;
+
+/** State in which to fetch years for sedminent load calculation. */
+public class LoadMultipleYearSelectState extends DefaultState {
+ private static final long serialVersionUID = 1L;
+ /** The log used in this class. */
+ private static Logger log = Logger.getLogger(LoadMultipleYearSelectState.class);
+
+ /**
+ * The default constructor that initializes an empty State object.
+ */
+ public LoadMultipleYearSelectState() {
+ }
+
+ /** Year Select Widget. */
+ @Override
+ protected String getUIProvider() {
+ return "sinfo.collision.load_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 = "years";// siehe sinfo.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);
+
+ final CollisionAccess access = new CollisionAccess((SINFOArtifact) artifact); // Der River wurde im vorigen State bereits gesetzt
+
+ // final List collisions = CollisionHibernateFactory.getCollisionsByRiver(access.getRiver());
+ // for (final Collision coll : collisions) {
+ for (final Integer year : Collision.getYearsOfRiver(access.getRiver())) {
+ // final Integer year = coll.getYear();
+ final Map row = new HashMap<>();
+ row.put("year", year.toString()); // Nullpointer?
+ helper.addRow(row);
+ }
+ helper.submitMapToXml();
+ }
+ }
+ catch (final IllegalArgumentException iae) {
+ iae.printStackTrace();
+ }
+ }
+
+ @Override
+ public void validate(final Artifact artifact, final CallContext cc) throws IllegalArgumentException {
+ // TODO: check verstehen
+
+ final CollisionAccess access = new CollisionAccess((SINFOArtifact) artifact);
+
+ // Second year should be later than first.
+
+ // if (access.getYears() == null || access.getYears().length == 0)
+ // return true;
+ // throw new IllegalArgumentException("error_years_wrong");
+
+ // return true;
+ }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r 5a0e8d76582e -r bfe97ad35df5 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/YearChoice.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/YearChoice.java Wed Jul 04 14:00:13 2018 +0200
@@ -0,0 +1,35 @@
+/* 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.LinkedHashMap;
+
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallMeta;
+import org.dive4elements.river.artifacts.states.RadioSelect;
+
+/**
+ * @author Ingo Weinzierl
+ */
+public class YearChoice extends RadioSelect {
+ private static final long serialVersionUID = 1L;
+
+ public YearChoice() {
+ super();
+ }
+
+ @Override
+ protected LinkedHashMap makeEntries(final CallMeta meta, final Artifact artifact) {
+ final LinkedHashMap entries = new LinkedHashMap<>();
+ entries.put("state.uinfo.year", null);
+ entries.put("state.uinfo.epoch", null);
+ return entries;
+ }
+
+}
\ No newline at end of file
diff -r 5a0e8d76582e -r bfe97ad35df5 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Wed Jul 04 13:06:28 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties Wed Jul 04 14:00:13 2018 +0200
@@ -1065,6 +1065,7 @@
scenarioType.option3 = Historische Betrachtung
help.state.uinfo.scenario_type=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.scenario_type
+state.uinfo.distance_only_part.historical= Teilabschnitt
state.uinfo.distance_only_part.from_regional= Teilabschnitt
state.uinfo.distance_only_part = Teilabschnitt
help.state.uinfo.distance_only_part = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.distance_only_part
diff -r 5a0e8d76582e -r bfe97ad35df5 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Wed Jul 04 13:06:28 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties Wed Jul 04 14:00:13 2018 +0200
@@ -1065,6 +1065,7 @@
scenarioType.option3 = Historische Betrachtung
help.state.uinfo.scenario_type=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.scenario_type
+state.uinfo.distance_only_part.historical= Teilabschnitt
state.uinfo.distance_only_part.from_regional= Teilabschnitt
state.uinfo.distance_only_part = Teilabschnitt
help.state.uinfo.distance_only_part = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.distance_only_part