annotate artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodplainChoice.java @ 9390:f575ff573cbb

"Name der Peilung" columname minfo.
author gernotbelger
date Thu, 09 Aug 2018 15:22:31 +0200
parents 2323d005f9a5
children
rev   line source
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
5994
af13ceeba52a Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5863
diff changeset
6 * documentation coming with Dive4Elements River for details.
5863
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
4897a58c8746 River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2579
diff changeset
9 package org.dive4elements.river.artifacts.states;
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
2579
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
11 import org.apache.log4j.Logger;
5831
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2579
diff changeset
12 import org.dive4elements.artifacts.Artifact;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2579
diff changeset
13 import org.dive4elements.artifacts.CallContext;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2579
diff changeset
14 import org.dive4elements.artifacts.CallMeta;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2579
diff changeset
15 import org.dive4elements.artifacts.common.utils.XMLUtils;
bd047b71ab37 Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents: 2579
diff changeset
16 import org.dive4elements.river.artifacts.resources.Resources;
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
17 import org.w3c.dom.Element;
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 /**
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 */
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
22 // FIXME: inherit from BooleanChoiceState instead to remove duplicate code; BUT: this will probably break artifact
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
23 // serialization
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public class FloodplainChoice extends DefaultState {
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
26 public static final String OPTION = "floodplain.option";
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
27 public static final String ACTIVE = "floodplain.active";
2579
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
28 public static final String INACTIVE = "floodplain.inactive";
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
29
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
30 private static final Logger log = Logger.getLogger(FloodplainChoice.class);
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 @Override
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 protected String getUIProvider() {
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 return "boolean_panel";
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 }
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 @Override
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
38 protected Element[] createItems(final XMLUtils.ElementCreator cr, final Artifact artifact, final String name, final CallContext context) {
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
39 final CallMeta meta = context.getMeta();
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
41 final Element option = createItem(cr, new String[] { Resources.getMsg(meta, OPTION, OPTION), "true" });
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 return new Element[] { option };
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 }
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45
2579
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
46 @Override
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
47 protected String getLabelFor(final CallContext cc, final String name, final String value, final String type) {
8202
e4606eae8ea5 sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5994
diff changeset
48 log.debug("GET LABEL FOR '" + name + "' / '" + value + "'");
2579
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
49 if (value != null && value.equals("true")) {
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
50 return Resources.getMsg(cc.getMeta(), ACTIVE, ACTIVE);
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
51 } else {
2579
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
52 return Resources.getMsg(cc.getMeta(), INACTIVE, INACTIVE);
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
53 }
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
54 }
2867ae59e216 #566 Improved german translation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1050
diff changeset
55
9277
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
56 // ist mit super identisch!
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
57 // protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
58 // Element item = ProtocolUtils.createArtNode(cr, "item", null, null);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
59 // Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
60 // Element value = ProtocolUtils.createArtNode(cr, "value", null, null);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
61 //
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
62 // String[] arr = (String[]) obj;
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
63 //
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
64 // label.setTextContent(arr[0]);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
65 // value.setTextContent(arr[1]);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
66 //
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
67 // item.appendChild(label);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
68 // item.appendChild(value);
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
69 //
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
70 // return item;
2323d005f9a5 compile error fix
gernotbelger
parents: 8851
diff changeset
71 // }
927
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 }
53a2be494765 Enhanced the transition model to continue the parameterization in the waterlevel state to compute flood maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org