Mercurial > dive4elements > river
changeset 3722:c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
flys-artifacts/trunk@5382 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 07 Sep 2012 12:03:48 +0000 |
parents | 1cfe788325d5 |
children | 7b14d00bca8a |
files | flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties |
diffstat | 9 files changed, 67 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Sep 07 12:03:48 2012 +0000 @@ -1,3 +1,21 @@ +2012-09-07 Raimund Renkert <raimund.renkert@intevation.de> + + * doc/conf/artifacts/minfo.xml: + Add data fields for characteristic bed and bedload diameter. + + * src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java: + Use parametermatrix as UI provider and set the correct data. + + * src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java, + src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java: + Updated method parameter. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: + Added i18n strings. + 2012-09-07 Raimund Renkert <raimund.renkert@intevation.de> Issue 791.
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/doc/conf/artifacts/minfo.xml Fri Sep 07 12:03:48 2012 +0000 @@ -197,7 +197,8 @@ </state> <state id="state.minfo.bed.char_diameter" description="state.minfo.bed.char_diameter" state="de.intevation.flys.artifacts.states.minfo.CharDiameter"> - <data name="diameter" type="String"/> + <data name="bed_diameter" type="options"/> + <data name="load_diameter" type="options"/> </state> <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MultiStringArrayState.java Fri Sep 07 12:03:48 2012 +0000 @@ -35,7 +35,7 @@ try { creator.addAttr(select, "type", "options", true); - for (KVP kvp: getOptions(artifact, name)) { + for (KVP kvp: getOptions(artifact, name, context)) { Element item = creator.create("item"); creator.addAttr(item, "label", kvp.getValue().toString(), true); creator.addAttr(item, "value", kvp.getKey().toString(), true); @@ -80,7 +80,8 @@ protected abstract KVP<String, String>[] getOptions( Artifact artifact, - String parameterName + String parameterName, + CallContext context ) throws IllegalArgumentException;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java Fri Sep 07 12:03:48 2012 +0000 @@ -39,7 +39,8 @@ @Override protected KVP<String, String>[] getOptions( Artifact artifact, - String parameterName + String parameterName, + CallContext context ) throws IllegalArgumentException {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java Fri Sep 07 12:03:48 2012 +0000 @@ -1,17 +1,26 @@ package de.intevation.flys.artifacts.states.minfo; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.apache.poi.hssf.record.formula.functions.Rows; import org.w3c.dom.Element; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.common.model.KVP; import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.flys.artifacts.resources.Resources; import de.intevation.flys.artifacts.states.DefaultState; +import de.intevation.flys.artifacts.states.MultiStringArrayState; -public class CharDiameter extends DefaultState { +public class CharDiameter extends MultiStringArrayState { - public static final String UI_PROVIDER = "minfo.bed.char_diameter"; + private static final Logger logger = Logger.getLogger(CharDiameter.class); + + public static final String UI_PROVIDER = "parameter-matrix"; private static final String CHAR_DIAMETER_MIN = "calc.bed.dmin"; private static final String CHAR_DIAMETER_MAX = "calc.bed.dmax"; @@ -55,25 +64,31 @@ } @Override - protected Element[] createItems( - XMLUtils.ElementCreator cr, - Artifact artifact, - String name, - CallContext context) + protected KVP<String, String>[] getOptions( + Artifact artifact, + String parameterName, + CallContext context + ) + throws IllegalArgumentException { CallMeta meta = context.getMeta(); - Element[] calcs = new Element[CHAR_DIAMETER.length]; + List<KVP<String, String>> rows = new ArrayList<KVP<String, String>>(); + String key = parameterName; for (int i = 0; i < CHAR_DIAMETER.length; ++i) { String calc = CHAR_DIAMETER[i]; - calcs[i] = createItem( - cr, new String[] { - Resources.getMsg(meta, calc, calc), - calc - }); + rows.add(new KVP (calc, + Resources.getMsg(meta, calc, calc))); } - return calcs; + return rows.toArray(new KVP[rows.size()]); + } + + @Override + protected String getLabelFor(CallContext cc, String parameterName, + String value) throws IllegalArgumentException { + + return Resources.getMsg(cc.getMeta(), value, value); } }
--- a/flys-artifacts/src/main/resources/messages.properties Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Fri Sep 07 12:03:48 2012 +0000 @@ -442,3 +442,6 @@ module.fixanalysis = Fix Analysis module.new_map = New Map module.new_chart = New Chart + +load_diameter = Bedload Diameter +bed_diameter = Bed Diameter
--- a/flys-artifacts/src/main/resources/messages_de.properties Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Fri Sep 07 12:03:48 2012 +0000 @@ -445,3 +445,6 @@ module.fixanalysis = Fixierungsanalyse module.new_map = Neue Karte module.new_chart = Neues Diagramm + +load_diameter = Geschiebedurchmesser +bed_diameter = Sohldurchmesser
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Fri Sep 07 12:03:48 2012 +0000 @@ -444,3 +444,7 @@ module.fixanalysis = Fixierungsanalyse module.new_map = Neue Karte module.new_chart = Neues Diagramm + +load_diameter = Geschiebedurchmesser +bed_diameter = Sohldurchmesser +
--- a/flys-artifacts/src/main/resources/messages_en.properties Fri Sep 07 11:58:41 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Fri Sep 07 12:03:48 2012 +0000 @@ -443,3 +443,6 @@ module.fixanalysis = Fix Analysis module.new_map = New Map module.new_chart = New Chart + +load_diameter = Bedload Diameter +bed_diameter = Bed Diameter