[PATCH] Teilabschnitt Salix State

Wald Commits scm-commit at wald.intevation.org
Mon May 7 17:27:30 CEST 2018


# HG changeset patch
# User gernotbelger
# Date 1525706753 -7200
# Node ID 5198066492a93e646cded2e9adfef466bb8c13f8
# Parent  41ec5095506f53e26dfb9e6d24123756e9641ffb
Teilabschnitt  Salix State

diff -r 41ec5095506f -r 5198066492a9 artifacts/doc/conf/artifacts/uinfo.xml
--- a/artifacts/doc/conf/artifacts/uinfo.xml	Mon May 07 10:51:36 2018 +0200
+++ b/artifacts/doc/conf/artifacts/uinfo.xml	Mon May 07 17:25:53 2018 +0200
@@ -1,204 +1,170 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="uinfo">
 
-	<states>
-		<state id="state.uinfo.river" description="state.uinfo.river"
-			state="org.dive4elements.river.artifacts.states.RiverSelect"
-			helpText="help.state.uinfo.river">
-			<data name="river" type="String" />
-		</state>
+  <states>
+    <state id="state.uinfo.river" description="state.uinfo.river" state="org.dive4elements.river.artifacts.states.RiverSelect" helpText="help.state.uinfo.river">
+      <data name="river" type="String" />
+    </state>
 
-		<transition
-			transition="org.dive4elements.river.artifacts.transitions.DefaultTransition">
-			<from state="state.uinfo.river" />
-			<to state="state.uinfo.calculation_mode" />
-		</transition>
+    <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition">
+      <from state="state.uinfo.river" />
+      <to state="state.uinfo.calculation_mode" />
+    </transition>
 
-		<state id="state.uinfo.calculation_mode"
-			description="state.uinfo.calculation_mode"
-			state="org.dive4elements.river.artifacts.uinfo.CalculationSelectUinfo"
-			helpText="help.state.uinfo.calculation_mode">
-			<data name="calculation_mode" type="String" />
-		</state>
+    <state id="state.uinfo.calculation_mode" description="state.uinfo.calculation_mode" state="org.dive4elements.river.artifacts.uinfo.CalculationSelectUinfo" helpText="help.state.uinfo.calculation_mode">
+      <data name="calculation_mode" type="String" />
+    </state>
 
-	<state id="state.uinfo.distance_only" description="state.uinfo.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlySelect" helpText="help.state.uinfo.distance_only">
-      <data name="ld_from" type="Double"/>
-      <data name="ld_to" type="Double"/>
+    <state id="state.uinfo.distance_only" description="state.uinfo.distance_only" state="org.dive4elements.river.artifacts.states.DistanceOnlySelect" helpText="help.state.uinfo.distance_only">
+      <data name="ld_from" type="Double" />
+      <data name="ld_to" type="Double" />
     </state>
-    
 
 
-		<!-- Calculation Mode: Salix Linie  -->
-		
 
-	<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
-      <from state="state.uinfo.calculation_mode"/>
-      <to state="state.uinfo.distance_only"/>
-      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/>
+    <!-- Calculation Mode: Salix Linie -->
+
+
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.calculation_mode" />
+      <to state="state.uinfo.distance_only" />
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" />
     </transition>
