Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/common/UInfoResultType.java @ 9429:bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
Colors and i10n for all themes.
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 17:48:01 +0200 |
parents | 2aec052d4088 |
children | d194c5b24bf8 |
rev | line source |
---|---|
8996 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
9328 | 10 package org.dive4elements.river.artifacts.uinfo.common; |
8996 | 11 |
12 import java.text.NumberFormat; | |
13 | |
14 import org.dive4elements.artifacts.CallContext; | |
15 import org.dive4elements.river.artifacts.common.AbstractResultType; | |
16 import org.dive4elements.river.utils.Formatter; | |
17 | |
18 /** | |
19 * @author Domenico Nardi Tironi | |
20 * | |
21 */ | |
22 public abstract class UInfoResultType extends AbstractResultType { | |
23 | |
9006 | 24 private static final long serialVersionUID = 1L; |
25 | |
9429
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
26 protected UInfoResultType(final String unit, final String csvHeader) { |
8996 | 27 super(unit, csvHeader, csvHeader); |
28 } | |
29 | |
9361
2aec052d4088
Refactoring on SalixLineCalculationResult etc., calculation using MQ etc., scenario (regional+supra) csv columns and meta data added
mschaefer
parents:
9328
diff
changeset
|
30 public static final UInfoResultType customMultiRowColSalixScenarios = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scenario") { |
9243 | 31 private static final long serialVersionUID = 1L; |
32 | |
33 @Override | |
34 public String exportValue(final CallContext context, final Object value) { | |
35 throw new UnsupportedOperationException(); | |
36 } | |
37 | |
38 @Override | |
39 protected NumberFormat createFormatter(final CallContext context) { | |
40 throw new UnsupportedOperationException(); | |
41 } | |
42 }; | |
43 | |
9361
2aec052d4088
Refactoring on SalixLineCalculationResult etc., calculation using MQ etc., scenario (regional+supra) csv columns and meta data added
mschaefer
parents:
9328
diff
changeset
|
44 public static final UInfoResultType salix_mw_mnw = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.mw_mnw") { |
9243 | 45 private static final long serialVersionUID = 1L; |
46 | |
47 @Override | |
48 public String exportValue(final CallContext context, final Object value) { | |
49 final double doubleValue = asDouble(value); | |
50 return exportDoubleValue(context, doubleValue); | |
51 } | |
52 | |
53 @Override | |
54 protected NumberFormat createFormatter(final CallContext context) { | |
55 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
56 // digits. | |
57 return Formatter.getSalixLine(context); | |
58 } | |
59 }; | |
60 | |
8996 | 61 public static final UInfoResultType salixline = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.salix_line") { |
9006 | 62 private static final long serialVersionUID = 1L; |
63 | |
8996 | 64 @Override |
65 public String exportValue(final CallContext context, final Object value) { | |
66 final double doubleValue = asDouble(value); | |
67 return exportDoubleValue(context, doubleValue); | |
68 } | |
69 | |
70 @Override | |
71 protected NumberFormat createFormatter(final CallContext context) { | |
72 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
73 // digits. | |
74 return Formatter.getSalixLine(context); | |
75 } | |
76 }; | |
77 | |
9006 | 78 public static final UInfoResultType vegname = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.name") { |
79 private static final long serialVersionUID = 1L; | |
80 | |
81 @Override | |
82 public String exportValue(final CallContext context, final Object value) { | |
83 return exportStringValue(value); | |
84 } | |
85 | |
86 @Override | |
87 protected NumberFormat createFormatter(final CallContext context) { | |
88 throw new UnsupportedOperationException(); | |
89 } | |
90 }; | |
91 | |
9260 | 92 public static final UInfoResultType vegzone_color = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.color") { |
93 private static final long serialVersionUID = 1L; | |
94 | |
95 @Override | |
96 public String exportValue(final CallContext context, final Object value) { | |
97 return exportStringValue(value); | |
98 } | |
99 | |
100 @Override | |
101 protected NumberFormat createFormatter(final CallContext context) { | |
102 throw new UnsupportedOperationException(); | |
103 } | |
104 }; | |
9006 | 105 public static final UInfoResultType vegdauervon = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauervon") { |
106 private static final long serialVersionUID = 1L; | |
107 | |
108 @Override | |
109 public String exportValue(final CallContext context, final Object value) { | |
9101 | 110 final double doubleValue = asDouble(value); |
111 return exportDoubleValue(context, doubleValue); | |
9006 | 112 } |
113 | |
114 @Override | |
115 protected NumberFormat createFormatter(final CallContext context) { | |
116 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
117 // digits. | |
118 return Formatter.getUeberflutungsdauer(context); | |
119 } | |
120 }; | |
121 | |
122 public static final UInfoResultType vegdauerbis = new UInfoResultType(null, "uinfo.export.csv.meta.header.veg.dauerbis") { | |
123 private static final long serialVersionUID = 1L; | |
124 | |
125 @Override | |
126 public String exportValue(final CallContext context, final Object value) { | |
9260 | 127 // valix hex-Check? |
128 return String.valueOf(value); | |
9006 | 129 } |
130 | |
131 @Override | |
132 protected NumberFormat createFormatter(final CallContext context) { | |
133 // REMARK: other modules use Formatter.getWaterlevelW(context) instead, but that format with a variable number of | |
134 // digits. | |
135 return Formatter.getUeberflutungsdauer(context); | |
136 } | |
137 }; | |
9429
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
138 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
139 public static final UInfoResultType waterlevelMNW = new UInfoResultType(null, null) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
140 private static final long serialVersionUID = 1L; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
141 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
142 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
143 public String exportValue(final CallContext context, final Object value) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
144 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
145 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
146 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
147 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
148 protected NumberFormat createFormatter(final CallContext context) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
149 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
150 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
151 }; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
152 public static final UInfoResultType waterlevelMW = new UInfoResultType(null, null) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
153 private static final long serialVersionUID = 1L; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
154 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
155 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
156 public String exportValue(final CallContext context, final Object value) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
157 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
158 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
159 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
160 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
161 protected NumberFormat createFormatter(final CallContext context) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
162 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
163 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
164 }; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
165 public static final UInfoResultType waterlevelMHW = new UInfoResultType(null, null) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
166 private static final long serialVersionUID = 1L; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
167 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
168 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
169 public String exportValue(final CallContext context, final Object value) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
170 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
171 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
172 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
173 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
174 protected NumberFormat createFormatter(final CallContext context) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
175 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
176 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
177 }; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
178 public static final UInfoResultType waterlevelMH5 = new UInfoResultType(null, null) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
179 private static final long serialVersionUID = 1L; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
180 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
181 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
182 public String exportValue(final CallContext context, final Object value) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
183 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
184 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
185 |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
186 @Override |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
187 protected NumberFormat createFormatter(final CallContext context) { |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
188 throw new UnsupportedOperationException(); |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
189 } |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
190 }; |
bd5f5d2220fa
Work on salix cross sections; waterlevels work now with different colors
gernotbelger
parents:
9361
diff
changeset
|
191 } |