Mercurial > dive4elements > river
changeset 9222:5a0e8d76582e
uinfo.salix regional workflow
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/sinfo.xml Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/doc/conf/artifacts/sinfo.xml Wed Jul 04 13:06:28 2018 +0200 @@ -455,7 +455,7 @@ </facets> </outputmode> - <outputmode name="sinfo_tkh_report" description="output.sinfo_flowdepth_report" mime-type="text/xml" type="report"> + <outputmode name="sinfo_tkh_report" description="output.sinfo_tkh_report" mime-type="text/xml" type="report"> <facets> <facet name="report" description="facet.sinfo_tkh_report" /> </facets>
--- a/artifacts/doc/conf/artifacts/uinfo.xml Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/doc/conf/artifacts/uinfo.xml Wed Jul 04 13:06:28 2018 +0200 @@ -62,7 +62,7 @@ <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> <from state="state.uinfo.use_scenario" /> - <to state="state.uinfo.distance_only_part" /> + <to state="state.uinfo.salix_line" /> <condition data="use_scenario" value="false" operator="equal" /> </transition> @@ -72,23 +72,31 @@ <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" /> + <to state="state.uinfo.distance_only_part.from_regional" /> + <condition data="scenario_selection" value="scenarioType.option1" 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"> + <state id="state.uinfo.inundation.scenario.regional" description="state.uinfo.inundation.scenario.regional" state="org.dive4elements.river.artifacts.uinfo.salix.LoadScenarioSelectLimit5" helpText="help.state.uinfo.use_scenario"> + <data name="sedimentheight" type="String" /> <!-- mittelwasserlage in cm! --> + </state> + + <state id="state.uinfo.distance_only_part.from_regional" description="state.uinfo.distance_only_part.from_regional" 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.ValueCompareTransition"> - <from state="state.uinfo.distance_only_part" /> - <to state="state.uinfo.salix_line" /> + <from state="state.uinfo.distance_only_part.from_regional" /> + <to state="state.uinfo.inundation.scenario.regional" /> <condition data="calculation_mode" value="uinfo_salix_line" operator="equal" /> </transition> - +<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.uinfo.inundation.scenario.regional" /> + <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">
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java Wed Jul 04 13:06:28 2018 +0200 @@ -66,14 +66,7 @@ @Override public boolean validate(final Artifact artifact) throws IllegalArgumentException { return true; - // final CollisionLoadYearEpochAccess access = new CollisionLoadYearEpochAccess((D4EArtifact) artifact); - // - // // Second year should be later than first. - // if (access.getYears() == null || access.getYears().length == 0) - // return true; // TODO: richtig in CollisionLoadYear... implementieren - // // throw new IllegalArgumentException("error_years_wrong"); - // - // return true; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /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 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineAccess.java Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineAccess.java Wed Jul 04 13:06:28 2018 +0200 @@ -51,11 +51,11 @@ return null; } - public double getFromPart() { - return super.getDouble("ld_from_part"); + public Double getFromPart() { + return getDouble("ld_from_part"); } - public double getToPart() { - return super.getDouble("ld_to_part"); + public Double getToPart() { + return getDouble("ld_to_part"); } } \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculation.java Wed Jul 04 13:06:28 2018 +0200 @@ -51,8 +51,8 @@ final DoubleRange range = accessSalix.getRange(); final boolean useScenario = accessSalix.getUseScenario(); final String selectedScenario = accessSalix.getScenario(); - final double fromPart = accessSalix.getFromPart(); - final double toPart = accessSalix.getToPart(); + final Double fromPart = accessSalix.getFromPart(); + final Double toPart = accessSalix.getToPart(); // calculation_mode // ld_from , ld_to // use_scenario (boolean)
--- a/artifacts/src/main/resources/messages.properties Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Wed Jul 04 13:06:28 2018 +0200 @@ -1051,6 +1051,7 @@ state.uinfo.inundation.vegetation=Einteilung der Vegetationszonen und \u00dcberflutunsgdauern state.uinfo.inundation.use_scenario=Szenariobetrachtung +state.uinfo.inundation.scenario.regional = Eingabe der \u00c4nderung der Mittelwasserspiegellage (bis zu 5 Werte m\u00f6glich) state.uinfo.inundation.scenario = Werte f\u00fcr \u00c4nderung der Sohl- bzw. Mittelwasserlage eingeben state.uinfo.use_scenario=Szenariobetrachtung useScenario.option = Zus\u00e4tzlich Szenariobetrachtung miteinbeziehen? @@ -1064,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.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
--- a/artifacts/src/main/resources/messages_de.properties Wed Jul 04 12:00:57 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Wed Jul 04 13:06:28 2018 +0200 @@ -1051,6 +1051,7 @@ state.uinfo.inundation.vegetation=Einteilung der Vegetationszonen und \u00dcberflutunsgdauern state.uinfo.inundation.use_scenario=Szenariobetrachtung +state.uinfo.inundation.scenario.regional = Eingabe der \u00c4nderung der Mittelwasserspiegellage (bis zu 5 Werte m\u00f6glich) state.uinfo.inundation.scenario = Werte f\u00fcr \u00c4nderung der Sohl- bzw. Mittelwasserlage eingeben state.uinfo.use_scenario=Szenariobetrachtung useScenario.option = Zus\u00e4tzlich Szenariobetrachtung miteinbeziehen? @@ -1063,7 +1064,8 @@ scenarioType.option2 = \u00dcberregional wirkende Eingriffe scenarioType.option3 = Historische Betrachtung help.state.uinfo.scenario_type=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.scenario_type - + +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
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed Jul 04 13:06:28 2018 +0200 @@ -1548,4 +1548,6 @@ String sinfo_columnlabel_soundings(); String sinfo_columnlabel_waterlevels(); + + String error_limit_exceeded_salix(); } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Jul 04 13:06:28 2018 +0200 @@ -324,6 +324,7 @@ ele_window_save_error = Error while saving elevations. ele_window_geometry_error = The geometry is not supported: +error_limit_exceeded_salix = Die Eingabe ist auf 5 Werte beschr\u00e4nkt. error_no_data_for_river = F\u00fcr das gew\u00e4hlte Gew\u00e4sser liegen keine Daten vor. unexpected_exception = There occured an unexpected exception error_years_wrong = The second year needs to be bigger than the first year.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Jul 04 13:06:28 2018 +0200 @@ -324,6 +324,7 @@ ele_window_save_error = Fehler beim Speichern der H\u00f6hen. ele_window_geometry_error = Die Geometrie wird nicht unterst\u00fctzt: +error_limit_exceeded_salix = Die Eingabe ist auf 5 Werte beschr\u00e4nkt. error_no_data_for_river = F\u00fcr das gew\u00e4hlte Gew\u00e4sser liegen keine Daten vor. unexpected_exception = Ein unerwarteter Fehler ist aufgetreten error_years_wrong = Das zweite Jahr muss gr\u00f6\u00dfer als das erste sein.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractSingleItemPanel.java Wed Jul 04 13:06:28 2018 +0200 @@ -19,6 +19,7 @@ import org.dive4elements.river.client.shared.model.DefaultData; import org.dive4elements.river.client.shared.model.DefaultDataItem; +import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.fields.TextItem; @@ -33,10 +34,11 @@ private static final long serialVersionUID = 1L; - protected enum Type { - single, multi // "SingleItem" (Klassenname) meint, dass es nur ein einziges Eingabefeld gibt (nicht from-to; epoch) + public enum Type { + single, multi, limit5 // "SingleItem" (Klassenname) meint, dass es nur ein einziges Eingabefeld gibt (nicht from-to; epoch) // Type multi: append (year): es können mehrere Werte eingegeben werden; Leerzeichen-getrennt // Type single: append (year, sohlhöhendifferenz): nur ein Wert ist zulässig + // Type limit5 TODO: generalize, if needed } private final Type type; @@ -140,14 +142,7 @@ final List<String> errors = new ArrayList<String>(); // String filtered = ""; // int goodValues = 0; - - try { - Integer.parseInt(sValue); - } - catch (final NumberFormatException e) { - errors.add(this.MSG.wrongFormat() + ": " + sValue); - - } + errors.addAll(validateNumber(sValue)); boolean isGood = false; for (final String validYear : this.validInputs) { /* No list contains for strings? */ @@ -171,6 +166,19 @@ return errors; } + private final List<String> validateNumber(final String sValue) { + final List<String> errors = new ArrayList<String>(); + + try { + Integer.parseInt(sValue); + } + catch (final NumberFormatException e) { + errors.add(this.MSG.wrongFormat() + ": " + sValue); + + } + return errors; + } + protected abstract String errorForItemMsg(); protected final void appendValue(final String value) { @@ -186,6 +194,24 @@ break; + case limit5: + // APPEND = ADD to existing -> MULTI YEAR + final String oldValues = this.inputItem.getValueAsString(); + if (oldValues != null && !oldValues.isEmpty()) { + final String[] oldVals = oldValues.split(" "); + if (oldVals.length < 5)// TODO: generalize, if needed + this.inputItem.setValue(oldValues.trim() + " " + value); + else { + // msg TODO: generalize, if needed + SC.warn(this.MSG.error_limit_exceeded_salix()); + } + } + + else + this.inputItem.setValue(value); + + break; + case single: this.inputItem.setValue(value); break; @@ -205,12 +231,22 @@ switch (this.type) { case multi: + final String[] sValues = sValue.trim().split(" "); for (final String value : sValues) { errors.addAll(this.validateSingleInput(value)); } break; - + case limit5: + final String[] values = sValue.trim().split(" "); + if (values.length > 5) { + errors.add(this.MSG.error_limit_exceeded_salix());// TODO generalize if needed + } + for (int i = 0; i < values.length; i++) { + if (i < 5) + errors.addAll(this.validateNumber(values[i])); + } + break; case single: errors.addAll(this.validateSingleInput(sValue)); break;
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/FromToTableHelperPanel.java Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/FromToTableHelperPanel.java Wed Jul 04 13:06:28 2018 +0200 @@ -95,6 +95,7 @@ this.table.setEmptyMessage(flys.error_feed_no_data()); return; } + for (final DataItem dataItem : mData.opts) { final MultiDataItem item = (MultiDataItem) dataItem; @@ -112,7 +113,7 @@ this.table.addData(newRecord); } - + this.table.setEmptyMessage(""); this.table.setFields(fields.values().toArray(new ListGridField[fields.size()])); }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Wed Jul 04 13:06:28 2018 +0200 @@ -9,6 +9,7 @@ package org.dive4elements.river.client.client.ui; import org.dive4elements.river.client.client.FLYSConstants; +import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel.Type; import org.dive4elements.river.client.client.ui.fixation.FixEventSelect; import org.dive4elements.river.client.client.ui.fixation.FixFunctionSelect; import org.dive4elements.river.client.client.ui.fixation.FixGaugeSelectPanel; @@ -169,7 +170,9 @@ } else if (uiProvider.equals("minfo.sedimentload_sqti_select")) { return new SedLoadSQTiPanel(); } else if (uiProvider.equals("uinfo.sedimentheight_select")) { - return new LoadSedimentHeightPanel(); + return new LoadSedimentHeightPanel(Type.single); + } else if (uiProvider.equals("uinfo.sedimentheight_select.limit5")) { + return new LoadSedimentHeightPanel(Type.limit5); } else if (uiProvider.equals("hws_datacage_panel")) { return new HWSDatacagePanel(user); } else if (uiProvider.equals("user_rgd_panel")) {
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java Wed Jul 04 12:00:57 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java Wed Jul 04 13:06:28 2018 +0200 @@ -21,8 +21,8 @@ public class LoadSedimentHeightPanel extends AbstractSingleItemPanel { private static final long serialVersionUID = 1L; - public LoadSedimentHeightPanel() { - super(Type.single); + public LoadSedimentHeightPanel(final Type type) { + super(type); } @Override @@ -40,13 +40,14 @@ final VLayout layout = new VLayout(); final Label title = new Label(data.get(0).getDescription()); - title.setHeight("25px"); + title.setHeight("35px"); final DynamicForm form = new DynamicForm(); form.setNumCols(4); final TextItem inputItem = createInputItem("waterlevelDifference_Name_to_prevent_errorMsg"); inputItem.setShowTitle(false); + inputItem.setWidth(200); final StaticTextItem textItem = new StaticTextItem("IRRELEVANT_NAME"); textItem.setValue("cm");