+
+
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.distance_only" />
+      <to state="state.uinfo.use_scenario" />
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" />
+    </transition>
+
+
+    <state id="state.uinfo.use_scenario" description="state.uinfo.use_scenario" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.use_scenario">
+      <data name="use_scenario" type="Boolean" />
+    </state>
+
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.use_scenario" />
+      <to state="state.uinfo.scenario_type" />
+      <condition data="use_scenario" value="true" operator="equal" />
+    </transition>
+
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.use_scenario" />
+      <to state="state.uinfo.distance_only_part" />
+      <condition data="use_scenario" value="false" operator="equal" />
+    </transition>
+
+    <state id="state.uinfo.scenario_type" description="state.uinfo.scenario_type" state="org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState" helpText="help.state.uinfo.scenario_type">
+      <data name="scenario_selection" type="String" />
+    </state>
+
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.scenario_type" />
+      <to state="state.uinfo.distance_only_part" />
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" />
+    </transition>
+
+    <state id="state.uinfo.distance_only_part" description="state.uinfo.distance_only_part" state="org.dive4elements.river.artifacts.states.DistanceOnlyPartSelect" helpText="help.state.uinfo.distance_only">
+      <data name="ld_from_part" type="Double" />
+      <data name="ld_to_part" type="Double" />
+    </state>
+
+
+    <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition">
+      <from state="state.uinfo.distance_only_part" />
+      <to state="state.uinfo.salix_line" />
+      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" />
+    </transition>
+
+
+    <state id="state.uinfo.salix_line" description="state.uinfo.salix_line" state="org.dive4elements.river.artifacts.uinfo.salix.SalixLineState" helpText="help.state.uinfo.salix_line">
+      <outputmodes>
+
+        <!-- FIXME: i01n name in FLYSConstants -->
+        <outputmode name="uinfo_salix_line_export" description="output.uinfo_salix_line_export" mime-type="text/plain" type="export">
+          <facets>
+            <facet name="csv" description="facet.uinfo_salix_line_export.csv" />
+            <facet name="pdf" description="facet.uinfo_salix_line_export.pdf" />
+          </facets>
+        </outputmode>
+
+        <!-- FIXME: i01n name in FLYSConstants -->
+        <outputmode name="uinfo_salix_line_report" description="output.uinfo_salix_line_report" mime-type="text/xml" type="report">
+          <facets>
+            <facet name="report" description="facet.uinfo_salix_line_report" />
+          </facets>
+        </outputmode>
+      </outputmodes>
+    </state>
  
 
-	<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
-      <from state="state.uinfo.distance_only"/>
-      <to state="state.uinfo.use_scenario"/>
-      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/>
+ 
+
+
+
+
+    <!-- Calculation Mode: Vegetation Zones -->
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.calculation_mode" />
+      <to state="state.uinfo.vegetation_zones" />
+      <condition data="calculation_mode" value="uinfo_vegetation_zones" operator="equal" />
+
     </transition>
-		
-		
- 	<state id="state.uinfo.use_scenario" description="state.uinfo.use_scenario" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.use_scenario">
-      <data name="use_scenario" type="Boolean"/>
+
+    <state id="state.uinfo.vegetation_zones" description="state.uinfo.vegetation_zones" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesState" helpText="help.state.uinfo.vegetation_zones">
+      <outputmodes>
+
+        <!-- FIXME: i01n name in FLYSConstants -->
+        <outputmode name="uinfo_vegetation_zones_export" description="output.uinfo_vegetation_zones_export" mime-type="text/plain" type="export">
+          <facets>
+            <facet name="csv" description="facet.uinfo_vegetation_zones_export.csv" />
+            <facet name="pdf" description="facet.uinfo_vegetation_zones_export.pdf" />
+          </facets>
+        </outputmode>
+
+        <!-- FIXME: i01n name in FLYSConstants -->
+        <outputmode name="uinfo_vegetation_zones_report" description="output.uinfo_vegetation_zones_report" mime-type="text/xml" type="report">
+          <facets>
+            <facet name="report" description="facet.uinfo_vegetation_zones_report" />
+          </facets>
+        </outputmode>
+      </outputmodes>
     </state>
-    
- 	<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
-      <from state="state.uinfo.use_scenario"/>
-      <to state="state.uinfo.scenario_type"/>
-      <condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/>
+
+
+
+
+
+
+
+    <!-- Calculation Mode: Inundation Duration -->
+    <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
+      <from state="state.uinfo.calculation_mode" />
+      <to state="state.uinfo.inundation_duration" />
+      <condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" />
+
     </transition>
