# HG changeset patch # User Ingo Weinzierl # Date 1300117630 0 # Node ID 21d791e21aca7a6b8ff65ce220236425cd54d230 # Parent b18aebd1342f5449988be2e3feedefcf8ff851d6 Introduced a state to select the calculation mode. flys-artifacts/trunk@1467 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Mar 14 15:43:12 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Mar 14 15:47:10 2011 +0000 @@ -1,3 +1,20 @@ +2011-03-14 Ingo Weinzierl + + * doc/conf/artifacts/winfo.xml: Modified the winfo states. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Adapted + the artifact regarding the changes of the last commit. The states + describe() method creates the dynamic UI node - the artifact needs to + apply this node. + + * src/main/java/de/intevation/flys/artifacts/states/CalculationSelect.java: + New. The state for choosing the calculation mode. + + * src/main/resources/messages.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: Added i18n strings for the + calculation mode state. + 2011-03-14 Ingo Weinzierl * src/main/java/de/intevation/flys/artifacts/states/DefaultState.java: diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/doc/conf/artifacts/winfo.xml --- a/flys-artifacts/doc/conf/artifacts/winfo.xml Mon Mar 14 15:43:12 2011 +0000 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Mon Mar 14 15:47:10 2011 +0000 @@ -2,17 +2,17 @@ - + - - + + - - + + diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Mar 14 15:43:12 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Mar 14 15:47:10 2011 +0000 @@ -93,13 +93,20 @@ ProtocolUtils.appendState(creator, root, current); ProtocolUtils.appendReachableStates(creator, root, reachable); - current.describe(description, root, context, identifier()); + Element ui = ProtocolUtils.createArtNode( + creator, "ui", null, null); - Node ui = (Node) XMLUtils.xpath( + Element staticUI = ProtocolUtils.createArtNode( + creator, "static", null, null); + + Element dynamic = current.describe( description, - XPATH_STATIC_UI, - XPathConstants.NODE, - ArtifactNamespaceContext.INSTANCE); + root, + context, + identifier()); + + ui.appendChild(dynamic); + root.appendChild(ui); appendStaticUI(creator, ui); diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/CalculationSelect.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/CalculationSelect.java Mon Mar 14 15:47:10 2011 +0000 @@ -0,0 +1,50 @@ +package de.intevation.flys.artifacts.states; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Element; + +import de.intevation.artifacts.CallContext; + +import de.intevation.artifacts.common.utils.XMLUtils; + +import de.intevation.artifactdatabase.ProtocolUtils; + +/** + * @author Ingo Weinzierl + */ +public class CalculationSelect extends DefaultState { + + /** The logger that is used in this class.*/ + private static Logger logger = Logger.getLogger(CalculationSelect.class); + + + protected Element[] createItems( + XMLUtils.ElementCreator cr, + String name, + CallContext context) + { + Element one = createItem(cr, new String[] {"Abflusskurve", "1"}); + Element two = createItem(cr, new String[] {"Wasserspiegellage", "2"}); + + return new Element[] { one, two }; + } + + + protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { + Element item = ProtocolUtils.createArtNode(cr, "item", null, null); + Element label = ProtocolUtils.createArtNode(cr, "label", null, null); + Element value = ProtocolUtils.createArtNode(cr, "value", null, null); + + String[] arr = (String[]) obj; + + label.setTextContent(arr[0]); + value.setTextContent(arr[1]); + + item.appendChild(label); + item.appendChild(value); + + return item; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Mon Mar 14 15:43:12 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Mon Mar 14 15:47:10 2011 +0000 @@ -1,2 +1,2 @@ state.winfo.river = River -state.winfo.gauge = Pegelauswahl +state.winfo.calculation_mode = Calculation Mode diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Mon Mar 14 15:43:12 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Mon Mar 14 15:47:10 2011 +0000 @@ -1,2 +1,2 @@ state.winfo.river = Fluss -state.winfo.gauge = Pegelauswahl +state.winfo.calculation_mode = Berechnungsart diff -r b18aebd1342f -r 21d791e21aca flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Mon Mar 14 15:43:12 2011 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Mon Mar 14 15:47:10 2011 +0000 @@ -1,2 +1,2 @@ state.winfo.river = River -state.winfo.gauge = Pegelauswahl +state.winfo.calculation_mode = Calculation Mode