# HG changeset patch # User Ingo Weinzierl # Date 1300126161 0 # Node ID 7142386e86c2fe5bdb6ba9127407b70a20d8c659 # Parent b6b89ff1adee3ce77ebfe5a15fbd6805468ae1d9 Some improvements for displaying old parameters. flys-client/trunk@1471 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b6b89ff1adee -r 7142386e86c2 flys-client/ChangeLog --- a/flys-client/ChangeLog Mon Mar 14 16:35:32 2011 +0000 +++ b/flys-client/ChangeLog Mon Mar 14 18:09:21 2011 +0000 @@ -1,3 +1,13 @@ +2011-03-14 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java, + src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java: + Save the name of the data item. We need the name for feed(). + + * src/main/java/de/intevation/flys/client/client/ui/ParameterList.java: + Before adding further old data items, we gonna check if the item is + already existing in the list. If it exists, the item is not added. + 2011-03-14 Ingo Weinzierl * src/main/java/de/intevation/flys/client/server/ArtifactDescriptionFactory.java, diff -r b6b89ff1adee -r 7142386e86c2 flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java Mon Mar 14 16:35:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java Mon Mar 14 18:09:21 2011 +0000 @@ -50,6 +50,8 @@ * @return the module selection combined with the river selection. */ public Canvas create(Data data) { + dataName = data.getLabel(); + VLayout newLayout = new VLayout(); newLayout.setMembersMargin(10); diff -r b6b89ff1adee -r 7142386e86c2 flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java --- 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; diff -r b6b89ff1adee -r 7142386e86c2 flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java Mon Mar 14 16:35:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java Mon Mar 14 18:09:21 2011 +0000 @@ -45,6 +45,9 @@ /** The combobox.*/ protected ComboBoxItem combobox; + /** The name of the data object.*/ + protected String dataName; + /** * Creates a new UIProvider instance of this class. @@ -90,6 +93,8 @@ * @return a combobox. */ public Canvas create(Data data) { + dataName = data.getLabel(); + VLayout v = new VLayout(); Canvas content = createWidget(data); @@ -114,7 +119,7 @@ GWT.log("SelectProvider - create()"); HLayout layout = new HLayout(); - Label label = new Label(data.getLabel()); + Label label = new Label(data.getDescription()); DynamicForm form = new DynamicForm(); combobox = new ComboBoxItem(data.getLabel()); @@ -141,10 +146,10 @@ protected Data[] getData() { String selection = combobox.getValueAsString(); - DataItem item = new DefaultDataItem("river", null, selection); + DataItem item = new DefaultDataItem(dataName, null, selection); return new Data[] { new DefaultData( - "river", null, null, new DataItem[] { item }, null) }; + dataName, null, null, new DataItem[] { item }, null) }; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :