changeset 72:9b726350ab07

Moved ParameterList specific code into the ParameterList. flys-client/trunk@1575 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Sat, 26 Mar 2011 18:07:41 +0000
parents 987567f31200
children 39210a74db07
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java
diffstat 3 files changed, 45 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Mar 25 11:51:54 2011 +0000
+++ b/flys-client/ChangeLog	Sat Mar 26 18:07:41 2011 +0000
@@ -1,3 +1,9 @@
+2011-03-26  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/CollectionView.java,
+	  src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  Moved ParameterList specific code into the ParameterList.
+
 2011-03-25  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/services/CreateCollectionService.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Fri Mar 25 11:51:54 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Sat Mar 26 18:07:41 2011 +0000
@@ -31,7 +31,6 @@
 import de.intevation.flys.client.client.FLYSMessages;
 import de.intevation.flys.client.client.event.HasCollectionChangeHandlers;
 import de.intevation.flys.client.client.event.HasParameterChangeHandler;
-import de.intevation.flys.client.client.event.HasStepBackHandlers;
 import de.intevation.flys.client.client.event.HasStepForwardHandlers;
 import de.intevation.flys.client.client.event.CollectionChangeEvent;
 import de.intevation.flys.client.client.event.CollectionChangeHandler;
@@ -135,6 +134,7 @@
 
         addCollectionChangeHandler(this);
         addParameterChangeHandler(this);
+        addParameterChangeHandler(parameterList);
 
         init();
     }
@@ -462,25 +462,6 @@
      */
     protected void updateView() {
         GWT.log("CollectionView.updateView()");
-        ArtifactDescription desc = artifact.getArtifactDescription();
-
-        DataList currentData = desc.getCurrentData();
-        if (currentData != null) {
-            // the user has to enter some attributes
-            String uiProvider   = currentData.getUIProvider();
-            UIProvider provider = UIProviderFactory.getProvider(uiProvider);
-
-            ((HasStepForwardHandlers) provider).addStepForwardHandler(this);
-            ((HasStepBackHandlers) provider).addStepBackHandler(this);
-
-            parameterList.setCurrentData(currentData, provider);
-        }
-        else {
-            // we have reached a final state with no more user input
-            parameterList.setCurrentData(null, null);
-        }
-
-        parameterList.addOldDatas(desc.getOldData());
 
         tabs.setTabTitle(0, messages.winfo());
         tabs.updateTab(0, parameterList);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Mar 25 11:51:54 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Sat Mar 26 18:07:41 2011 +0000
@@ -10,16 +10,21 @@
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
+import de.intevation.flys.client.shared.model.Artifact;
+import de.intevation.flys.client.shared.model.ArtifactDescription;
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.client.event.HasStepBackHandlers;
+import de.intevation.flys.client.client.event.HasStepForwardHandlers;
+import de.intevation.flys.client.client.event.ParameterChangeEvent;
+import de.intevation.flys.client.client.event.ParameterChangeHandler;
 import de.intevation.flys.client.client.event.StepBackEvent;
 import de.intevation.flys.client.client.event.StepBackHandler;
 
 
 public class ParameterList
 extends      VLayout
-implements   StepBackHandler
+implements   StepBackHandler, ParameterChangeHandler
 {
     protected CollectionView cView;
 
@@ -161,5 +166,37 @@
         old.clear();
         oldItems.removeMembers(oldItems.getMembers());
     }
+
+
+    /**
+     * Implements the onCollectionChange() method to do update the GUI after the
+     * parameterization has changed.
+     *
+     * @param event The ParameterChangeEvent.
+     */
+    public void onParameterChange(ParameterChangeEvent event) {
+        GWT.log("ParameterList.onParameterChange");
+
+        Artifact art             = event.getNewValue();
+        ArtifactDescription desc = art.getArtifactDescription();
+
+        DataList currentData = desc.getCurrentData();
+        if (currentData != null) {
+            // the user has to enter some attributes
+            String uiProvider   = currentData.getUIProvider();
+            UIProvider provider = UIProviderFactory.getProvider(uiProvider);
+
+            ((HasStepForwardHandlers) provider).addStepForwardHandler(cView);
+            ((HasStepBackHandlers) provider).addStepBackHandler(cView);
+
+            setCurrentData(currentData, provider);
+        }
+        else {
+            // we have reached a final state with no more user input
+            setCurrentData(null, null);
+        }
+
+        addOldDatas(desc.getOldData());
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org