-			<!-- FIXME: der State soll nur angezeigt werden, wenn zuvor bei Szenario-Betrachtung "Ja" angeklickt wurde...  -->
- 	<state id="state.uinfo.scenario_type" description="state.uinfo.scenario_type" state="org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState" helpText="help.state.uinfo.scenario_type">
-    <!--Probleme, wenn, der DefaultState genommen wird!  <data name="scenario_type" type="Integer"/> -->
-   	<data name ="test" type ="String" />
+
+    <state id="state.uinfo.inundation_duration" description="state.uinfo.inundation_duration" state="org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationState" helpText="help.state.uinfo.inundation_duration">
+      <outputmodes>
+
+        <!-- FIXME: i01n name in FLYSConstants -->
+        <outputmode name="uinfo_inundation_duration_export" description="output.uinfo_inundation_duration_export" mime-type="text/plain" type="export">
+          <facets>
+            <facet name="csv" description="facet.uinfo_inundation_duration_export.csv" />
+            <facet name="pdf" description="facet.uinfo_inundation_duration_export.pdf" />
+          </facets>
+        </outputmode>
+
+        <!-- FIXME: i01n name in FLYSConstants -->
+        <outputmode name="uinfo_inundation_duration_report" description="output.uinfo_inundation_duration_report" mime-type="text/xml" type="report">
+          <facets>
+            <facet name="report" description="facet.uinfo_inundation_duration_report" />
+          </facets>
+        </outputmode>
+      </outputmodes>
     </state>
-    
-  
-		 
- 	<transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition">
-      <from state="state.uinfo.scenario_type"/>
-      <to state="state.uinfo.salix_line"/>
-      <!-- condition data="calculation_mode" value="uinfo_salix_line" operator="equal"/> -->
-    </transition>
-    
-    
-		<state id="state.uinfo.salix_line"
-			description="state.uinfo.salix_line"
-			state="org.dive4elements.river.artifacts.uinfo.salix.SalixLineState"
-			helpText="help.state.uinfo.salix_line">
-			<outputmodes>
 
-				<!-- FIXME: i01n name in FLYSConstants -->
-				<outputmode name="uinfo_salix_line_export"
-					description="output.uinfo_salix_line_export" mime-type="text/plain"
-					type="export">
-					<facets>
-						<facet name="csv"
-							description="facet.uinfo_salix_line_export.csv" />
-						<facet name="pdf"
-							description="facet.uinfo_salix_line_export.pdf" />
-					</facets>
-				</outputmode>
-
-				<!-- FIXME: i01n name in FLYSConstants -->
-				<outputmode name="uinfo_salix_line_report"
-					description="output.uinfo_salix_line_report" mime-type="text/xml"
-					type="report">
-					<facets>
-						<facet name="report"
-							description="facet.uinfo_salix_line_report" />
-					</facets>
-				</outputmode>
-			</outputmodes>
-		</state>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-		<!-- Calculation Mode: Vegetation Zones -->
-		<transition
-			transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
-			<from state="state.uinfo.calculation_mode" />
-			<to state="state.uinfo.vegetation_zones" />
-			<condition data="calculation_mode"
-				value="uinfo_vegetation_zones" operator="equal" />
-			 
-		</transition>
-
-		<state id="state.uinfo.vegetation_zones"
-			description="state.uinfo.vegetation_zones"
-			state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesState"
-			helpText="help.state.uinfo.vegetation_zones">
-			<outputmodes>
-
-				<!-- FIXME: i01n name in FLYSConstants -->
-				<outputmode name="uinfo_vegetation_zones_export"
-					description="output.uinfo_vegetation_zones_export"
-					mime-type="text/plain" type="export">
-					<facets>
-						<facet name="csv"
-							description="facet.uinfo_vegetation_zones_export.csv" />
-						<facet name="pdf"
-							description="facet.uinfo_vegetation_zones_export.pdf" />
-					</facets>
-				</outputmode>
-
-				<!-- FIXME: i01n name in FLYSConstants -->
-				<outputmode name="uinfo_vegetation_zones_report"
-					description="output.uinfo_vegetation_zones_report"
-					mime-type="text/xml" type="report">
-					<facets>
-						<facet name="report"
-							description="facet.uinfo_vegetation_zones_report" />
-					</facets>
-				</outputmode>
-			</outputmodes>
-		</state>
-
-
-
-
-
-
-
-		<!-- Calculation Mode: Inundation Duration -->
-		<transition
-			transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
-			<from state="state.uinfo.calculation_mode" />
-			<to state="state.uinfo.inundation_duration" />
-			<condition data="calculation_mode"
-				value="uinfo_inundation_duration" operator="equal" />
-			 
-		</transition>
-
-		<state id="state.uinfo.inundation_duration"
-			description="state.uinfo.inundation_duration"
-			state="org.dive4elements.river.artifacts.uinfo.inundationduration.InundationDurationState"
-			helpText="help.state.uinfo.inundation_duration">
-			<outputmodes>
-
-				<!-- FIXME: i01n name in FLYSConstants -->
-				<outputmode name="uinfo_inundation_duration_export"
-					description="output.uinfo_inundation_duration_export"
-					mime-type="text/plain" type="export">
-					<facets>
-						<facet name="csv"
-							description="facet.uinfo_inundation_duration_export.csv" />
-						<facet name="pdf"
-							description="facet.uinfo_inundation_duration_export.pdf" />
-					</facets>
-				</outputmode>
-
-				<!-- FIXME: i01n name in FLYSConstants -->
-				<outputmode name="uinfo_inundation_duration_report"
-					description="output.uinfo_inundation_duration_report"
-					mime-type="text/xml" type="report">
-					<facets>
-						<facet name="report"
-							description="facet.uinfo_inundation_duration_report" />
-					</facets>
-				</outputmode>
-			</outputmodes>
-		</state>
-
-	</states>
+  </states>
 </artifact>
