Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java @ 9229:0dcd1cd41915
Different themes/facets for left bank and right bank infrastructures in S-Info flood durations, some fixmes done
author | mschaefer |
---|---|
date | Thu, 05 Jul 2018 16:49:42 +0200 |
parents | 3dae6b78e1da |
children | 6c88ad449c83 |
comparison
equal
deleted
inserted
replaced
9228:dba14da43f23 | 9229:0dcd1cd41915 |
---|---|
15 import org.dive4elements.artifacts.CallContext; | 15 import org.dive4elements.artifacts.CallContext; |
16 import org.dive4elements.river.artifacts.common.AbstractResultType; | 16 import org.dive4elements.river.artifacts.common.AbstractResultType; |
17 import org.dive4elements.river.artifacts.common.I18NStrings; | 17 import org.dive4elements.river.artifacts.common.I18NStrings; |
18 import org.dive4elements.river.artifacts.resources.Resources; | 18 import org.dive4elements.river.artifacts.resources.Resources; |
19 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.SoilKind; | 19 import org.dive4elements.river.artifacts.sinfo.tkhcalculation.SoilKind; |
20 import org.dive4elements.river.model.Attribute.AttributeKey; | |
20 import org.dive4elements.river.utils.Formatter; | 21 import org.dive4elements.river.utils.Formatter; |
21 import org.dive4elements.river.utils.RiverUtils; | 22 import org.dive4elements.river.utils.RiverUtils; |
22 | 23 |
23 /** | 24 /** |
24 * Result type for data that goes into {@link SInfoResultRow}s. | 25 * Result type for data that goes into {@link SInfoResultRow}s. |
326 public static final SInfoResultType riverside = new SInfoResultType(I18NStrings.UNIT_NONE, "sinfo.export.flood_duration.csv.header.riverside") { | 327 public static final SInfoResultType riverside = new SInfoResultType(I18NStrings.UNIT_NONE, "sinfo.export.flood_duration.csv.header.riverside") { |
327 private static final long serialVersionUID = 1L; | 328 private static final long serialVersionUID = 1L; |
328 | 329 |
329 @Override | 330 @Override |
330 public String exportValue(final CallContext context, final Object value) { | 331 public String exportValue(final CallContext context, final Object value) { |
331 return exportStringValue(value); | 332 return localizeRiverside(context, (AttributeKey) value); |
332 } | 333 } |
333 | 334 |
334 @Override | 335 @Override |
335 protected NumberFormat createFormatter(final CallContext context) { | 336 protected NumberFormat createFormatter(final CallContext context) { |
336 throw new UnsupportedOperationException(); | 337 throw new UnsupportedOperationException(); |
337 } | 338 } |
338 }; | 339 }; |
340 | |
341 /** | |
342 * Returns the localized text of a riverside | |
343 * FIXME: Find a better place for this common method | |
344 */ | |
345 public static final String localizeRiverside(final CallContext context, final AttributeKey riverside) { | |
346 if (riverside == AttributeKey.LEFT) | |
347 return Resources.getMsg(context.getMeta(), "riverside.left"); | |
348 else if (riverside == AttributeKey.RIGHT) | |
349 return Resources.getMsg(context.getMeta(), "riverside.right"); | |
350 else | |
351 return "?"; | |
352 } | |
339 | 353 |
340 public static final SInfoResultType gaugeLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_GAUGE_HEADER) { | 354 public static final SInfoResultType gaugeLabel = new SInfoResultType(I18NStrings.UNIT_NONE, SInfoI18NStrings.CSV_GAUGE_HEADER) { |
341 private static final long serialVersionUID = 1L; | 355 private static final long serialVersionUID = 1L; |
342 | 356 |
343 @Override | 357 @Override |