changeset 7306:d7b2c14a9693

issue1345: Adjust name of sediment yield/load facets to include fraction name and times.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 14 Oct 2013 09:53:54 +0200
parents 2e4ffd35cafa
children 173d872a374c
files artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java	Mon Oct 14 09:52:17 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java	Mon Oct 14 09:53:54 2013 +0200
@@ -9,6 +9,8 @@
 package org.dive4elements.river.artifacts;
 
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 
 import org.apache.log4j.Logger;
@@ -29,6 +31,7 @@
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFacet;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFactory;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult;
+import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.states.StaticState;
 
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -143,7 +146,16 @@
         String code = getDatacageIDValue(data);
 
         if (code != null) {
-            String name = SedimentLoadFactory.getSedimentYieldDescription(Integer.valueOf(code));
+            String fraction = SedimentLoadFactory.getSedimentYieldFractionName(Integer.valueOf(code));
+            String fractionName = Resources.getMsg(callMeta, fraction, "-");
+            Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(Integer.valueOf(code));
+            Calendar date = Calendar.getInstance();
+            date.setTime(dates[0]);
+            String name = fractionName + " " + date.get(Calendar.YEAR);
+            if (dates[1] != null) {
+                date.setTime(dates[1]);
+                name += " - " + date.get(Calendar.YEAR);
+            }
 
             Facet facet = new SedimentLoadFacet(
                 0,

http://dive4elements.wald.intevation.org