\ No newline at end of file
diff -r 41ec5095506f -r 5198066492a9 artifacts/src/main/java/org/dive4elements/river/artifacts/states/DistanceOnlyPartSelect.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/DistanceOnlyPartSelect.java	Mon May 07 17:25:53 2018 +0200
@@ -0,0 +1,21 @@
+/* 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.states;
+
+import org.apache.log4j.Logger;
+
+public class DistanceOnlyPartSelect extends DistanceOnlySelect {
+
+    private static Logger log = Logger.getLogger(DistanceOnlyPartSelect.class);
+
+    @Override
+    protected String getUIProvider() {
+        return "distance_only_part_panel";
+    }
+}
diff -r 41ec5095506f -r 5198066492a9 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineAccess.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineAccess.java	Mon May 07 17:25:53 2018 +0200
@@ -0,0 +1,45 @@
+/* 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.artifacts.uinfo.salix;
+
+import org.apache.commons.lang.math.DoubleRange;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+import org.dive4elements.river.artifacts.uinfo.UINFOArtifact;
+import org.dive4elements.river.artifacts.uinfo.UinfoCalcMode;
+
+/**
+ * Access to the flow depth calculation type specific SInfo artifact data.
+ * REMARK: this class is NOT intended to be hold in the results (or anywhere else), in order to avoid a permanent
+ * reference to the artifact instance.
+ * Hence we do NOT cache any data.
+ *
+ * @author Gernot Belger
+ */
+final class SalixLineAccess extends RangeAccess {
+
+    static final String FIELD_DIFFID_CURRENT = "diffid_current";
+    static final String FIELD_DIFFID_HIST = "diffid_historical";
+
+    public SalixLineAccess(final UINFOArtifact artifact) {
+        super(artifact);
+
+        /* assert calculation mode */
+        final UinfoCalcMode calculationMode = artifact.getCalculationMode();
+        assert (calculationMode == UinfoCalcMode.uinfo_salix_line);
+    }
+
+    public DoubleRange getRange() {
+        final double from = getFrom();
+        final double to = getTo();
+        return new DoubleRange(from, to);
+    }
+
+}
\ No newline at end of file
diff -r 41ec5095506f -r 5198066492a9 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/ScenarioTypeState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/ScenarioTypeState.java	Mon May 07 10:51:36 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/ScenarioTypeState.java	Mon May 07 17:25:53 2018 +0200
@@ -1,17 +1,28 @@
 
 package org.dive4elements.river.artifacts.uinfo.salix;
 
-import org.dive4elements.river.artifacts.states.BooleanChoiceState;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.dive4elements.river.artifacts.states.RadioSelect;
 
 /**
  * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
  */
