comparison 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
comparison
equal deleted inserted replaced
37:b6b89ff1adee 38:7142386e86c2
1 package de.intevation.flys.client.client.ui; 1 package de.intevation.flys.client.client.ui;
2 2
3 import java.util.ArrayList; 3 import java.util.ArrayList;
4 import java.util.List; 4 import java.util.List;
5
6 import com.google.gwt.core.client.GWT;
5 7
6 import com.smartgwt.client.types.VerticalAlignment; 8 import com.smartgwt.client.types.VerticalAlignment;
7 import com.smartgwt.client.widgets.Label; 9 import com.smartgwt.client.widgets.Label;
8 import com.smartgwt.client.widgets.layout.HLayout; 10 import com.smartgwt.client.widgets.layout.HLayout;
9 import com.smartgwt.client.widgets.layout.VLayout; 11 import com.smartgwt.client.widgets.layout.VLayout;
39 addMember(oldItems); 41 addMember(oldItems);
40 addMember(currentItems); 42 addMember(currentItems);
41 } 43 }
42 44
43 45
46 protected void clearOldData() {
47 old.clear();
48 }
49
50
44 public void addOldData(Data old) { 51 public void addOldData(Data old) {
45 if (old != null) { 52 if (old != null) {
46 this.old.add(old); 53 this.old.add(old);
47 } 54 }
48 55
51 58
52 59
53 public void addOldDatas(Data[] old) { 60 public void addOldDatas(Data[] old) {
54 if (old != null && old.length > 0) { 61 if (old != null && old.length > 0) {
55 for (Data o: old) { 62 for (Data o: old) {
56 addOldData(o); 63 if (!exists(o)) {
64 GWT.log("Data '" + o.getLabel() + "' is new.");
65 addOldData(o);
66 }
57 } 67 }
58 68
59 return; 69 return;
60 } 70 }
61 71
62 addOldData(null); 72 addOldData(null);
73 }
74
75
76 public boolean exists(Data data) {
77 String label = data.getLabel();
78
79 for (Data o: old) {
80 if (label.equals(o.getLabel())) {
81 return true;
82 }
83 }
84
85 return false;
63 } 86 }
64 87
65 88
66 public void setCurrentData(Data current, UIProvider uiProvider) { 89 public void setCurrentData(Data current, UIProvider uiProvider) {
67 this.current = current; 90 this.current = current;

http://dive4elements.wald.intevation.org