comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/CalculationSelect.java @ 141:7f909429ccc8

Added some more calculation types (to the DESCRIBE in the calculation select state). flys-artifacts/trunk@1524 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 21 Mar 2011 09:16:17 +0000
parents 21d791e21aca
children b5c99532f898
comparison
equal deleted inserted replaced
140:43f03f6047b9 141:7f909429ccc8
3 import org.apache.log4j.Logger; 3 import org.apache.log4j.Logger;
4 4
5 import org.w3c.dom.Element; 5 import org.w3c.dom.Element;
6 6
7 import de.intevation.artifacts.CallContext; 7 import de.intevation.artifacts.CallContext;
8 import de.intevation.artifacts.CallMeta;
8 9
9 import de.intevation.artifacts.common.utils.XMLUtils; 10 import de.intevation.artifacts.common.utils.XMLUtils;
10 11
11 import de.intevation.artifactdatabase.ProtocolUtils; 12 import de.intevation.artifactdatabase.ProtocolUtils;
13
14 import de.intevation.flys.artifacts.resources.Resources;
12 15
13 /** 16 /**
14 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
15 */ 18 */
16 public class CalculationSelect extends DefaultState { 19 public class CalculationSelect extends DefaultState {
17 20
18 /** The logger that is used in this class.*/ 21 /** The logger that is used in this class.*/
19 private static Logger logger = Logger.getLogger(CalculationSelect.class); 22 private static Logger logger = Logger.getLogger(CalculationSelect.class);
20 23
21 24
25 /** Constant value for the reference line calculation.*/
26 public static final String CALCULATION_REFERENCE_LINE =
27 "calc.reference.line";
28
29 /** Constant value for the differences calculation.*/
30 public static final String CALCULATION_DIFFERENCES =
31 "calc.differences";
32
33 /** Constant value for the flood map calculation.*/
34 public static final String CALCULATION_FLOOD_MAP =
35 "calc.flood.map";
36
37 /** Constant value for the profile calculation.*/
38 public static final String CALCULATION_PROFILE =
39 "calc.profile";
40
41 /** Constant value for the state discharge curve calculation.*/
42 public static final String CALCULATION_STATE_DISCHARGE_CURVE =
43 "calc.state.discharge.curve";
44
45 /** An array that holds all available calculation modes.*/
46 public static final String[] CALCULATIONS = {
47 CALCULATION_REFERENCE_LINE,
48 CALCULATION_DIFFERENCES,
49 CALCULATION_FLOOD_MAP,
50 CALCULATION_PROFILE,
51 CALCULATION_STATE_DISCHARGE_CURVE };
52
53
22 protected Element[] createItems( 54 protected Element[] createItems(
23 XMLUtils.ElementCreator cr, 55 XMLUtils.ElementCreator cr,
24 String name, 56 String name,
25 CallContext context) 57 CallContext context)
26 { 58 {
27 Element one = createItem(cr, new String[] {"Abflusskurve", "1"}); 59 CallMeta meta = context.getMeta();
28 Element two = createItem(cr, new String[] {"Wasserspiegellage", "2"}); 60 Element[] calcs = new Element[CALCULATIONS.length];
29 61
30 return new Element[] { one, two }; 62 int i = 0;
63
64 for (String calc: CALCULATIONS) {
65 calcs[i++] = createItem(
66 cr, new String[] {
67 Resources.getMsg(meta, calc, calc),
68 calc
69 });
70 }
71
72 return calcs;
31 } 73 }
32 74
33 75
34 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) { 76 protected Element createItem(XMLUtils.ElementCreator cr, Object obj) {
35 Element item = ProtocolUtils.createArtNode(cr, "item", null, null); 77 Element item = ProtocolUtils.createArtNode(cr, "item", null, null);

http://dive4elements.wald.intevation.org