diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 38:7142386e86c2

Some improvements for displaying old parameters. flys-client/trunk@1471 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 Mar 2011 18:09:21 +0000
parents dc086030e6a3
children 1458bc0a20e2
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Mon Mar 14 16:35:32 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Mon Mar 14 18:09:21 2011 +0000
@@ -3,6 +3,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import com.google.gwt.core.client.GWT;
+
 import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.layout.HLayout;
@@ -41,6 +43,11 @@
     }
 
 
+    protected void clearOldData() {
+        old.clear();
+    }
+
+
     public void addOldData(Data old) {
         if (old != null) {
             this.old.add(old);
@@ -53,7 +60,10 @@
     public void addOldDatas(Data[] old) {
         if (old != null && old.length > 0) {
             for (Data o: old) {
-                addOldData(o);
+                if (!exists(o)) {
+                    GWT.log("Data '" + o.getLabel() + "' is new.");
+                    addOldData(o);
+                }
             }
 
             return;
@@ -63,6 +73,19 @@
     }
 
 
+    public boolean exists(Data data) {
+        String label = data.getLabel();
+
+        for (Data o: old) {
+            if (label.equals(o.getLabel())) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+
     public void setCurrentData(Data current, UIProvider uiProvider) {
         this.current    = current;
         this.uiProvider = uiProvider;

http://dive4elements.wald.intevation.org