diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 1809:f6a190f6aaff

Give outputname to artifacts getInitialFacetActivity, generate second pair of MainvalueFacets for discharge curves. flys-artifacts/trunk@3138 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 02 Nov 2011 11:21:57 +0000
parents f3be8fa1ec62
children 4ee833095e75
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Wed Nov 02 11:15:00 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java	Wed Nov 02 11:21:57 2011 +0000
@@ -21,6 +21,7 @@
 import de.intevation.flys.model.River;
 
 import de.intevation.flys.artifacts.model.Calculation;
+import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.MainValuesQFacet;
 import de.intevation.flys.artifacts.model.MainValuesWFacet;
 import de.intevation.flys.artifacts.model.NamedDouble;
@@ -40,6 +41,7 @@
  */
 public class MainValuesArtifact
 extends      StaticFLYSArtifact
+implements   FacetTypes
 {
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(MainValuesArtifact.class);
@@ -76,18 +78,36 @@
         logger.debug("MainValuesArtifact.setup");
         state = new StaticState(STATIC_STATE_NAME);
 
-        Facet qfacet = new MainValuesQFacet(Resources.getMsg(
-            callMeta,
-            "facet.discharge_curves.mainvalues.q",
-            "facet.discharge_curves.mainvalues.q"));
-        Facet wfacet = new MainValuesWFacet(Resources.getMsg(
-            callMeta,
-            "facet.discharge_curves.mainvalues.w",
-            "facet.discharge_curves.mainvalues.w"));
+        Facet qfacet1 = new MainValuesQFacet(
+            COMPUTED_DISCHARGE_MAINVALUES_Q,
+            Resources.getMsg(
+                callMeta,
+                "facet.discharge_curves.mainvalues.q",
+                "facet.discharge_curves.mainvalues.q"));
+        Facet qfacet2 = new MainValuesQFacet(
+            MAINVALUES_Q,
+            Resources.getMsg(
+                callMeta,
+                "facet.discharge_curves.mainvalues.q",
+                "facet.discharge_curves.mainvalues.q"));
+        Facet wfacet1 = new MainValuesWFacet(
+            COMPUTED_DISCHARGE_MAINVALUES_W,
+            Resources.getMsg(
+                callMeta,
+                "facet.discharge_curves.mainvalues.w",
+                "facet.discharge_curves.mainvalues.w"));
+        Facet wfacet2 = new MainValuesWFacet(
+            MAINVALUES_W,
+            Resources.getMsg(
+                callMeta,
+                "facet.discharge_curves.mainvalues.w",
+                "facet.discharge_curves.mainvalues.w"));
 
         List<Facet> fs = new ArrayList<Facet>();
-        fs.add(qfacet);
-        fs.add(wfacet);
+        fs.add(qfacet1);
+        fs.add(qfacet2);
+        fs.add(wfacet1);
+        fs.add(wfacet2);
 
         facets.put(state.getID(), fs);
         spawnState();
@@ -262,4 +282,36 @@
         }
         return filteredList;
     }
+
+
+    /**
+     * Determines Facets initial disposition regarding activity (think of
+     * selection in Client ThemeList GUI). This will be checked one time
+     * when the facet enters a collections describe document.
+     *
+     * @param facetName name of the facet.
+     * @param index     index of the facet.
+     * @return 0 if not active
+     */
+    @Override
+    public int getInitialFacetActivity(
+        String outputName,
+        String facetName,
+        int index)
+    {
+        logger.debug("MainValuesArtifact.active?: "
+           + outputName
+           + "/"
+           + facetName);
+
+        if (outputName.equals("computed_discharge_curve")) {
+            logger.debug("active? no: " + outputName + "/" + facetName);
+            return 0;
+        }
+        else {
+            logger.debug("active? yes: " + outputName + "/" + facetName);
+            return 1;
+        }
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org