Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java @ 5759:9f9dfe1b9913
Add a different translation for catchment_wms
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 18 Apr 2013 12:37:24 +0200 |
parents | a5f65e8983be |
children |
rev | line source |
---|---|
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.states.minfo; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
3 import java.util.ArrayList; |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
4 import java.util.List; |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
5 |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
6 import org.apache.log4j.Logger; |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.Artifact; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.CallContext; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.CallMeta; |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
11 import de.intevation.artifacts.common.model.KVP; |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.artifacts.resources.Resources; |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
13 import de.intevation.flys.artifacts.states.MultiStringArrayState; |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
15 public class CharDiameter extends MultiStringArrayState { |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
17 private static final Logger logger = Logger.getLogger(CharDiameter.class); |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
18 |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
19 public static final String UI_PROVIDER = "parameter-matrix"; |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 private static final String CHAR_DIAMETER_MIN = "calc.bed.dmin"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 private static final String CHAR_DIAMETER_MAX = "calc.bed.dmax"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 private static final String CHAR_DIAMETER_90 = "calc.bed.d90"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 private static final String CHAR_DIAMETER_84 = "calc.bed.d84"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 private static final String CHAR_DIAMETER_80 = "calc.bed.d80"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 private static final String CHAR_DIAMETER_75 = "calc.bed.d75"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 private static final String CHAR_DIAMETER_70 = "calc.bed.d70"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 private static final String CHAR_DIAMETER_60 = "calc.bed.d60"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 private static final String CHAR_DIAMETER_50 = "calc.bed.d50"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 private static final String CHAR_DIAMETER_40 = "calc.bed.d40"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 private static final String CHAR_DIAMETER_30 = "calc.bed.d30"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 private static final String CHAR_DIAMETER_25 = "calc.bed.d25"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 private static final String CHAR_DIAMETER_20 = "calc.bed.d20"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 private static final String CHAR_DIAMETER_16 = "calc.bed.d16"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 private static final String CHAR_DIAMETER_10 = "calc.bed.d10"; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 public static final String[] CHAR_DIAMETER = { |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 CHAR_DIAMETER_10, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 CHAR_DIAMETER_16, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 CHAR_DIAMETER_20, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 CHAR_DIAMETER_25, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 CHAR_DIAMETER_30, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 CHAR_DIAMETER_40, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 CHAR_DIAMETER_50, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 CHAR_DIAMETER_60, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 CHAR_DIAMETER_70, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 CHAR_DIAMETER_75, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 CHAR_DIAMETER_80, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 CHAR_DIAMETER_84, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 CHAR_DIAMETER_90, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 CHAR_DIAMETER_MAX, |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 CHAR_DIAMETER_MIN |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 }; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 @Override |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 public String getUIProvider() { |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 return UI_PROVIDER; |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 } |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 @Override |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
61 protected KVP<String, String>[] getOptions( |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
62 Artifact artifact, |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
63 String parameterName, |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
64 CallContext context |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
65 ) |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
66 throws IllegalArgumentException |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 { |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 CallMeta meta = context.getMeta(); |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
70 List<KVP<String, String>> rows = new ArrayList<KVP<String, String>>(); |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
71 String key = parameterName; |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 for (int i = 0; i < CHAR_DIAMETER.length; ++i) { |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 String calc = CHAR_DIAMETER[i]; |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
74 rows.add(new KVP (calc, |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
75 Resources.getMsg(meta, calc, calc))); |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 } |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 |
3722
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
78 return rows.toArray(new KVP[rows.size()]); |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
79 } |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
80 |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
81 @Override |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
82 protected String getLabelFor(CallContext cc, String parameterName, |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
83 String value) throws IllegalArgumentException { |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
84 |
c91e7db0fd4b
Set data for characteristic diameter for use in parameter matrix UI.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3629
diff
changeset
|
85 return Resources.getMsg(cc.getMeta(), value, value); |
3629
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 } |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 |
f3717e625b0a
MINFO: Added states and config for bed quality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 } |