changeset 2698:15523818eae4

Implemented states for fix-analysis. flys-artifacts/trunk@4408 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 15 May 2012 13:08:27 +0000
parents 8a6ce15ced7f
children 0ca00d547f35
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/AnalysisPeriods.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/PreprocessingSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/ReferencePeriod.java
diffstat 6 files changed, 79 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 15 13:04:01 2012 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 15 13:08:27 2012 +0000
@@ -1,3 +1,14 @@
+2012-05-15  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml:
+	  Adjusted state data fields.
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/ReferencePeriod.java,
+	  src/main/java/de/intevation/flys/artifacts/states/fixation/PreprocessingSelect.java,
+	  src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java,
+	  src/main/java/de/intevation/flys/artifacts/states/fixation/AnalysisPeriods.java:
+	  Implemented states.
+
 2012-05-15  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/math/fitting/Function.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Tue May 15 13:04:01 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Tue May 15 13:08:27 2012 +0000
@@ -78,7 +78,8 @@
         <state id="state.fix.analysis.referenceperiod"
             description="state.fix.analysis.referenceperiod"
             state="de.intevation.flys.artifacts.states.fixation.ReferencePeriod">
-            <data name="referenceperiod" type="Long[]"/>
+            <data name="start" type="Long"/>
+            <data name="end" type="Long"/>
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
@@ -89,7 +90,10 @@
         <state id="state.fix.analysis.analysisperiods"
             description="state.fix.analysis.analysisperiods"
             state="de.intevation.flys.artifacts.states.fixation.AnalysisPeriods">
-            <data name="analysisperiods" type="Long[]"/>
+            <!--Temporary data fields. These have to be changed to take n
+                periods-->
+            <data name="start" type="Long"/>
+            <data name="end" type="Long"/>
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition">
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/AnalysisPeriods.java	Tue May 15 13:04:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/AnalysisPeriods.java	Tue May 15 13:08:27 2012 +0000
@@ -33,67 +33,10 @@
     public AnalysisPeriods() {
     }
 
-
-    /**
-     * Initialize the state based on the state node in the configuration.
-     *
-     * @param config The state configuration node.
-     */
-    public void setup(Node config) {
-        super.setup(config);
+    @Override
+    protected String getUIProvider() {
+        return "fix.period_panel";
     }
 
-
-    protected Element createData(
-        XMLUtils.ElementCreator cr,
-        Artifact    artifact,
-        StateData   data,
-        CallContext context)
-    {
-        Element select = ProtocolUtils.createArtNode(
-            cr, "select",
-            new String[] { "uiprovider" },
-            new String[] { "time_range_selector" });
-        cr.addAttr(select, "name", data.getName(), true);
-
-        Element label = ProtocolUtils.createArtNode(
-            cr, "label", null, null);
-
-        select.appendChild(label);
-
-        label.setTextContent(Resources.getMsg(
-            context.getMeta(),
-            getID(),
-            getID()));
-
-        return select;
-    }
-
-
-    @Override
-    protected Element[] createItems(
-        XMLUtils.ElementCreator cr,
-        Artifact    artifact,
-        String      name,
-        CallContext context)
-    {
-        return null;
-    }
-
-
-    protected Object getLower(FLYSArtifact artifact) {
-        return null;
-    }
-
-
-    protected Object getUpper(FLYSArtifact artifact) {
-        return null;
-    }
-
-
-    @Override
-    protected String getUIProvider() {
-        return "time_range_selector";
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java	Tue May 15 13:04:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java	Tue May 15 13:08:27 2012 +0000
@@ -1,5 +1,8 @@
 package de.intevation.flys.artifacts.states.fixation;
 
+import java.util.Collection;
+import java.util.Iterator;
+
 import org.apache.log4j.Logger;
 
 import org.w3c.dom.Element;
@@ -16,7 +19,8 @@
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.artifacts.states.DefaultState;
-
+import de.intevation.flys.artifacts.math.fitting.Function;
+import de.intevation.flys.artifacts.math.fitting.FunctionFactory;
 
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
@@ -33,5 +37,30 @@
     public FunctionSelect() {
     }
 
+
+    @Override
+    protected Element[] createItems(
+        XMLUtils.ElementCreator ec,
+        Artifact                artifact,
+        String                  name,
+        CallContext             context)
+    {
+        FunctionFactory ff = FunctionFactory.getInstance();
+        Collection fc = ff.getFunctions();
+        Element[] functions = new Element[fc.size()];
+        Iterator i = fc.iterator();
+
+        int j = 0;
+        while(i.hasNext()) {
+            Function f = (Function)i.next();
+            String n = f.getName();
+            String d = f.getDescription();
+            functions[j] = createItem(ec, new String[] {d, n});
+            j++;
+        }
+
+        return functions;
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/PreprocessingSelect.java	Tue May 15 13:04:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/PreprocessingSelect.java	Tue May 15 13:08:27 2012 +0000
@@ -7,6 +7,7 @@
 
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
 
 import de.intevation.artifacts.common.utils.XMLUtils;
 
@@ -33,5 +34,28 @@
     public PreprocessingSelect() {
     }
 
+    @Override
+    protected Element[] createItems(
+        XMLUtils.ElementCreator ec,
+        Artifact                artifact,
+        String                  name,
+        CallContext             context)
+    {
+        CallMeta meta = context.getMeta();
+        Element[] elements = new Element[1];
+        elements[0] = createItem(
+                ec,
+                new String[] {
+                    Resources.getMsg(meta, "preprocess", "preprocess"),
+                    "preprocess"});
+
+        return elements;
+    }
+
+
+    @Override
+    protected String getUIProvider() {
+        return "fix.preprocessing_panel";
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/ReferencePeriod.java	Tue May 15 13:04:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/ReferencePeriod.java	Tue May 15 13:08:27 2012 +0000
@@ -33,5 +33,10 @@
     public ReferencePeriod() {
     }
 
+    @Override
+    protected String getUIProvider() {
+        return "fix.period_panel";
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org