changeset 4209:7d0fb0109c01

Let AnnotationFacets come to life inactively in FixAnalysis LS settings.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 22 Oct 2012 09:10:29 +0200 (2012-10-22)
parents 8fbe7012c4b9
children e47559908acc
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java
diffstat 1 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java	Mon Oct 22 07:51:30 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AnnotationArtifact.java	Mon Oct 22 09:10:29 2012 +0200
@@ -16,10 +16,13 @@
 
 import de.intevation.artifactdatabase.ProtocolUtils;
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifactdatabase.state.FacetActivity;
 import de.intevation.artifactdatabase.state.Output;
 import de.intevation.artifactdatabase.state.State;
 import de.intevation.artifactdatabase.state.StateEngine;
 
+import de.intevation.flys.artifacts.model.FacetTypes;
+
 import de.intevation.artifacts.common.utils.XMLUtils;
 
 import de.intevation.flys.artifacts.states.DefaultState;
@@ -30,7 +33,9 @@
 /**
  * Artifact to access names of Points Of Interest along a segment of a river.
  */
-public class AnnotationArtifact extends StaticFLYSArtifact {
+public class AnnotationArtifact
+extends      StaticFLYSArtifact
+implements   FacetTypes {
 
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(AnnotationArtifact.class);
@@ -38,6 +43,32 @@
     /** The name of the artifact. */
     public static final String ARTIFACT_NAME = "annotation";
 
+    // Let Annotations enter life inactively if in Fix Analysis LS setting.
+    static {
+        FacetActivity.Registry.getInstance().register(
+            "annotation",
+            new FacetActivity() {
+                @Override
+                public Boolean isInitialActive(
+                    Artifact artifact,
+                    Facet    facet,
+                    String   output
+                ) {
+                    if (output.contains(FacetTypes.ChartType.FLSC.toString())) {
+                        // Longitudinal section chart
+                        String name = facet.getName();
+
+                        if (name.contains(FacetTypes.LONGITUDINAL_ANNOTATION)) {
+                            return Boolean.FALSE;
+                        }
+                    }
+
+                    return Boolean.TRUE;
+                }
+            });
+    }
+
+
     @Override
     public void setup(
         String          identifier,

http://dive4elements.wald.intevation.org