comparison 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
comparison
equal deleted inserted replaced
31:e8745ca02f2b 32:88c530c25968
6 import com.google.gwt.core.client.GWT; 6 import com.google.gwt.core.client.GWT;
7 import com.google.gwt.i18n.client.DateTimeFormat; 7 import com.google.gwt.i18n.client.DateTimeFormat;
8 import com.google.gwt.user.client.rpc.AsyncCallback; 8 import com.google.gwt.user.client.rpc.AsyncCallback;
9 9
10 import com.smartgwt.client.widgets.Canvas; 10 import com.smartgwt.client.widgets.Canvas;
11 import com.smartgwt.client.widgets.IButton;
12 import com.smartgwt.client.widgets.Window; 11 import com.smartgwt.client.widgets.Window;
13 import com.smartgwt.client.widgets.events.ClickEvent;
14 import com.smartgwt.client.widgets.events.ClickHandler;
15 import com.smartgwt.client.widgets.form.DynamicForm;
16 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
17 import com.smartgwt.client.widgets.layout.Layout; 12 import com.smartgwt.client.widgets.layout.Layout;
18 import com.smartgwt.client.widgets.layout.VLayout; 13 import com.smartgwt.client.widgets.layout.VLayout;
19 import com.smartgwt.client.widgets.tab.Tab; 14 import com.smartgwt.client.widgets.tab.Tab;
20 import com.smartgwt.client.widgets.tab.TabSet; 15 import com.smartgwt.client.widgets.tab.TabSet;
21 16
24 import de.intevation.flys.client.shared.model.Collection; 19 import de.intevation.flys.client.shared.model.Collection;
25 import de.intevation.flys.client.shared.model.Data; 20 import de.intevation.flys.client.shared.model.Data;
26 import de.intevation.flys.client.shared.model.DataItem; 21 import de.intevation.flys.client.shared.model.DataItem;
27 import de.intevation.flys.client.shared.model.DefaultData; 22 import de.intevation.flys.client.shared.model.DefaultData;
28 import de.intevation.flys.client.shared.model.DefaultDataItem; 23 import de.intevation.flys.client.shared.model.DefaultDataItem;
29 import de.intevation.flys.client.shared.model.DefaultCollection;
30 import de.intevation.flys.client.shared.model.River; 24 import de.intevation.flys.client.shared.model.River;
31 25
32 import de.intevation.flys.client.client.Config; 26 import de.intevation.flys.client.client.Config;
33 import de.intevation.flys.client.client.FLYS; 27 import de.intevation.flys.client.client.FLYS;
34 import de.intevation.flys.client.client.FLYSMessages; 28 import de.intevation.flys.client.client.FLYSMessages;
38 import de.intevation.flys.client.client.event.StepForwardEvent; 32 import de.intevation.flys.client.client.event.StepForwardEvent;
39 import de.intevation.flys.client.client.event.StepForwardHandler; 33 import de.intevation.flys.client.client.event.StepForwardHandler;
40 import de.intevation.flys.client.client.event.CollectionChangeHandler; 34 import de.intevation.flys.client.client.event.CollectionChangeHandler;
41 import de.intevation.flys.client.client.services.ArtifactService; 35 import de.intevation.flys.client.client.services.ArtifactService;
42 import de.intevation.flys.client.client.services.ArtifactServiceAsync; 36 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
37 import de.intevation.flys.client.client.services.StepForwardService;
38 import de.intevation.flys.client.client.services.StepForwardServiceAsync;
43 import de.intevation.flys.client.client.services.CreateCollectionService; 39 import de.intevation.flys.client.client.services.CreateCollectionService;
44 import de.intevation.flys.client.client.services.CreateCollectionServiceAsync; 40 import de.intevation.flys.client.client.services.CreateCollectionServiceAsync;
45 import de.intevation.flys.client.client.ui.ModuleSelection; 41 import de.intevation.flys.client.client.ui.ModuleSelection;
46 42
47 43
55 { 51 {
56 /** The ArtifactService used to communicate with the Artifact server. */ 52 /** The ArtifactService used to communicate with the Artifact server. */
57 protected ArtifactServiceAsync artifactService = 53 protected ArtifactServiceAsync artifactService =
58 GWT.create(ArtifactService.class); 54 GWT.create(ArtifactService.class);
59 55
56 /** The StepForwardService used to put data into an existing artifact. */
57 protected StepForwardServiceAsync forwardService =
58 GWT.create(StepForwardService.class);
59
60 /** The ArtifactService used to communicate with the Artifact server. */ 60 /** The ArtifactService used to communicate with the Artifact server. */
61 protected CreateCollectionServiceAsync createCollectionService = 61 protected CreateCollectionServiceAsync createCollectionService =
62 GWT.create(CreateCollectionService.class); 62 GWT.create(CreateCollectionService.class);
63 63
64 /** The message class that provides i18n strings.*/ 64 /** The message class that provides i18n strings.*/
238 DataItem[] riversItems = data[1].getItems(); 238 DataItem[] riversItems = data[1].getItems();
239 239
240 String module = moduleItems[0].getStringValue(); 240 String module = moduleItems[0].getStringValue();
241 String river = riversItems[0].getStringValue(); 241 String river = riversItems[0].getStringValue();
242 242
243 String serverUrl = Config.getInstance().getServerUrl(); 243 final String serverUrl = Config.getInstance().getServerUrl();
244 final Data[] feedData = new Data[] { data[1] };
244 artifactService.create( 245 artifactService.create(
245 serverUrl, module.toLowerCase(), 246 serverUrl, module.toLowerCase(),
246 new AsyncCallback<Artifact>() { 247 new AsyncCallback<Artifact>() {
247 public void onFailure(Throwable caught) { 248 public void onFailure(Throwable caught) {
248 GWT.log("Could not create the new artifact."); 249 GWT.log("Could not create the new artifact.");
251 252
252 public void onSuccess(Artifact artifact) { 253 public void onSuccess(Artifact artifact) {
253 GWT.log("Successfully created a new artifact."); 254 GWT.log("Successfully created a new artifact.");
254 setArtifact(artifact); 255 setArtifact(artifact);
255 256
256 GWT.log("TODO: FEED WITH RIVER!"); 257 forwardService.go(serverUrl, artifact, feedData,
258 new AsyncCallback<Artifact>() {
259 public void onFailure(Throwable caught) {
260 GWT.log("Could not feed the artifact.");
261 GWT.log(caught.getMessage());
262 }
263
264 public void onSuccess(Artifact artifact) {
265 GWT.log("Successfully feed the artifact.");
266 setArtifact(artifact);
267 }
268 });
257 } 269 }
258 }); 270 });
259 } 271 }
260 }); 272 });
261 273

http://dive4elements.wald.intevation.org