Mercurial > dive4elements > river
changeset 9164:8c0d1542c1d8
uinfo.distance_only Berechnungsstrecke -> Darstellungsbereich HACK
author | gernotbelger |
---|---|
date | Wed, 20 Jun 2018 11:13:40 +0200 |
parents | d5dcdd2c7db6 |
children | 0cc241ddc2a0 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistancePanel.java |
diffstat | 4 files changed, 39 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java Wed Jun 20 11:07:29 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java Wed Jun 20 11:13:40 2018 +0200 @@ -9,76 +9,54 @@ package org.dive4elements.river.artifacts.states; import org.apache.log4j.Logger; - -import org.w3c.dom.Element; - +import org.dive4elements.artifactdatabase.ProtocolUtils; +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.artifactdatabase.ProtocolUtils; -import org.dive4elements.artifactdatabase.data.StateData; - import org.dive4elements.river.artifacts.D4EArtifact; - +import org.dive4elements.river.artifacts.access.RiverAccess; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.resources.Resources; -import org.dive4elements.river.artifacts.access.RiverAccess; - +import org.w3c.dom.Element; /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ -public class ComputationRangeState -extends RangeState -implements FacetTypes -{ - private static Logger log = - Logger.getLogger(ComputationRangeState.class); +public class ComputationRangeState extends RangeState implements FacetTypes { + private static Logger log = Logger.getLogger(ComputationRangeState.class); /** The default step width. */ public static final int DEFAULT_STEP = 100; - public ComputationRangeState() { } - @Override - protected Element createData( - XMLUtils.ElementCreator cr, - Artifact artifact, - StateData data, - CallContext context) - { - Element select = ProtocolUtils.createArtNode( - cr, "select", null, null); + protected Element createData(final XMLUtils.ElementCreator cr, final Artifact artifact, final StateData data, final CallContext context) { + final Element select = ProtocolUtils.createArtNode(cr, "select", null, null); cr.addAttr(select, "name", data.getName(), true); - Element label = ProtocolUtils.createArtNode( - cr, "label", null, null); + final Element label = ProtocolUtils.createArtNode(cr, "label", null, null); - label.setTextContent(Resources.getMsg( - context.getMeta(), - data.getName(), - data.getName())); + label.setTextContent(Resources.getMsg(context.getMeta(), getID(), getID())); + // VORHER: data.getName(), data.getName())) (entsprach "ld_from", "ld_to" - unterschied zu jetzt: description wird + // anders gesetzt ("Wahl der Berechnungsstrecke") + // label bleibt "ld_from", "ld_to"; unklar, wo das gesetzt wird. unklar, warum das Element "label" die Description + // beeinflusst (und scheinbar nicht das Label) + final Element description = ProtocolUtils.createArtNode(cr, "description", null, null); + description.setTextContent("TEST"); + select.appendChild(description); select.appendChild(label); return select; } - @Override - protected Element[] createItems( - XMLUtils.ElementCreator cr, - Artifact artifact, - String name, - CallContext context) - { - double[] minmax = getMinMax(artifact); + protected Element[] createItems(final XMLUtils.ElementCreator cr, final Artifact artifact, final String name, final CallContext context) { + final double[] minmax = getMinMax(artifact); double minVal = Double.MIN_VALUE; double maxVal = Double.MAX_VALUE; @@ -86,41 +64,30 @@ if (minmax != null) { minVal = minmax[0]; maxVal = minmax[1]; - } - else { + } else { log.warn("Could not read min/max distance values!"); } if (name.equals("ld_from")) { - Element min = createItem( - cr, - new String[] {"min", new Double(minVal).toString()}); + final Element min = createItem(cr, new String[] { "min", new Double(minVal).toString() }); return new Element[] { min }; - } - else if (name.equals("ld_to")) { - Element max = createItem( - cr, - new String[] {"max", new Double(maxVal).toString()}); + } else if (name.equals("ld_to")) { + final Element max = createItem(cr, new String[] { "max", new Double(maxVal).toString() }); return new Element[] { max }; - } - else { - Element step = createItem( - cr, - new String[] {"step", String.valueOf(getDefaultStep())}); + } else { + final Element step = createItem(cr, new String[] { "step", String.valueOf(getDefaultStep()) }); return new Element[] { step }; } } @Override - protected double[] getMinMax(Artifact artifact) { - return new RiverAccess((D4EArtifact)artifact).getRiver() - .determineMinMaxDistance(); + protected double[] getMinMax(final Artifact artifact) { + return new RiverAccess((D4EArtifact) artifact).getRiver().determineMinMaxDistance(); } - protected double getDefaultStep() { return DEFAULT_STEP; }
--- a/artifacts/src/main/resources/messages.properties Wed Jun 20 11:07:29 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Wed Jun 20 11:13:40 2018 +0200 @@ -1064,11 +1064,10 @@ scenarioType.option3 = Historische Betrachtung help.state.uinfo.scenario_type=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.scenario_type -state.uinfo.distance = Berechnungsstrecke w\u00e4hlen [km] state.uinfo.distance_only_part = Teilabschnitt help.state.uinfo.distance_only_part = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.distance_only_part -state.uinfo.distance_only = Range selection +state.uinfo.distance_only = Wahl des Darstellungsbereichs help.state.uinfo.distance_only = ${help.url}/OnlineHilfe/UINFO#help.state.uinfo.distance_only uinfo_salix_line = Salix-Linie uinfo_inundation_duration = \u00dcberflutungsdauern Aue
--- a/artifacts/src/main/resources/messages_de.properties Wed Jun 20 11:07:29 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Wed Jun 20 11:13:40 2018 +0200 @@ -1063,12 +1063,11 @@ scenarioType.option2 = \u00dcberregional wirkende Eingriffe scenarioType.option1 = Historische Betrachtung help.state.uinfo.scenario_type=${help.url}/OnlineHilfe/UINFO#help.state.uinfo.scenario_type - -state.uinfo.distance = Berechnungsstrecke w\u00e4hlen [km] + state.uinfo.distance_only_part = Teilabschnitt help.state.uinfo.distance_only_part = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.distance_only_part -state.uinfo.distance_only = Wahl der Berechnungsstrecke +state.uinfo.distance_only = Wahl des Darstellungsbereichs help.state.uinfo.distance_only = ${help.url}/OnlineHilfe/SINFO#help.state.sinfo.distance_only uinfo_salix_line = Salix-Linie uinfo_inundation_duration = \u00dcberflutungsdauern Aue
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistancePanel.java Wed Jun 20 11:07:29 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/DistancePanel.java Wed Jun 20 11:13:40 2018 +0200 @@ -97,7 +97,7 @@ final VLayout layout = new VLayout(); layout.setMembersMargin(10); - final Label label = new Label(getLabel()); + final Label label = getLabel(data); final Canvas submit = getNextButton(); @@ -115,6 +115,14 @@ return layout; } + private Label getLabel(final DataList data) { + final Data item = data.get(0); + if (data.getState().contains("uinfo")) { // "Wahl der Berechnungsstrecke/des Darstellungsbereichs" (server) vs. "Berechnungsstrecke wählen" (client) + return new Label(item.getDescription()); // holt das Label vom Server (funktoniert schon sehr oft so!) + } + return new Label(getLabel()); // holt das Label aus den Flys-Constants.. + } + @Override public Canvas createOld(final DataList dataList) { final String s = getOldSelectionString(dataList);