changeset 2556:efb2038783f9

Renamed state data fields for W/Q input. flys-artifacts/trunk@4074 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 17 Feb 2012 11:03:28 +0000
parents ba46af45b6e4
children adb8641f5b5d
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/winfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java
diffstat 6 files changed, 35 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Feb 17 09:20:02 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Feb 17 11:03:28 2012 +0000
@@ -1,3 +1,14 @@
+2012-02-17  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java,
+	  src/main/java/de/intevation/flys/artifacts/states/WQSelect.java,
+	  src/main/java/de/intevation/flys/utils/FLYSUtils.java,
+	  doc/conf/artifacts/winfo.xml:
+	  Renamed state data fields: wq_mode      -> wq_isq
+	                             wq_free      -> wq_isfree
+	                             wq_selection -> wq_isrange
+
 2012-02-17  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/WaterlevelExporter.java:
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml	Fri Feb 17 09:20:02 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/winfo.xml	Fri Feb 17 11:03:28 2012 +0000
@@ -154,9 +154,9 @@
         </transition>
 
         <state id="state.winfo.wq" description="state.winfo.wq" state="de.intevation.flys.artifacts.states.WQSelect">
-            <data name="wq_mode" type="String" />
-            <data name="wq_free" type="Boolean" />
-            <data name="wq_selection" type="String" />
+            <data name="wq_isq" type="Boolean" />
+            <data name="wq_isfree" type="Boolean" />
+            <data name="wq_isrange" type="Boolean" />
             <data name="wq_from" type="Double" />
             <data name="wq_to" type="Double" />
             <data name="wq_step" type="Double" />
@@ -165,7 +165,7 @@
 
         <state id="state.winfo.wq_adapted" description="state.winfo.wq_adapted" state="de.intevation.flys.artifacts.states.WQAdapted">
             <!-- TODO Add data objects -->
-            <data name="wq_mode"   type="String" />
+            <data name="wq_isq"   type="String" />
             <data name="wq_values" type="WQTriple" />
         </state>
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Feb 17 09:20:02 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Feb 17 11:03:28 2012 +0000
@@ -1116,8 +1116,8 @@
      * @return the selected Q values or null, if no Q values are selected.
      */
     public double[] getQs() {
-        StateData dMode      = getData("wq_mode");
-        StateData dSelection = getData("wq_selection");
+        StateData dMode      = getData("wq_isq");
+        StateData dSelection = getData("wq_isrange");
 
         boolean isRange = dSelection != null
             ? Boolean.valueOf((String)dSelection.getValue())
@@ -1139,13 +1139,13 @@
 
 
     public boolean isQ() {
-        StateData mode = getData("wq_mode");
+        StateData mode = getData("wq_isq");
         String value = (mode != null) ? (String) mode.getValue() : null;
         return value != null ? Boolean.valueOf(value) : false;
     }
 
     public boolean isW() {
-        StateData mode = getData("wq_mode");
+        StateData mode = getData("wq_isq");
         String value = (mode != null) ? (String) mode.getValue() : null;
         return value != null ? !Boolean.valueOf(value) : false;
     }
@@ -1154,7 +1154,7 @@
         if(!isW()) {
             return false;
         }
-        StateData mode = getData("wq_free");
+        StateData mode = getData("wq_isfree");
         String value =  (mode != null) ? (String) mode.getValue() : null;
 
         return value != null ? Boolean.valueOf(value) : false;
@@ -1173,7 +1173,7 @@
         if(!isQ()) {
             return false;
         }
-        StateData mode  = getData("wq_free");
+        StateData mode  = getData("wq_isfree");
         String    value = (mode != null) ? (String) mode.getValue() : null;
 
         logger.debug("isFreeQ: " + value);
@@ -1190,7 +1190,7 @@
      * @return an array of Q values.
      */
     public double[] getQs(double[] range) {
-        StateData dMode   = getData("wq_mode");
+        StateData dMode   = getData("wq_isq");
 
         if (isQ()) {
             return getWQForDist(range);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java	Fri Feb 17 09:20:02 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java	Fri Feb 17 11:03:28 2012 +0000
@@ -38,7 +38,7 @@
     private static Logger logger = Logger.getLogger(WQAdapted.class);
 
 
-    public static final String FIELD_WQ_MODE = "wq_mode";
+    public static final String FIELD_WQ_MODE = "wq_isq";
 
     public static final String FIELD_WQ_VALUES = "wq_values";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java	Fri Feb 17 09:20:02 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java	Fri Feb 17 11:03:28 2012 +0000
@@ -48,13 +48,13 @@
     public static final int MAX_STEPS = 30;
 
     /** The name of the 'mode' field. */
-    public static final String WQ_MODE = "wq_mode";
+    public static final String WQ_MODE = "wq_isq";
 
     /** Them name fo the 'free' field. */
-    public static final String WQ_FREE = "wq_free";
+    public static final String WQ_FREE = "wq_isfree";
 
     /** The name of the 'selection' field. */
-    public static final String WQ_SELECTION = "wq_selection";
+    public static final String WQ_SELECTION = "wq_isrange";
 
     /** The name of the 'from' field. */
     public static final String WQ_FROM = "wq_from";
@@ -89,8 +89,8 @@
             return super.createStaticData(flys, creator, cc, name, value, type);
         }
 
-        boolean isQ = flys.getDataAsBoolean(WQ_MODE);
-        boolean isFree = flys.getDataAsBoolean(WQ_FREE);
+        Boolean isQ = flys.getDataAsBoolean(WQ_MODE);
+        Boolean isFree = flys.getDataAsBoolean(WQ_FREE);
 
         WINFOArtifact winfo = (WINFOArtifact) flys;
 
@@ -454,10 +454,12 @@
         WINFOArtifact flys = (WINFOArtifact) artifact;
 
         StateData data       = getData(flys, WQ_SELECTION);
-        boolean isRange = data != null 
+        boolean isRange = data != null
             ? Boolean.valueOf((String) data.getValue())
             : false;
 
+
+
         if (!isRange) {
             return validateSingle(artifact);
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Fri Feb 17 09:20:02 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java	Fri Feb 17 11:03:28 2012 +0000
@@ -163,7 +163,7 @@
 
     /**
      * This method returns an WQ_MODE enum which is based on the parameters
-     * stored in <i>flys</i> Artifact. If there is no <i>wq_mode</i> parameter
+     * stored in <i>flys</i> Artifact. If there is no <i>wq_isq</i> parameter
      * existing, WQ_MODE.NONE is returned.
      *
      * @param flys The FLYSArtifact that stores wq mode relevant parameters.
@@ -176,13 +176,13 @@
         }
 
         String values = flys.getDataAsString("wq_values");
-        Boolean isQ    = flys.getDataAsBoolean("wq_mode");
+        Boolean isQ    = flys.getDataAsBoolean("wq_isq");
 
         if (values != null) {
             return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE;
         }
 
-        Boolean isFree = flys.getDataAsBoolean("wq_free");
+        Boolean isFree = flys.getDataAsBoolean("wq_isfree");
 
         if (isQ) {
             return isFree ? WQ_MODE.QFREE : WQ_MODE.QGAUGE;
@@ -201,7 +201,7 @@
             return WQ_INPUT.NONE;
         }
 
-        Boolean selection = flys.getDataAsBoolean("wq_selection");
+        Boolean selection = flys.getDataAsBoolean("wq_isrange");
         String adapted = flys.getDataAsString("wq_values");
 
         if(adapted != null && adapted.length() > 0) {

http://dive4elements.wald.intevation.org