Mercurial > dive4elements > river
changeset 9274:1c8eeaf6031f
bundu.wst workflow
line wrap: on
line diff
--- a/artifacts/doc/conf/artifacts/bundu.xml Thu Jul 19 17:32:27 2018 +0200 +++ b/artifacts/doc/conf/artifacts/bundu.xml Thu Jul 19 17:33:24 2018 +0200 @@ -326,7 +326,7 @@ <state id="state.bundu.yearselect" helpText="state.bundu.yearselect" description="state.bundu.yearselect" state="org.dive4elements.river.artifacts.bundu.bezugswst.FixationPeriod"> - <data name="singleyear" type="String" /> + <data name="singleyear" type="String" /> <data name="events_temp" type="intarray" /> <!--necessary, because they will be set automatically --> </state> @@ -351,7 +351,7 @@ <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> <from state="state.bundu.fixationchoice" /> - <to state="state.bundu.wst.fix.year_length" /> + <to state="state.bundu.wst.fix.load.year_length" /> <condition data="fix_choice" value="state.bundu.fix.auto" operator="equal" /> </transition> @@ -374,17 +374,194 @@ <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> <from state="state.bundu.eventselect" /> - <to state="state.bundu.wst.fix.year_length" /> + <to state="state.bundu.wst.fix.load.year_length" /> <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> </transition> - <state id="state.bundu.wst.fix.year_length" helpText="help.state.bundu.wst.fix.year_length" description="state.bundu.wst.fix.year_length" state="org.dive4elements.river.artifacts.bundu.bezugswst.LoadQSeriesSelectState"> + <state id="state.bundu.wst.fix.load.year_length" helpText="help.state.bundu.wst.fix.load.year_length" description="state.bundu.wst.fix.load.year_length" state="org.dive4elements.river.artifacts.bundu.bezugswst.LoadQSeriesSelectState"> <data name="year_input_q_series" type="String" /> - <data name="start" type="Long" /> <!-- copy from Period, to fill it in LoadQSeriesSelectState --> - <data name="end" type="Long" /> </state> + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.fix.load.year_length" /> + <to state="state.bundu.wst.qs" /> + <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> + </transition> + + <state id="state.bundu.wst.qs" description="state.bundu.wst.qs" helpText="help.state.bundu.wst.qs" state="org.dive4elements.river.artifacts.states.WQFixing"> + <data name="wq_isq" type="String" /> + <data name="wq_values" type="WQTriple" /> + </state> + + + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.qs" /> + <to state="state.bundu.wst.load.calc_choice" /> + <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> + </transition> + + <state id="state.bundu.wst.load.calc_choice" helpText="state.bundu.wst.load.calc_choice" description="state.bundu.wst.load.calc_choice" state="org.dive4elements.river.artifacts.bundu.bezugswst.CalcChoice"> + <data name="calc_choice" type="String" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.load.calc_choice" /> + <to state="state.bundu.wst.load.function" /> + <condition data="calc_choice" value="state.bundu.calc.manual" operator="equal" /> + </transition> + + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.load.calc_choice" /> + <to state="state.bundu.wst.load.function" /> + <condition data="calc_choice" value="state.bundu.calc.auto" operator="equal" /> + </transition> + + <state id="state.bundu.wst.load.function" helpText="state.bundu.wst.load.function" description="state.bundu.wst.load.function" state="org.dive4elements.river.artifacts.states.fixation.FunctionSelect"> + <data name="function" type="String" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.load.function" /> + <to state="state.bundu.wst.load.preprocessing" /> + <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> + </transition> + + <state id="state.bundu.wst.load.preprocessing" helpText="state.bundu.wst.load.preprocessing" description="state.bundu.wst.load.preprocessing" state="org.dive4elements.river.artifacts.states.fixation.PreprocessingSelect"> + <data name="preprocessing" type="Boolean" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.load.preprocessing" /> + <to state="state.bundu.wst.load.missing_volume" /> + <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> + </transition> + + <state id="state.bundu.wst.load.missing_volume" helpText="state.bundu.wst.load.missing_volume" description="state.bundu.wst.load.missing_volume" state="org.dive4elements.river.artifacts.bundu.bezugswst.MissingVolumeSelect"> + <data name="missing_volume" type="Boolean" /> + </state> + + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.load.missing_volume" /> + <to state="state.bundu.load.distance_only_part" /> + <condition data="missing_volume" value="true" operator="equal" /> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.load.missing_volume" /> + <to state="state.bundu.load.distance_only_part" /> + <condition data="missing_volume" value="false" operator="equal" /> + </transition> + + <state id="state.bundu.load.distance_only_part" description="state.bundu.load.distance_only_part" state="org.dive4elements.river.artifacts.states.DistanceOnlyPartSelect" helpText="help.state.bundu.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.bundu.load.distance_only_part" /> + <to state="state.bundu.wst.soundings" /> + <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> + </transition> + + <state id="state.bundu.wst.soundings" description="state.bundu.wst.soundings" state="org.dive4elements.river.artifacts.states.SoundingsSelect" helpText="help.state.minfo.soundings"> + <data name="soundings" type="multiattribute" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.bundu.wst.soundings" /> + <to state="state.bundu.wst" /> + <condition data="calculation_mode" value="bundu_bezugswst" operator="equal" /> + </transition> + + + + + + + <state id="state.bundu.wst" helpText="state.bundu.wst" description="state.bundu.wst" state="org.dive4elements.river.artifacts.bundu.bezugswst.BezugswstState"> + <outputmodes> + <outputmode name="longitudinal_section" description="output.longitudinal_section" mime-type="image/png" type="chart"> + <facets> + <facet name="longitudinal_section.w" description="facet.longitudinal_section.w" /> + <facet name="longitudinal_section.q" description="facet.longitudinal_section.q" /> + <facet name="w_differences" description="facet.w_differences" /> + <facet name="other.wkms" description="facet.other.wkms" /> + <facet name="other.wq" description="WQ-Type of data" /> + <facet name="other.wqkms" description="facet.other.wqkms" /> + <facet name="other.wqkms.q" description="W-Type of data" /> + <facet name="other.wqkms.w" description="W-Type of data" /> + <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points" /> + <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations" /> + <facet name="longitudinal_section.area" description="facet.longitudinal_section.area" /> + <facet name="longitudinal_section.manualpoints" description="Manuelle Punkte" /> + </facets> + </outputmode> + <outputmode name="fix_wq_curve" description="output.fix_wq_curve" mine-type="image/png" type="chart"> + <facets> + <facet name="fix_sector_average_wq_0" description="Average values for Ws in Q sectors." /> + <facet name="fix_sector_average_wq_1" description="Average values for Ws in Q sectors." /> + <facet name="fix_sector_average_wq_2" description="Average values for Ws in Q sectors." /> + <facet name="fix_sector_average_wq_3" description="Average values for Ws in Q sectors." /> + <facet name="fix_analysis_events_wq" description="Raw event values used in the calculation" /> + <facet name="fix_wq_curve" description="WQ curve" /> + <facet name="fix_wq_ls" description="WQ LS curve" /> + <facet name="fix_outlier" description="The outliers" /> + <facet name="qsectors" description="qsectors." /> + <facet name="fix_events_wqkms" description="WQKMS-Type of data" /> + <facet name="other.wqkms.q" description="W-Type of data" /> + <facet name="other.wqkms.w" description="W-Type of data" /> + <facet name="other.wkms" description="facet.other.wqkms" /> + <facet name="other.wqkms" description="facet.other.wqkms" /> + <!--issue1383: facet name="longitudinal_section.w" description="facet.longitudinal_section.w"/ --> + <facet name="other.wq" description="Point-like data like fixations" /> + <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points" /> + <facet name="discharge_curve.curve" description="facet.discharge_curve.curve" /> + <facet name="mainvalues.w" description="facet.fix_wq.mainvalues.w" /> + <facet name="mainvalues.q" description="facet.fix_wq.mainvalues.q" /> + </facets> + </outputmode> + <outputmode name="cross_section" description="output.cross_section" mime-type="image/png" type="chart"> + <facets> + <facet name="cross_section_water_line" description="facet.cross_section_water_line" /> + <facet name="cross_section" description="facet.cross_section" /> + <facet name="area" description="an area" /> + <facet name="cross_section.area" description="an area" /> + <facet name="cross_section.manualpoints" description="points" /> + <facet name="cross_section.manualline" description="line" /> + <facet name="hyk" description="hyks" /> + </facets> + </outputmode> + <outputmode name="fix_wq_curve_at_export" description="output.fix_wq_curve_at_export" mime-type="text/plain" type="export"> + <facets> + <facet name="at" description="facet.fix_wq_curve_export.at" /> + </facets> + </outputmode> + <outputmode name="fix_waterlevel_export" description="output.fix_waterlevel_export" mine-type="text/plain" type="export"> + <facets> + <facet name="csv" description="facet.waterlevel_export.csv" /> + <facet name="wst" description="facet.waterlevel_export.wst" /> + <facet name="pdf" description="facet.waterlevel_export.pdf" /> + </facets> + </outputmode> + <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report"> + <facets> + <facet name="report" description="facet.fix.report" /> + </facets> + </outputmode> + </outputmodes> + </state> + + + + + + +
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Thu Jul 19 17:32:27 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstState.java Thu Jul 19 17:33:24 2018 +0200 @@ -1,32 +1,169 @@ -/** 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 +/* 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.bundu.bezugswst; +import java.text.DateFormat; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.access.FixRealizingAccess; +import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; +import org.dive4elements.river.artifacts.model.DataFacet; +import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.artifacts.model.ReportFacet; +import org.dive4elements.river.artifacts.model.WQCKms; +import org.dive4elements.river.artifacts.model.WQKms; +import org.dive4elements.river.artifacts.model.fixings.FixOutlierFacet; +import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation; +import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; +import org.dive4elements.river.artifacts.model.fixings.FixReferenceEventsFacet; +import org.dive4elements.river.artifacts.model.fixings.FixWQCurveFacet; +import org.dive4elements.river.artifacts.model.fixings.FixWaterlevelFacet; +import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.utils.Formatter; +import org.dive4elements.river.utils.UniqueDateFormatter; /** - * @author Domenico Nardi Tironi + * State to compute the fixation realizing (vollmer) results. + * + * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ -public class BezugswstState extends DefaultState { +public class BezugswstState extends DefaultState implements FacetTypes { - /// ** The log that is used in this state. */ - // private static Logger log = Logger.getLogger(FlowDepthState.class); + /* + * TODO: THIS CLASS IS A CLONE OF FixRealizingCompute + * + + * ++ + * +++ + * ++++ + * +++++ + * ++++++ + * +++++++ + * ++++++++ + * +++++++++ + * ++++++++++ + * +++++++++++ + * IT does not work here + */ - private static final long serialVersionUID = 1L; + /** The log used in this class. */ + private static Logger log = Logger.getLogger(BezugswstState.class); + + public static final String I18N_WQ_CURVE = "fix.vollmer.wq.curve"; + + public static final String I18N_WQ_OUTLIER = "fix.vollmer.wq.outliers"; /** - * From this state can only be continued trivially. + * The default constructor that initializes an empty State object. */ - @Override - protected String getUIProvider() { - return "continue"; + public BezugswstState() { } -} \ No newline at end of file + @Override + public Object computeAdvance(final D4EArtifact artifact, final String hash, final CallContext context, final List<Facet> facets, final Object old) { + log.debug("BezugswstState.computeAdvance"); + + CalculationResult res; + + final FixRealizingAccess access = new FixRealizingAccess(artifact); + + if (old instanceof CalculationResult) { + res = (CalculationResult) old; + } else { + final FixRealizingCalculation calc = new FixRealizingCalculation(access); + res = calc.calculate(); + } + + if (facets == null) { + return res; + } + + if (res.getReport().hasProblems()) { + facets.add(new ReportFacet()); + } + + final String id = getID(); + final CallMeta meta = context.getMeta(); + + final FixRealizingResult fixRes = (FixRealizingResult) res.getData(); + final WQKms[] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0]; + + for (int i = 0; i < wqkms.length; i++) { + String nameW = null; + String nameQ = null; + + if (access.isQ()) { + nameQ = wqkms[i].getName(); + nameW = "W(" + nameQ + ")"; + } else { + nameW = wqkms[i].getName(); + nameQ = "Q(" + nameW + ")"; + } + + final Facet wq = new FixWaterlevelFacet(i, FIX_WQ_LS, nameW, ComputeType.ADVANCE, hash, id); + + final Facet w = new FixWaterlevelFacet(i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, hash, id); + + final Facet q = new FixWaterlevelFacet(i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, hash, id); + final Facet csFacet = new CrossSectionWaterLineFacet(i, nameW); + + facets.add(wq); + facets.add(w); + facets.add(q); + facets.add(csFacet); + + // XXX: THIS CAN NOT HAPPEN! REMOVE IT! + if (wqkms[i] instanceof WQCKms) { + final String nameC = nameW.replace("benutzerdefiniert", "benutzerdefiniert [korrigiert]"); + + final Facet c = new FixWaterlevelFacet(i, DISCHARGE_LONGITUDINAL_C, nameC); + + facets.add(c); + } + } + + if (wqkms.length > 0) { + final DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy"); + final DateFormat lf = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy'T'HH:mm"); + + final Collection<Date> reds = fixRes.getReferenceEventsDates(); + final UniqueDateFormatter cf = new UniqueDateFormatter(df, lf, reds); + + int i = 0; + for (final Date d : reds) { + facets.add(new FixReferenceEventsFacet((1 << 9) | i, FIX_EVENTS, cf.format(d))); + i++; + } + + facets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); + + facets.add(new DataFacet(WST, "WST data", ComputeType.ADVANCE, hash, id)); + + facets.add(new DataFacet(PDF, "PDF data", ComputeType.ADVANCE, hash, id)); + } + + facets.add(new DataFacet(AT, "AT data", ComputeType.ADVANCE, hash, id)); + + facets.add(new FixWQCurveFacet(0, Resources.getMsg(meta, I18N_WQ_CURVE, I18N_WQ_CURVE) + " (" + access.getFunction() + ")")); + + if (access.getPreprocessing()) { + facets.add(new FixOutlierFacet(0, FIX_OUTLIER, Resources.getMsg(meta, I18N_WQ_OUTLIER, I18N_WQ_OUTLIER))); + } + + return res; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/CalcChoice.java Thu Jul 19 17:33:24 2018 +0200 @@ -0,0 +1,46 @@ +/* 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.bundu.bezugswst; + +import java.util.LinkedHashMap; + +import org.dive4elements.artifactdatabase.data.StateData; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.artifacts.common.utils.XMLUtils; +import org.dive4elements.river.artifacts.states.RadioSelect; +import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; +import org.w3c.dom.Element; + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class CalcChoice extends RadioSelect { + private static final long serialVersionUID = 1L; + + @Override + protected final String getUIProvider() { + return "radio_panel"; + } + + @Override + protected LinkedHashMap<String, String> makeEntries(final CallMeta meta, final Artifact artifact) { + final LinkedHashMap<String, String> entries = new LinkedHashMap<>(); + entries.put("state.bundu.calc.auto", null); + entries.put("state.bundu.calc.manual", null); + return entries; + } + + @Override + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.calc_choice", data.getName(), cr, context); + } + +} \ No newline at end of file
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/LoadQSeriesSelectState.java Thu Jul 19 17:32:27 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/LoadQSeriesSelectState.java Thu Jul 19 17:33:24 2018 +0200 @@ -8,7 +8,13 @@ package org.dive4elements.river.artifacts.bundu.bezugswst; +import org.dive4elements.artifactdatabase.data.StateData; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; +import org.w3c.dom.Element; public class LoadQSeriesSelectState extends DefaultState { private static final long serialVersionUID = 1L; @@ -27,4 +33,8 @@ return "bundu.wst.state.load_single_q_series"; } + @Override + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.fix.year_length", data.getName(), cr, context); + } } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/MissingVolumeSelect.java Thu Jul 19 17:33:24 2018 +0200 @@ -0,0 +1,51 @@ +/* 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.bundu.bezugswst; + +import org.dive4elements.artifactdatabase.data.StateData; +import org.dive4elements.artifacts.Artifact; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.artifacts.CallMeta; +import org.dive4elements.artifacts.common.utils.XMLUtils; +import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; +import org.w3c.dom.Element; + +/** + * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> + */ +public class MissingVolumeSelect extends DefaultState { + + /** + * The default constructor that initializes an empty State object. + */ + public MissingVolumeSelect() { + } + + @Override + protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) { + final CallMeta meta = context.getMeta(); + final Element[] elements = new Element[1]; + elements[0] = createItem(ec, + new String[] { Resources.getMsg(meta, "state.bundu.wst.missing_volume.select", "state.bundu.wst.missing_volume.select"), "missing_volume" }); + + return elements; + } + + @Override + protected String getUIProvider() { + return "fix.missing_volume_panel"; // generalize? + } + + @Override + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.missing_volume", data.getName(), cr, context); + } +}
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FunctionSelect.java Thu Jul 19 17:32:27 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/fixation/FunctionSelect.java Thu Jul 19 17:33:24 2018 +0200 @@ -10,14 +10,16 @@ import java.util.Collection; -import org.w3c.dom.Element; - +import org.dive4elements.artifactdatabase.data.StateData; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.common.utils.XMLUtils; +import org.dive4elements.river.artifacts.bundu.BUNDUArtifact; import org.dive4elements.river.artifacts.math.fitting.Function; import org.dive4elements.river.artifacts.math.fitting.FunctionFactory; import org.dive4elements.river.artifacts.states.DefaultState; +import org.dive4elements.river.artifacts.uinfo.salix.ScenarioTypeState; +import org.w3c.dom.Element; /** * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> @@ -36,25 +38,31 @@ } @Override - protected Element[] createItems( - XMLUtils.ElementCreator ec, - Artifact artifact, - String name, - CallContext context) - { - FunctionFactory ff = FunctionFactory.getInstance(); - Collection<Function> fc = ff.getFunctions(); - Element[] functions = new Element[fc.size()]; + protected Element[] createItems(final XMLUtils.ElementCreator ec, final Artifact artifact, final String name, final CallContext context) { + final FunctionFactory ff = FunctionFactory.getInstance(); + final Collection<Function> fc = ff.getFunctions(); + final Element[] functions = new Element[fc.size()]; int j = 0; - for (Function f: fc) { - String n = f.getName(); - String d = f.getDescription(); - functions[j] = createItem(ec, new String[] {d, n}); + for (final Function f : fc) { + final String n = f.getName(); + final String d = f.getDescription(); + functions[j] = createItem(ec, new String[] { d, n }); j++; } return functions; } + + @Override + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + if (artifact instanceof BUNDUArtifact) { + if (((BUNDUArtifact) artifact).getCurrentStateId().equals("state.bundu.wst.load.function")) { + return ScenarioTypeState.changeHeaderForCurrentState("state.bundu.wst.function", data.getName(), cr, context); + } + + } + return super.createData(cr, artifact, data, context); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/QSeriesLengthPanel.java Thu Jul 19 17:32:27 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/QSeriesLengthPanel.java Thu Jul 19 17:33:24 2018 +0200 @@ -82,14 +82,22 @@ } @Override - public Canvas createOld(final DataList dataList) {// THIS is a Copy from abstractSingleItemPanel :-( + public Canvas createOld(final DataList dataList) { final List<Data> items = dataList.getAll(); final Data years = getData(items, getDatakey()); final DataItem[] yearsItems = years.getItems(); - final String v1 = yearsItems[0].getStringValue().replace(" ", ", "); + final StringBuilder builder = new StringBuilder(); + final int year = Integer.valueOf(yearsItems[0].getStringValue()); + builder.append(year).append(" "); - final Label old = new Label(v1); + if (year > 1) { + builder.append(this.MSG.years_general()); + } else { + builder.append(this.MSG.year()); + } + + final Label old = new Label(builder.toString()); final HLayout layout = new HLayout(); layout.setWidth("400px");