diff flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java @ 32:88c530c25968

Added a service for the ADVANCE operation and a service that bundles FEED and ADVANCE in a single service. flys-client/trunk@1451 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 10 Mar 2011 10:53:41 +0000
parents 5709bd8f4d7c
children 3cacc9d2dd01
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Wed Mar 09 09:51:02 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Thu Mar 10 10:53:41 2011 +0000
@@ -8,12 +8,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.IButton;
 import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
 import com.smartgwt.client.widgets.layout.Layout;
 import com.smartgwt.client.widgets.layout.VLayout;
 import com.smartgwt.client.widgets.tab.Tab;
@@ -26,7 +21,6 @@
 import de.intevation.flys.client.shared.model.DataItem;
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.DefaultDataItem;
-import de.intevation.flys.client.shared.model.DefaultCollection;
 import de.intevation.flys.client.shared.model.River;
 
 import de.intevation.flys.client.client.Config;
@@ -40,6 +34,8 @@
 import de.intevation.flys.client.client.event.CollectionChangeHandler;
 import de.intevation.flys.client.client.services.ArtifactService;
 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
+import de.intevation.flys.client.client.services.StepForwardService;
+import de.intevation.flys.client.client.services.StepForwardServiceAsync;
 import de.intevation.flys.client.client.services.CreateCollectionService;
 import de.intevation.flys.client.client.services.CreateCollectionServiceAsync;
 import de.intevation.flys.client.client.ui.ModuleSelection;
@@ -57,6 +53,10 @@
     protected ArtifactServiceAsync artifactService =
         GWT.create(ArtifactService.class);
 
+    /** The StepForwardService used to put data into an existing artifact. */
+    protected StepForwardServiceAsync forwardService =
+        GWT.create(StepForwardService.class);
+
     /** The ArtifactService used to communicate with the Artifact server. */
     protected CreateCollectionServiceAsync createCollectionService =
         GWT.create(CreateCollectionService.class);
@@ -240,7 +240,8 @@
                 String module = moduleItems[0].getStringValue();
                 String river  = riversItems[0].getStringValue();
 
-                String serverUrl = Config.getInstance().getServerUrl();
+                final String serverUrl = Config.getInstance().getServerUrl();
+                final Data[] feedData  = new Data[] { data[1] };
                 artifactService.create(
                     serverUrl, module.toLowerCase(),
                     new AsyncCallback<Artifact>() {
@@ -253,7 +254,18 @@
                             GWT.log("Successfully created a new artifact.");
                             setArtifact(artifact);
 
-                            GWT.log("TODO: FEED WITH RIVER!");
+                            forwardService.go(serverUrl, artifact, feedData,
+                            new AsyncCallback<Artifact>() {
+                                public void onFailure(Throwable caught) {
+                                    GWT.log("Could not feed the artifact.");
+                                    GWT.log(caught.getMessage());
+                                }
+
+                                public void onSuccess(Artifact artifact) {
+                                    GWT.log("Successfully feed the artifact.");
+                                    setArtifact(artifact);
+                                }
+                            });
                         }
                 });
             }

http://dive4elements.wald.intevation.org