changeset 77:0e38f512f7e4

Some improvements an bugfixes done gnv-artifacts/trunk@92 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 16 Sep 2009 07:49:46 +0000
parents 2473440671ce
children 969faa37a11b
files gnv-artifacts/Changelog gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java
diffstat 6 files changed, 112 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/Changelog	Tue Sep 15 10:11:08 2009 +0000
+++ b/gnv-artifacts/Changelog	Wed Sep 16 07:49:46 2009 +0000
@@ -1,3 +1,16 @@
+2009-09-16  Tim Englich  <tim.englich@intevation.de>
+
+    * src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java (setup) Edited:
+      Bug Fixed because of Infrastructure Changes in the Artifact-Module
+       
+    * src/main/java/de/intevation/gnv/transition/TransitionBase.java Edited:
+      Put only the last DescribeData to the UI-Output bnecause auf Renderingproblems in the Client
+       
+    * src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java Edited, 
+      src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java Edited, 
+      src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java Edited:
+      Made Interface Serializable, add UIDs to the Implementations of the Interface 
+      
 2009-09-15  Tim Englich  <tim.englich@intevation.de>
 
     * src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java (createUserInterface) Edited:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Tue Sep 15 10:11:08 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Wed Sep 16 07:49:46 2009 +0000
@@ -166,8 +166,15 @@
     public void setup(String identifier, ArtifactFactory factory, Object context) {
         log.debug("GNVArtifactBase.setup");
         super.setup(identifier, factory, context);
-        if (context instanceof GNVArtifactContext){
-            GNVArtifactContext gnvContext = (GNVArtifactContext)context;
+        
+        Object localContext = context;
+        if (context instanceof CallContext){
+            localContext = ((CallContext)context).globalContext();
+            
+        }
+        
+        if (localContext instanceof GNVArtifactContext){
+            GNVArtifactContext gnvContext = (GNVArtifactContext)localContext;
             Document doc = gnvContext.getConfig();
             Node artifactNode = this.getConfigurationFragment(doc);
             NodeList transitionList = Config.getNodeSetXPath(artifactNode, "transitions/transition");
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Tue Sep 15 10:11:08 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Wed Sep 16 07:49:46 2009 +0000
@@ -35,6 +35,12 @@
  *
  */
 public abstract class TransitionBase implements Transition {
+    
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = 2411169179001645426L;
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -238,79 +244,82 @@
             ArtifactXMLUtilities xmlutilities = new ArtifactXMLUtilities();
             Iterator<Object> it = this.descibeData.iterator();
             while (it.hasNext()){
+                
                 Object o = it.next();
-                if (o instanceof Collection<?>){
-                    Element selectNode = xmlutilities.createXFormElement(document,"select");
-                    // TODO: HACK:
-                    // BESSERE LÖSUNG FINDEN
-                    Object[] names = this.inputValueNames.toArray();
-                    String name = names[names.length-1].toString();
-                    
-                    selectNode.setAttribute("ref", name);
-                    
-                    Element lableNode = xmlutilities.createXFormElement(document, "label");
-                    lableNode.setTextContent(name);
-                    Element choiceNode = xmlutilities.createXFormElement(document, "choices");
-                    
-                    Collection<KeyValueDescibeData> values = (Collection)o;
-                    Iterator<KeyValueDescibeData> resultIt = values.iterator();
-                    while (resultIt.hasNext()){
-                        KeyValueDescibeData result = resultIt.next();
-                        Element itemNode = xmlutilities.createXFormElement(document, "item");
+                if (!it.hasNext()){
+                    if (o instanceof Collection<?>){
+                        Element selectNode = xmlutilities.createXFormElement(document,"select");
+                        // TODO: HACK:
+                        // BESSERE LÖSUNG FINDEN
+                        Object[] names = this.inputValueNames.toArray();
+                        String name = names[names.length-1].toString();
                         
-                        
-                        Element choiceLableNode = xmlutilities.createXFormElement(document, "label");
-                        choiceLableNode.setTextContent(result.getValue());
-                        itemNode.appendChild(choiceLableNode);
+                        selectNode.setAttribute("ref", name);
                         
-                        Element choicValueNode = xmlutilities.createXFormElement(document, "value");
-                        choicValueNode.setTextContent(""+result.getKey());
-                        itemNode.appendChild(choicValueNode);
+                        Element lableNode = xmlutilities.createXFormElement(document, "label");
+                        lableNode.setTextContent(name);
+                        Element choiceNode = xmlutilities.createXFormElement(document, "choices");
                         
-                        choiceNode.appendChild(itemNode);
+                        Collection<KeyValueDescibeData> values = (Collection)o;
+                        Iterator<KeyValueDescibeData> resultIt = values.iterator();
+                        while (resultIt.hasNext()){
+                            KeyValueDescibeData result = resultIt.next();
+                            Element itemNode = xmlutilities.createXFormElement(document, "item");
+                            
+                            
+                            Element choiceLableNode = xmlutilities.createXFormElement(document, "label");
+                            choiceLableNode.setTextContent(result.getValue());
+                            itemNode.appendChild(choiceLableNode);
+                            
+                            Element choicValueNode = xmlutilities.createXFormElement(document, "value");
+                            choicValueNode.setTextContent(""+result.getKey());
+                            itemNode.appendChild(choicValueNode);
+                            
+                            choiceNode.appendChild(itemNode);
+                        }
+                        selectNode.appendChild(lableNode);
+                        selectNode.appendChild(choiceNode);
+                        rootNode.appendChild(selectNode);
+                    }else if (o instanceof MinMaxDescribeData){
+                        MinMaxDescribeData descibeData = (MinMaxDescribeData)o;
+                        Object min = descibeData.getMinValue();
+                        Object max = descibeData.getMaxValue();
+                        if (min instanceof GregorianCalendar){
+                            Date d = ((GregorianCalendar)min).getTime();
+                            min = DateUtils.getPatternedDateAmer(d);
+                        }
+                        
+                        if (max instanceof GregorianCalendar){
+                            Date d = ((GregorianCalendar)max).getTime();
+                            max = DateUtils.getPatternedDateAmer(d);
+                        }
+                        
+                        Element inputMinNode = xmlutilities.createXFormElement(document, "input");
+                        inputMinNode.setAttribute("ref", "minvalue");
+                        Element inputMinLableNode = xmlutilities.createXFormElement(document, "label");
+                        inputMinLableNode.setTextContent("minvalue");
+                        inputMinNode.appendChild(inputMinLableNode);
+                        
+                        Element inputMinValueNode = xmlutilities.createXFormElement(document, "value");
+                        inputMinValueNode.setTextContent(min.toString());
+                        inputMinNode.appendChild(inputMinValueNode);
+                        
+                        Element inputMaxNode = xmlutilities.createXFormElement(document, "input");
+                        inputMaxNode.setAttribute("ref", "maxvalue");
+                        Element inputMaxLableNode = xmlutilities.createXFormElement(document, "label");
+                        inputMaxLableNode.setTextContent("maxvalue");
+                        inputMaxNode.appendChild(inputMaxLableNode);
+                        
+                        Element inputMaxValueNode = xmlutilities.createXFormElement(document, "value");
+                        inputMaxValueNode.setTextContent(max.toString());
+                        inputMaxNode.appendChild(inputMaxValueNode);
+                        
+                        rootNode.appendChild(inputMinNode);
+                        rootNode.appendChild(inputMaxNode);
+                        
                     }
-                    selectNode.appendChild(lableNode);
-                    selectNode.appendChild(choiceNode);
-                    rootNode.appendChild(selectNode);
-                }else if (o instanceof MinMaxDescribeData){
-                    MinMaxDescribeData descibeData = (MinMaxDescribeData)o;
-                    Object min = descibeData.getMinValue();
-                    Object max = descibeData.getMaxValue();
-                    if (min instanceof GregorianCalendar){
-                        Date d = ((GregorianCalendar)min).getTime();
-                        min = DateUtils.getPatternedDateAmer(d);
-                    }
-                    
-                    if (max instanceof GregorianCalendar){
-                        Date d = ((GregorianCalendar)max).getTime();
-                        max = DateUtils.getPatternedDateAmer(d);
-                    }
-                    
-                    Element inputMinNode = xmlutilities.createXFormElement(document, "input");
-                    inputMinNode.setAttribute("ref", "minvalue");
-                    Element inputMinLableNode = xmlutilities.createXFormElement(document, "label");
-                    inputMinLableNode.setTextContent("minvalue");
-                    inputMinNode.appendChild(inputMinLableNode);
-                    
-                    Element inputMinValueNode = xmlutilities.createXFormElement(document, "value");
-                    inputMinValueNode.setTextContent(min.toString());
-                    inputMinNode.appendChild(inputMinValueNode);
-                    
-                    Element inputMaxNode = xmlutilities.createXFormElement(document, "input");
-                    inputMaxNode.setAttribute("ref", "maxvalue");
-                    Element inputMaxLableNode = xmlutilities.createXFormElement(document, "label");
-                    inputMaxLableNode.setTextContent("maxvalue");
-                    inputMaxNode.appendChild(inputMaxLableNode);
-                    
-                    Element inputMaxValueNode = xmlutilities.createXFormElement(document, "value");
-                    inputMaxValueNode.setTextContent(max.toString());
-                    inputMaxNode.appendChild(inputMaxValueNode);
-                    
-                    rootNode.appendChild(inputMinNode);
-                    rootNode.appendChild(inputMaxNode);
-                    
+    
                 }
-
             }
         }
        
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java	Tue Sep 15 10:11:08 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultKeyValueDescribeData.java	Wed Sep 16 07:49:46 2009 +0000
@@ -8,6 +8,11 @@
  */
 public class DefaultKeyValueDescribeData implements KeyValueDescibeData {
 
+    /**
+     *
+     */
+    private static final long serialVersionUID = -924469415242703108L;
+
     private int key;
     
     private String value = null;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java	Tue Sep 15 10:11:08 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/DefaultMinMaxDescribeData.java	Wed Sep 16 07:49:46 2009 +0000
@@ -8,6 +8,11 @@
  */
 public class DefaultMinMaxDescribeData implements MinMaxDescribeData {
 
+    /**
+     *
+     */
+    private static final long serialVersionUID = -2917176219029052295L;
+
     private Object minValue = null;
     
     private Object maxValue = null;
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java	Tue Sep 15 10:11:08 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/describedata/KeyValueDescibeData.java	Wed Sep 16 07:49:46 2009 +0000
@@ -2,11 +2,14 @@
  *
  */
 package de.intevation.gnv.transition.describedata;
+
+import java.io.Serializable;
+
 /**
  * @author Tim Englich <tim.englich@intevation.de>
  *
  */
-public interface KeyValueDescibeData {
+public interface KeyValueDescibeData extends Serializable {
     
     public int getKey();
     

http://dive4elements.wald.intevation.org