-public class ScenarioTypeState extends BooleanChoiceState {
-
+public class ScenarioTypeState extends RadioSelect {
     private static final long serialVersionUID = 1L;
 
     public ScenarioTypeState() {
-        super("activeMsg1", "activeMsg2", "activeMsg3"); // kriege den state irgendwie nicht selbst hin
+        super();
     }
 
+    @Override
+    protected List<String> makeEntries() {
+        final List<String> entries = new ArrayList<>();
+        entries.add("scenarioType.option1");
+        entries.add("scenarioType.option2");
+        entries.add("scenarioType.option3");
+        return entries;
+
+    }
 }
\ No newline at end of file
diff -r 41ec5095506f -r 5198066492a9 gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Mon May 07 10:51:36 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java	Mon May 07 17:25:53 2018 +0200
@@ -10,7 +10,6 @@
 
 import com.google.gwt.i18n.client.ConstantsWithLookup;
 
-
 /**
  * @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
  */
@@ -40,7 +39,7 @@
 
     String clone_project();
 
-    String copy_of ();
+    String copy_of();
 
     String manage_projects();
 
@@ -180,6 +179,8 @@
 
     String distance_state();
 
+    String distance_part_state();
+
     String waterlevel_ground_state();
 
     String location();
@@ -236,7 +237,7 @@
 
     String missingInput();
 
-    String too_many_values ();
+    String too_many_values();
 
     String from();
 
diff -r 41ec5095506f -r 5198066492a9 gwt-client/src/main/java/org/dive4elements/river/client/client/artifacthelper/ArtifactHelper.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/artifacthelper/ArtifactHelper.java	Mon May 07 17:25:53 2018 +0200
@@ -0,0 +1,39 @@
+/** 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.artifacthelper;
+
+import org.dive4elements.river.client.shared.model.Artifact;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataList;
+
+/**
+ * @author Domenico Nardi Tironi
+ *
+ */
+public class ArtifactHelper {
+
+    private final Artifact artifact;
+
+    public ArtifactHelper(final Artifact artifact) {
+        this.artifact = artifact;
+    }
+
+    public Data getOldDataByKey(final String keyLabel) {
+        final DataList[] oldData = this.artifact.getArtifactDescription().getOldData();
+        for (final DataList dataList : oldData) {
+            for (final Data data : dataList.getAll()) {
+                if (data.getLabel().equals(keyLabel)) {
+                    return data;
+                }
+            }
+        }
+        return null;
+    }
+}
diff -r 41ec5095506f -r 5198066492a9 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistanceOnlyPartPanel.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistanceOnlyPartPanel.java	Mon May 07 17:25:53 2018 +0200
@@ -0,0 +1,57 @@
+/* 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.client.client.ui;
+
+import org.dive4elements.river.client.client.artifacthelper.ArtifactHelper;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataItem;
+import org.dive4elements.river.client.shared.model.DataList;
+
+public class DistanceOnlyPartPanel extends DistanceOnlyPanel {
+
+    private static final long serialVersionUID = -5794138573892656947L;
+
+    public DistanceOnlyPartPanel() {
+        super();
+    }
+
+    @Override
+    protected String getLabel() {
+        return this.MSG.distance_part_state();
+    }
+
+    @Override
+    protected String getLowerField() {
+        return "ld_from_part";
+    }
+
+    @Override
+    protected String getUpperField() {
+        return "ld_to_part";
+    }
+
+    @Override
+    protected void initMinMaxValues(final DataList data) {
+        final ArtifactHelper helper = new ArtifactHelper(super.artifact);
+
+        final Data f = helper.getOldDataByKey("ld_from");
+        final Data t = helper.getOldDataByKey("ld_to");
+        try {
+            final DataItem[] fItems = f.getItems();
+            final DataItem[] tItems = t.getItems();
+
+            this.min = Double.valueOf(fItems[0].getStringValue());
+            this.max = Double.valueOf(tItems[0].getStringValue());
+        }
+        catch (final NumberFormatException nfe) {
+            this.min = -Double.MAX_VALUE;
+            this.max = Double.MAX_VALUE;
+        }
+    }
+}
diff -r 41ec5095506f -r 5198066492a9 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java	Mon May 07 10:51:36 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java	Mon May 07 17:25:53 2018 +0200
@@ -57,6 +57,8 @@
             return new DistancePanel();
         } else if (uiProvider.equals("distance_only_panel")) {
             return new DistanceOnlyPanel();
+        } else if (uiProvider.equals("distance_only_part_panel")) {
+            return new DistanceOnlyPartPanel();
         } else if (uiProvider.equals("waterlevel_ground_panel")) {
             return new WaterlevelGroundPanel();
         } else if (uiProvider.equals("wq_panel")) {


More information about the Dive4Elements-commits mailing list