# 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,103 +1,136 @@ - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + - - - - - - - - + + + + + + + + + + + + + + + + @@ -105,100 +138,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + - - + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - + \ 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 Ingo Weinzierl */ -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 makeEntries() { + final List 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 Ingo Weinzierl */ @@ -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")) {